{$i18n.t('Notes')} / {$WEBUI_NAME}
{#if loaded} { if (!importDocumentFiles || importDocumentFiles.length === 0) return; try { await inputFilesHandler(Array.from(importDocumentFiles)); toast.success($i18n.t('Imported notes successfully')); } catch (error) { toast.error(`${error}`); } finally { importDocumentFiles = null; notesImportInputElement.value = ''; } }} /> { deleteNoteHandler(selectedNote.id); showDeleteConfirm = false; }} >
{$i18n.t('This will delete')} {selectedNote.title}.
{#if $mobile}
{/if}
{$i18n.t('Notes')} {total === null ? '' : formatNumber(total)}
{ const res = await createNoteHandler(dayjs().format('YYYY-MM-DD')); if (res) { goto(`/notes/${res.id}`); } } }, { id: 'notes-import', label: $i18n.t('Import txt/md'), onClick: () => notesImportInputElement?.click() } ]} />
{#if query}
{/if}
{ if (e.deltaY !== 0) { e.preventDefault(); e.currentTarget.scrollLeft += e.deltaY; } }} >
{ if (value) { localStorage.noteViewOption = value; } else { delete localStorage.noteViewOption; } }} /> {#if [null, 'shared'].includes(viewOption)} {/if} { if (displayOption) { localStorage.noteDisplayOption = displayOption; } else { delete localStorage.noteDisplayOption; } }} />
{#if items !== null && total !== null} {#if (items ?? []).length > 0} {@const groupedNotes = groupNotes(items)}
{#if displayOption === null}
{/if} {#each groupedNotes as [timeRange, notesList], idx}
{$i18n.t(timeRange)}
{#if displayOption === null}
{#each notesList as note, idx (note.id)}
{/each}
{:else if displayOption === 'grid'}
{#each notesList as note, idx (note.id)}
{note.title}
{ selectedNote = note; downloadHandler(type); }} onCopyLink={async () => { const baseUrl = window.location.origin; const res = await copyToClipboard(`${baseUrl}/notes/${note.id}`); if (res) { toast.success($i18n.t('Copied link to clipboard')); } else { toast.error($i18n.t('Failed to copy link')); } }} onDelete={() => { selectedNote = note; showDeleteConfirm = true; }} isPinned={note.is_pinned ?? false} onPin={async () => { await toggleNotePinnedStatusById(localStorage.token, note.id); pinnedNotes.set( await getPinnedNoteList(localStorage.token).catch(() => []) ); init(); }} >
{#if note.data?.content?.md} {note.data?.content?.md} {:else} {$i18n.t('No content')} {/if}
{capitalizeFirstLetter( note?.user?.name ?? note?.user?.email ?? $i18n.t('Deleted User') )}
{dayjs(note.updated_at / 1000000).fromNow()}
{/each}
{/if} {/each} {#if !allItemsLoaded} { if (!itemsLoading) { loadMoreItems(); } }} >
{$i18n.t('Loading...')}
{/if}
{:else}
{$i18n.t('No Notes')}
{$i18n.t('Create your first note from the Create menu.')}
{/if} {:else}
{/if}
{:else}
{/if}