feat: add pinned tag functionality and UI enhancements
- Introduced `isPinned` property to the `Tag` model for marking main objectives. - Updated `TagForm` to include a checkbox for setting tags as pinned, enhancing user interaction. - Enhanced `KanbanBoardContainer` to display pinned tasks in a dedicated `ObjectivesBoard`, improving task visibility. - Modified `KanbanFilters` to support filtering by pinned tags, streamlining task management. - Adjusted `TasksContext` to separate pinned tasks from regular tasks for better organization.
This commit is contained in:
@@ -6,10 +6,11 @@ import { tagsService } from '@/services/tags';
|
||||
*/
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const tag = await tagsService.getTagById(params.id);
|
||||
const { id } = await params;
|
||||
const tag = await tagsService.getTagById(id);
|
||||
|
||||
if (!tag) {
|
||||
return NextResponse.json(
|
||||
@@ -40,11 +41,12 @@ export async function GET(
|
||||
*/
|
||||
export async function PATCH(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params;
|
||||
const body = await request.json();
|
||||
const { name, color } = body;
|
||||
const { name, color, isPinned } = body;
|
||||
|
||||
// Validation
|
||||
if (name !== undefined && (typeof name !== 'string' || !name.trim())) {
|
||||
@@ -61,7 +63,7 @@ export async function PATCH(
|
||||
);
|
||||
}
|
||||
|
||||
const tag = await tagsService.updateTag(params.id, { name, color });
|
||||
const tag = await tagsService.updateTag(id, { name, color, isPinned });
|
||||
|
||||
if (!tag) {
|
||||
return NextResponse.json(
|
||||
@@ -107,10 +109,11 @@ export async function PATCH(
|
||||
*/
|
||||
export async function DELETE(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
await tagsService.deleteTag(params.id);
|
||||
const { id } = await params;
|
||||
await tagsService.deleteTag(id);
|
||||
|
||||
return NextResponse.json({
|
||||
message: 'Tag supprimé avec succès'
|
||||
|
||||
Reference in New Issue
Block a user