{#if dragged && x && y}
{folders[folderId].name}
{/if}
{#if draggedOver}
{/if}
{ dispatch('open', state); }} >
{ renameHandler(); }} on:click={async (e) => { await goto('/'); selectedFolder.set(folders[folderId]); }} >
{#if open}
{:else}
{/if}
{#if edit}
{ e.target.select(); }} on:blur={() => { 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') { updateHandler({ name }); edit = false; } }} class="w-full h-full bg-transparent text-gray-500 dark:text-gray-500 outline-hidden" /> {:else} {folders[folderId].name} {/if}
{ e.stopPropagation(); }} on:click={(e) => e.stopPropagation()} >
{ showEditFolderModal = true; }} onDelete={() => { showDeleteConfirm = true; }} onExport={() => { exportHandler(); }} >
{}}>
{#if (folders[folderId]?.childrenIds ?? []).length > 0 || (folders[folderId].items?.chats ?? []).length > 0}
{#if folders[folderId]?.childrenIds} {@const children = folders[folderId]?.childrenIds .map((id) => folders[id]) .sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }) )} {#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 folders[folderId].items?.chats} {#each folders[folderId].items.chats as chat (chat.id)}
{ dispatch('change', e.detail); }} /> {/each} {/if}
{/if}