feat: add column color, card coverColor, and board background to data model
This commit is contained in:
@@ -26,6 +26,7 @@ interface BoardActions {
|
||||
deleteColumn: (columnId: string) => void;
|
||||
moveColumn: (fromIndex: number, toIndex: number) => void;
|
||||
setColumnWidth: (columnId: string, width: ColumnWidth) => void;
|
||||
setColumnColor: (columnId: string, color: string | null) => void;
|
||||
|
||||
addCard: (columnId: string, title: string) => string;
|
||||
updateCard: (cardId: string, updates: Partial<Card>) => void;
|
||||
@@ -130,6 +131,7 @@ export const useBoardStore = create<BoardState & BoardActions>()(
|
||||
title,
|
||||
cardIds: [],
|
||||
width: "standard" as ColumnWidth,
|
||||
color: null,
|
||||
},
|
||||
],
|
||||
}));
|
||||
@@ -179,6 +181,16 @@ export const useBoardStore = create<BoardState & BoardActions>()(
|
||||
}));
|
||||
},
|
||||
|
||||
setColumnColor: (columnId, color) => {
|
||||
mutate(get, set, (b) => ({
|
||||
...b,
|
||||
updatedAt: now(),
|
||||
columns: b.columns.map((c) =>
|
||||
c.id === columnId ? { ...c, color } : c
|
||||
),
|
||||
}));
|
||||
},
|
||||
|
||||
// -- Card actions --
|
||||
|
||||
addCard: (columnId, title) => {
|
||||
@@ -191,6 +203,7 @@ export const useBoardStore = create<BoardState & BoardActions>()(
|
||||
checklist: [],
|
||||
dueDate: null,
|
||||
attachments: [],
|
||||
coverColor: null,
|
||||
createdAt: now(),
|
||||
updatedAt: now(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user