{$t('sidebar.workspaces')}
{#each $workspaceList as ws (ws.path)} {@const isExpanded = expandedWorkspaces.has(ws.path)} {@const chats = wsChatsCache.get(ws.path)} {@const isLoading = wsChatsLoading.has(ws.path)}
openWorkspace(e, ws.path)} > {#if $chatEnabled} { e.stopPropagation(); e.preventDefault(); toggleWorkspaceExpand(ws.path); }} aria-label={isExpanded ? $t('sidebar.collapse') : $t('sidebar.addWorkspace')} > {:else} {/if} {ws.name} openWsMenu(e, ws.path)} aria-label={$t('sidebar.workspaceOptions')} > {#if $chatEnabled} newChat(ws.path)} aria-label={$t('bar.newChat')} use:tooltip={$t('bar.newChat')} > {/if}
{#if $chatEnabled && isExpanded}
{#if isLoading && !chats}
{:else if chats && chats.length > 0} {#each chats as chat (chat.id)} openChat(chat.id, ws.path)} onmenu={(e) => openChatMenu(e, chat.id, ws.path)} /> {/each} {/if}
{/if}
{/each} {#if $workspaceList.length === 0}

{$t('sidebar.noWorkspaces')}

{/if}
{#if wsMenuPath && wsMenuAnchor} handleRemoveWorkspace(wsMenuPath!) } ]} onclose={closeWsMenu} /> {/if} {#if chatMenu} {/if}