Fix a permanent black line in the note list, and add separators
The drop indicator was a `borderTop` set in the same style object as a `border` shorthand. Clearing the longhand resets its width and colour to the defaults while the shorthand's `solid` stays, so a row kept a 2px black line for good — measured at rest, before any drag. It is now its own element, which also stops the list twitching as a row grows and shrinks by a pixel. That element then turned out to be a dead strip of its own: it pushes the row down as it appears, so the pointer ended up over the line rather than over the row and releasing there dropped on nothing. The drag handlers moved to the whole row and the indicator no longer takes pointer events. A strip below the last row means "put it at the end", which otherwise needs a drop onto the final note. Separators are lines drawn between notes, optionally named, stored on the notebook beside its sort mode. They drag like notes do, and their position is "how many notes come before me", so they hold their place as the notes around them are renamed or edited. Shown only in the manual order — in "newest first" the notes would slide past the line on every edit. "All Notes" and "Starred" no longer offer a hand-made order: they are questions asked of every notebook, so there is nothing for an arrangement to belong to. 199 unit tests, 190 browser checks across eleven suites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a0864c58b
commit
2cee00e38e
10 files changed
+731
-125
No files matched your search
@@ -73,6 +73,7 @@ interface ServerNotebook {
|
||||
sort_order?: number;
|
||||
max_versions?: number | null;
|
||||
sort_mode?: string | null;
|
||||
separators?: string | null;
|
||||
}
|
||||
|
||||
interface ServerNote {
|
||||
@@ -406,6 +407,7 @@ export async function fullSync(): Promise<void> {
|
||||
sortOrder: nb.sort_order || 0,
|
||||
maxVersions: nb.max_versions ?? null,
|
||||
sortMode: (nb.sort_mode as Notebook["sortMode"]) ?? null,
|
||||
separators: parseSeparators(nb.separators),
|
||||
}));
|
||||
const serverNbIds = new Set(nbs.map((nb) => nb.id));
|
||||
const unsyncedNbs = localNbs.filter((nb) => nb._pendingCreate && !serverNbIds.has(nb.id));
|
||||
@@ -447,6 +449,17 @@ export async function fullSync(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Separators travel as a JSON string; a damaged one must not fail the sync. */
|
||||
function parseSeparators(raw: string | null | undefined): Notebook["separators"] {
|
||||
if (!raw) return [];
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return Array.isArray(parsed) ? parsed : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function toNoteMeta(n: ServerNote, trashed: boolean): NoteMeta {
|
||||
return {
|
||||
id: n.id,
|
||||
@@ -476,6 +489,7 @@ type QueuedAction =
|
||||
sortOrder?: number;
|
||||
maxVersions?: number | null;
|
||||
sortMode?: Notebook["sortMode"];
|
||||
separators?: Notebook["separators"];
|
||||
};
|
||||
}
|
||||
| { action: "deleteNotebook"; data: { id: string } }
|
||||
@@ -562,6 +576,7 @@ async function processEntry(entry: QueueEntry): Promise<void> {
|
||||
sortOrder: a.data.sortOrder,
|
||||
...(a.data.maxVersions !== undefined ? { maxVersions: a.data.maxVersions } : {}),
|
||||
...(a.data.sortMode !== undefined ? { sortMode: a.data.sortMode } : {}),
|
||||
...(a.data.separators !== undefined ? { separators: a.data.separators } : {}),
|
||||
});
|
||||
break;
|
||||
case "deleteNotebook":
|
||||
@@ -719,6 +734,7 @@ export async function updateNotebook(id: string, updates: Partial<Notebook>): Pr
|
||||
// has to travel, while undefined must stay away and change nothing.
|
||||
...(updates.maxVersions !== undefined ? { maxVersions: updates.maxVersions } : {}),
|
||||
...(updates.sortMode !== undefined ? { sortMode: updates.sortMode } : {}),
|
||||
...(updates.separators !== undefined ? { separators: updates.separators } : {}),
|
||||
});
|
||||
return;
|
||||
} catch (e) {
|
||||
@@ -734,6 +750,7 @@ export async function updateNotebook(id: string, updates: Partial<Notebook>): Pr
|
||||
sortOrder: updates.sortOrder,
|
||||
maxVersions: updates.maxVersions,
|
||||
sortMode: updates.sortMode,
|
||||
separators: updates.separators,
|
||||
},
|
||||
});
|
||||
notifyStatus("pending");
|
||||
|
||||
Reference in new issue
Block a user