feat: ship v1.0.0 with character graph and writing analytics

Add P7 Cytoscape relationship graph with setting CRUD, P9 cockpit analytics driven by writing_sessions, chapter POV selection, and full test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-08 10:48:31 +08:00
parent 2c9b034a29
commit 4adafa1936
44 changed files with 2062 additions and 602 deletions
+34
View File
@@ -0,0 +1,34 @@
import { create } from 'zustand'
import type { CharacterGraphData } from '@shared/types'
import { ipcCall } from '@renderer/lib/ipc-client'
interface GraphState {
open: boolean
data: CharacterGraphData | null
loading: boolean
filter: 'all' | 'connected'
openModal: () => void
close: () => void
load: (bookId: string, filter?: 'all' | 'connected') => Promise<void>
setFilter: (filter: 'all' | 'connected') => void
}
export const useGraphStore = create<GraphState>((set, get) => ({
open: false,
data: null,
loading: false,
filter: 'all',
openModal: () => set({ open: true }),
close: () => set({ open: false, data: null }),
setFilter: (filter) => set({ filter }),
load: async (bookId, filter) => {
const f = filter ?? get().filter
set({ loading: true })
try {
const data = await ipcCall(() => window.electronAPI.graph.getData(bookId, f))
set({ data, filter: f })
} finally {
set({ loading: false })
}
}
}))