{ deleteHandler(); }} >
{$i18n.t(`Are you sure you want to delete "{{NAME}}"?`, { NAME: folders[folderId].name })}
{$i18n.t('Delete all contents inside this folder')}
{#if dragged && x && y}
{folders[folderId].name}
{/if}
{#if draggedOver && dropPosition === 'inside'}
{:else if draggedOver}
{/if} { dispatch('open', state); }} >
{#if edit} { // Opening the folder focuses its composer while a rename is in progress. // A composer the user pressed is active; one focused by the page is not. const input = e.currentTarget; const composer = e.relatedTarget?.closest('[data-composer-id]'); if (composer && !composer.matches(':active')) { setTimeout(() => input.focus()); return; } updateHandler({ name }); edit = false; }} on:click={(e) => { // Prevent accidental collapse toggling when clicking inside input e.stopPropagation(); }} on:mousedown={(e) => { // Prevent accidental collapse toggling when clicking inside input e.stopPropagation(); }} on:keydown={(e) => { if (e.key === 'Enter') { e.currentTarget.blur(); } }} class="w-full h-full pr-6 bg-transparent outline-hidden" /> {:else} { if (!isWritable || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return; renameHandler(); }} onclick={(e) => { openPreview = false; e.stopPropagation(); if (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return; e.preventDefault(); // A double click's second click only renames. if (e.detail < 2) openFolderHandler(); }} onkeydown={(e) => { if (e.currentTarget !== e.target) return; if (e.key === ' ' && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey) { e.preventDefault(); openFolderHandler(); } }} >
{folders[folderId].name}
{#if folders[folderId]?.machine_id}
{($machines ?? []).find(({ id }) => id === folders[folderId].machine_id) ?.name || $i18n.t('Machine')}
{/if} {#if isSharedRoot(folderId)} {/if} {#if !folders[folderId]?.shared && (folders[folderId]?.unread_count ?? 0) > 0}
{formatUnreadCount(folders[folderId].unread_count)}
{/if}
{#if openPreview} { openPreview = false; showFolderModal = true; }} /> {/if}
{/if}
{#if isWritable} {/if}
{#if (folders[folderId]?.childrenIds ?? []).length > 0 || chats !== null || hasMoreChats || chatsLoading}
{#if folders[folderId]?.childrenIds} {@const children = sortFolders( folders[folderId].childrenIds.map((id) => folders[id]), $settings?.folderOrder?.[folderId], $settings?.folderSort )} {#if children.length > 0}
{#each children as childFolder (`${folderId}-${childFolder.id}`)} { dispatch('import', e.detail); }} on:update={(e) => { dispatch('update', e.detail); }} on:change={(e) => { dispatch('change', e.detail); }} /> {/each}
{/if} {/if} {#if chats === null && chatsLoading}
{/if} {#if chats !== null && chats.length === 0 && !chatsLoading}
{$i18n.t('No chats')}
{/if} {#if (chats ?? []).length > 0}
{#each chats ?? [] as chat (chat.id)}
{ dispatch('change', e.detail); }} />
{/each}
{/if} {#if hasMoreChats} {/if}
{/if}