0.4.0 convex及界面修改
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
export type CommentTarget = {
|
||||
workspaceId: string;
|
||||
documentId: string;
|
||||
blockId: string | null;
|
||||
};
|
||||
|
||||
interface CommentsUiState {
|
||||
open: boolean;
|
||||
target: CommentTarget | null;
|
||||
openForPage: (args: { workspaceId: string; documentId: string }) => void;
|
||||
openForBlock: (args: { workspaceId: string; documentId: string; blockId: string }) => void;
|
||||
close: () => void;
|
||||
}
|
||||
|
||||
export const useCommentsUiStore = create<CommentsUiState>((set) => ({
|
||||
open: false,
|
||||
target: null,
|
||||
openForPage: ({ workspaceId, documentId }) =>
|
||||
set({
|
||||
open: true,
|
||||
target: { workspaceId, documentId, blockId: null },
|
||||
}),
|
||||
openForBlock: ({ workspaceId, documentId, blockId }) =>
|
||||
set({
|
||||
open: true,
|
||||
target: { workspaceId, documentId, blockId },
|
||||
}),
|
||||
close: () => set({ open: false }),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user