b33d2e7b34
Deliver P5 writer workflow: writing cockpit, manual knowledge CRUD with review, chapter bridge with optional AI, publish status, and stock buffer reminders. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
1013 B
TypeScript
28 lines
1013 B
TypeScript
import { ipcMain } from 'electron'
|
|
import { IPC } from '../../../shared/ipc-channels'
|
|
import { BookRegistryService } from '../../services/book-registry'
|
|
import { CockpitService } from '../../services/cockpit.service'
|
|
import type { GlobalSettingsService } from '../../services/global-settings'
|
|
import { wrap } from '../result'
|
|
|
|
export function registerCockpitHandlers(
|
|
registry: BookRegistryService,
|
|
settings: GlobalSettingsService
|
|
): void {
|
|
ipcMain.handle(
|
|
IPC.COCKPIT_SUMMARY,
|
|
(_e, { bookId, volumeId }: { bookId: string; volumeId?: string }) =>
|
|
wrap(() => new CockpitService(registry.getDb(bookId), settings).getSummary(volumeId))
|
|
)
|
|
|
|
ipcMain.handle(IPC.COCKPIT_MARK_SEEN, (_e, { bookId }: { bookId: string }) =>
|
|
wrap(() => {
|
|
new CockpitService(registry.getDb(bookId), settings).markSeen()
|
|
})
|
|
)
|
|
|
|
ipcMain.handle(IPC.COCKPIT_SHOULD_SHOW, (_e, { bookId }: { bookId: string }) =>
|
|
wrap(() => new CockpitService(registry.getDb(bookId), settings).shouldShowOnOpen())
|
|
)
|
|
}
|