okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221apps/host: the owner's UI and the Node App Host0b3299a01

main
541 B25 linesraw
1/** A small note model for the Fieldnotes prototype. */
2export interface Note {
3  id: string;
4  title: string;
5  body: string;
6  updatedAt: string;
7  pinned: boolean;
8}
9
10export function createNote(title = 'A new idea'): Note {
11  return {
12    id: crypto.randomUUID(),
13    title,
14    body: '',
15    updatedAt: new Date().toISOString(),
16    pinned: false,
17  };
18}
19
20export function recentNotes(notes: Note[]): Note[] {
21  return [...notes].sort((a, b) =>
22    Number(b.pinned) - Number(a.pinned) ||
23    b.updatedAt.localeCompare(a.updatedAt)
24  );
25}