feat: add embed to log

This commit is contained in:
dusk 2024-10-30 19:23:03 +03:00
parent 3d951a673a
commit ab4c3eea97
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
2 changed files with 14 additions and 4 deletions

View File

@ -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 }
}

View File

@ -13,8 +13,17 @@
minute: "2-digit",
})
}
const highlightedNote = data.notes.get(data.highlightedNote ?? '') ?? null
</script>
<svelte:head>
{#if highlightedNote !== null}
<meta property="og:description" content={highlightedNote.content} />
<meta property="og:title" content="log #{data.highlightedNote}" />
{/if}
</svelte:head>
<div class="pl-16 pt-16">
<Window title="terminal" removePadding>
<div
@ -30,11 +39,11 @@
<Token v="[" punct/>gazesystems <Token v="/log/" keywd/><Token v="]$" punct/> <Token v="ls" funct/> log <Token v="|" punct/> <Token v="each" funct/> <Token v="&#123;" punct/><Token v="|" punct/>file<Token v="|" punct/> <Token v="render" funct/> <Token v="(" punct/><Token v="open" funct/> $file.name<Token v=")" punct/><Token v="&#125;" punct/>
<br>
<br>
{#each data.notes as { noteId, note }, index}
{#each data.notes as [noteId, note], index}
<div class="text-wrap break-words max-w-[70ch] leading-none">
<Token v={renderDate(note.published)} small/> <Token v={noteId} keywd small/><Token v="#" punct/>&nbsp;&nbsp;<Token v={note.content} str/>
</div>
{#if index < data.notes.length - 1}
{#if index < data.notes.size - 1}
<div class="mt-3"/>
{/if}
{/each}