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({
|
||||
|
||||
Reference in New Issue
Block a user