{#if loaded && items !== null && total !== null} { 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 && !pageTab}
{/if}
{$i18n.t('Show')}
{#each [[null, 'All'], ['created', 'Created by you'], ['shared', 'Shared with you']] as const as [value, label]} {/each} {#if [null, 'shared'].includes(viewOption)}
{$i18n.t('Access')}
{#each [[null, 'Write'], ['read_only', 'Read Only']] as const as [value, label]} {/each} {/if} {#if filterCount}
{/if}
{$i18n.t('Layout')}
{#each [[null, 'List', 'list'], ['grid', 'Grid', 'grid']] as const as [value, label, icon]} {/each}
{#each [['updated_at', 'Updated'], ['name', 'Title']] as const as [value, label]} {/each}
{#each [['asc', 'Ascending'], ['desc', 'Descending']] as const as [value, label]} {/each}
{#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)}
noteDragStartHandler(e, note)} class="focus-ring flex min-w-0 flex-col items-center gap-1 rounded-xl px-1 pt-2 pb-1.5 text-center transition-colors duration-75 hover:bg-base-50/60 dark:hover:bg-base-0/4" aria-label={note.title} > {note.title} {dayjs(note.updated_at / 1000000) .locale($i18n.language) .fromNow()} {#if shiftKey} {:else} accessModal.open(note.id) : null} show={openNoteMenuId === note.id} onDownload={(type) => { 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={$pinnedNotes.some((n) => n.id === note.id)} onPin={async () => { await toggleNotePinnedStatusById(localStorage.token, note.id); pinnedNotes.set( await getPinnedNoteList(localStorage.token).catch(() => []) ); init(); }} onChange={(state) => { openNoteMenuId = state ? note.id : null; }} > {/if}
{/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}