feat: resolve all 22 items in Features and Bugs.txt and complete UI polish
This commit is contained in:
@@ -123,6 +123,16 @@ export const storageLocal: StorageAdapter = {
|
||||
return p;
|
||||
},
|
||||
|
||||
async deleteProject(id: string): Promise<void> {
|
||||
await db.projects.delete(id);
|
||||
await db.books.where("projectId").equals(id).delete();
|
||||
await db.chapters.where("projectId").equals(id).delete();
|
||||
await db.entities.where("projectId").equals(id).delete();
|
||||
await db.boards.where("projectId").equals(id).delete();
|
||||
await db.plotBeats.where("projectId").equals(id).delete();
|
||||
await db.aiSessions.where("projectId").equals(id).delete();
|
||||
},
|
||||
|
||||
async createBook(b: { projectId: string; title: string }): Promise<Book> {
|
||||
const id = createUlid();
|
||||
const book: Book = { id, projectId: b.projectId, title: b.title, order: 0, chapters: [] };
|
||||
@@ -140,8 +150,16 @@ export const storageLocal: StorageAdapter = {
|
||||
return rows.sort((a, b) => a.order - b.order);
|
||||
},
|
||||
|
||||
async deleteChapter(id: string): Promise<void> {
|
||||
await db.chapters.delete(id);
|
||||
},
|
||||
|
||||
async saveDocument(doc: DocumentRef): Promise<void> {
|
||||
const existing = await db.chapters.get(doc.id);
|
||||
const existingCount =
|
||||
!existing && doc.bookId
|
||||
? await db.chapters.where("bookId").equals(doc.bookId).count()
|
||||
: 0;
|
||||
const base: Chapter = existing ?? {
|
||||
id: doc.id,
|
||||
bookId: doc.bookId ?? "",
|
||||
@@ -149,7 +167,7 @@ export const storageLocal: StorageAdapter = {
|
||||
title: doc.title,
|
||||
doc: doc.doc,
|
||||
rev: 0,
|
||||
order: 0,
|
||||
order: existingCount,
|
||||
meta: { wordCount: 0, scenes: [], updatedAt: nowIso() },
|
||||
};
|
||||
await db.chapters.put({
|
||||
|
||||
@@ -31,11 +31,13 @@ export interface StorageAdapter {
|
||||
listProjects(): Promise<ProjectMeta[]>;
|
||||
createProject(p: NewProject): Promise<Project>;
|
||||
getProject(id: string): Promise<Project>;
|
||||
deleteProject?(id: string): Promise<void>;
|
||||
|
||||
// books & chapters
|
||||
createBook(b: { projectId: string; title: string }): Promise<Book>;
|
||||
listBooks(projectId: string): Promise<Book[]>;
|
||||
listChapters(bookId: string): Promise<Chapter[]>;
|
||||
deleteChapter?(id: string): Promise<void>;
|
||||
|
||||
// content (debounced autosave)
|
||||
saveDocument(doc: DocumentRef): Promise<void>;
|
||||
|
||||
@@ -19,6 +19,8 @@ export interface User {
|
||||
email: string;
|
||||
displayName: string;
|
||||
role: Role;
|
||||
/** Whether the account is locked out (auth + admin API access). */
|
||||
disabled?: boolean | undefined;
|
||||
/** Optional, never required in v1. */
|
||||
passKey?: string;
|
||||
createdAt: string;
|
||||
@@ -313,6 +315,10 @@ export interface AISession {
|
||||
projectId: string;
|
||||
title: string;
|
||||
kind: SessionKind;
|
||||
archived?: boolean | undefined;
|
||||
agentId?: string | undefined;
|
||||
providerId?: string | undefined;
|
||||
model?: string | undefined;
|
||||
messages: AIMessage[];
|
||||
suggestions: AISuggestion[];
|
||||
notes: AINote[];
|
||||
|
||||
Reference in New Issue
Block a user