mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Add board view/edit mode separation with cancel button.
/boards/[id] is now view mode (read-only) with an edit button. /boards/[id]/edit is edit mode with save and cancel buttons. Save navigates back to view, cancel discards changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3b4776b0e0
commit
a8534a9d4d
7 changed files with 153 additions and 74 deletions
|
|
@ -10,6 +10,7 @@ export type LayoutGetter = () => Partial<BoardParameters> | null;
|
|||
|
||||
export interface BoardContextValue {
|
||||
board: Partial<Board>;
|
||||
editing: boolean;
|
||||
updateBoard: (data: Partial<Board>) => void;
|
||||
saveBoard: () => Promise<Board>;
|
||||
isPending: boolean;
|
||||
|
|
@ -26,7 +27,15 @@ const createDefaultBoard = (): Partial<Board> => ({
|
|||
},
|
||||
});
|
||||
|
||||
export function BoardProvider({ boardId, children }: { boardId?: string; children: ReactNode }) {
|
||||
export function BoardProvider({
|
||||
boardId,
|
||||
editing = false,
|
||||
children,
|
||||
}: {
|
||||
boardId?: string;
|
||||
editing?: boolean;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { data, isFetching, isLoading } = useBoardQuery(boardId);
|
||||
const { post, useMutation } = useApi();
|
||||
const { touch } = useModified();
|
||||
|
|
@ -103,7 +112,7 @@ export function BoardProvider({ boardId, children }: { boardId?: string; childre
|
|||
|
||||
return (
|
||||
<BoardContext.Provider
|
||||
value={{ board, updateBoard, saveBoard, isPending, registerLayoutGetter }}
|
||||
value={{ board, editing, updateBoard, saveBoard, isPending, registerLayoutGetter }}
|
||||
>
|
||||
{children}
|
||||
</BoardContext.Provider>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue