From ab4c3eea973cc4c773dc0ce23ebd1280f627ff0c Mon Sep 17 00:00:00 2001 From: dusk Date: Wed, 30 Oct 2024 19:23:03 +0300 Subject: [PATCH] feat: add embed to log --- src/routes/log/+page.server.ts | 5 +++-- src/routes/log/+page.svelte | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/routes/log/+page.server.ts b/src/routes/log/+page.server.ts index 164642d..e2dcfb7 100644 --- a/src/routes/log/+page.server.ts +++ b/src/routes/log/+page.server.ts @@ -26,11 +26,12 @@ export const load = ({ url }) => { page = Math.max(page, 1) // get the notes from the chosen page - const notes = + const notes = new Map( notesList.slice((page - 1) * notesPerPage, page * notesPerPage) .map( - (id) => { return { noteId: id, note: readNote(id) } } + (id) => { return [id, readNote(id)] } ) + ) return { notes, highlightedNote: noteId, page } } diff --git a/src/routes/log/+page.svelte b/src/routes/log/+page.svelte index 8210fa8..98ce0b9 100644 --- a/src/routes/log/+page.svelte +++ b/src/routes/log/+page.svelte @@ -13,8 +13,17 @@ minute: "2-digit", }) } + + const highlightedNote = data.notes.get(data.highlightedNote ?? '') ?? null + + {#if highlightedNote !== null} + + + {/if} + +
gazesystems log file $file.name

-{#each data.notes as { noteId, note }, index} +{#each data.notes as [noteId, note], index}
  
-{#if index < data.notes.length - 1} +{#if index < data.notes.size - 1}
{/if} {/each}