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:
@@ -24,6 +24,7 @@ export const tagsService = {
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned,
|
||||
usage: tag._count.taskTags
|
||||
}));
|
||||
},
|
||||
@@ -41,7 +42,8 @@ export const tagsService = {
|
||||
return {
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned
|
||||
};
|
||||
},
|
||||
|
||||
@@ -62,14 +64,15 @@ export const tagsService = {
|
||||
return {
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Crée un nouveau tag
|
||||
*/
|
||||
async createTag(data: { name: string; color: string }): Promise<Tag> {
|
||||
async createTag(data: { name: string; color: string; isPinned?: boolean }): Promise<Tag> {
|
||||
// Vérifier si le tag existe déjà
|
||||
const existing = await this.getTagByName(data.name);
|
||||
if (existing) {
|
||||
@@ -79,21 +82,23 @@ export const tagsService = {
|
||||
const tag = await prisma.tag.create({
|
||||
data: {
|
||||
name: data.name.trim(),
|
||||
color: data.color
|
||||
color: data.color,
|
||||
isPinned: data.isPinned || false
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Met à jour un tag
|
||||
*/
|
||||
async updateTag(id: string, data: { name?: string; color?: string }): Promise<Tag | null> {
|
||||
async updateTag(id: string, data: { name?: string; color?: string; isPinned?: boolean }): Promise<Tag | null> {
|
||||
// Vérifier que le tag existe
|
||||
const existing = await this.getTagById(id);
|
||||
if (!existing) {
|
||||
@@ -115,6 +120,9 @@ export const tagsService = {
|
||||
if (data.color !== undefined) {
|
||||
updateData.color = data.color;
|
||||
}
|
||||
if (data.isPinned !== undefined) {
|
||||
updateData.isPinned = data.isPinned;
|
||||
}
|
||||
|
||||
if (Object.keys(updateData).length === 0) {
|
||||
return existing;
|
||||
@@ -128,7 +136,8 @@ export const tagsService = {
|
||||
return {
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned
|
||||
};
|
||||
},
|
||||
|
||||
@@ -197,7 +206,8 @@ export const tagsService = {
|
||||
return tags.map(tag => ({
|
||||
id: tag.id,
|
||||
name: tag.name,
|
||||
color: tag.color
|
||||
color: tag.color,
|
||||
isPinned: tag.isPinned
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user