This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-01 20:22:56 +09:00
1 parent a09060fcde
commit 4dc3bdc466
4 files changed
+84 -51

No files matched your search

+4 -18
View File
@@ -1,8 +1,7 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import { onMount, getContext, createEventDispatcher } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n: any = getContext('i18n');
const dispatch = createEventDispatcher();
import {
artifactCode,
@@ -16,7 +15,6 @@
import { copyToClipboard, createMessagesList } from '$lib/utils';
import { injectCsp } from '$lib/utils/csp';
import XMark from '../icons/XMark.svelte';
import ArrowsPointingOut from '../icons/ArrowsPointingOut.svelte';
import Tooltip from '../common/Tooltip.svelte';
import SvgPanZoom from '../common/SVGPanZoom.svelte';
@@ -128,10 +126,10 @@
class=" w-full h-full relative flex flex-col bg-white dark:bg-gray-850"
id="artifacts-container"
>
<div class="w-full h-full flex flex-col flex-1 relative">
<div class="w-full min-h-0 flex flex-col flex-1 relative">
{#if contents.length > 0}
<div
class="pointer-events-auto z-20 flex justify-between items-center p-2.5 font-primar text-gray-900 dark:text-white"
class="pointer-events-auto z-20 shrink-0 flex justify-between items-center px-2.5 pb-2.5 font-primar text-gray-900 dark:text-white"
>
<div class="flex-1 flex items-center justify-between pr-1">
<div class="flex items-center space-x-2">
@@ -225,18 +223,6 @@
{/if}
</div>
</div>
<button
aria-label={$i18n.t('Close')}
class="self-center pointer-events-auto p-1 rounded-full bg-white dark:bg-gray-850"
on:click={() => {
dispatch('close');
showTabs.set(false);
showArtifacts.set(false);
}}
>
<XMark className="size-3.5 text-gray-900 dark:text-white" />
</button>
</div>
{/if}
@@ -244,7 +230,7 @@
<div class=" absolute top-0 left-0 right-0 bottom-0 z-10"></div>
{/if}
<div class="flex-1 w-full h-full">
<div class="flex-1 w-full min-h-0">
<div class=" h-full flex flex-col">
{#if contents.length > 0}
<div class="max-w-full w-full h-full">
+65 -21
View File
@@ -7,6 +7,7 @@
import { onMount, onDestroy, tick, getContext } from 'svelte';
import { beforeNavigate } from '$app/navigation';
import {
artifactContents,
config,
temporaryChatEnabled,
terminalServers,
@@ -20,7 +21,8 @@
settings,
showFileNavPath,
selectedTerminalId,
user
user,
visibleControls
} from '$lib/stores';
import { commentsRequest, resourceQuery } from '$lib/apis/comments';
@@ -145,7 +147,7 @@
...(typeof $showTabs === 'object' ? $showTabs : {})
}
: null;
$: if ($showTabs === 'comments' || typeof $showTabs === 'object') {
$: if ($showTabs === 'files' || $showTabs === 'comments' || typeof $showTabs === 'object') {
showArtifacts.set(false);
showEmbeds.set(false);
showCallOverlay.set(false);
@@ -161,11 +163,21 @@
showOverview.set(false);
});
$: sidePanelAvailable = showFilesTab || showCommentsTab || specialPanel;
$: showArtifactsTab = ($artifactContents ?? []).length > 0 && $visibleControls['chat.artifacts'];
$: sidePanelAvailable = showFilesTab || showCommentsTab || showArtifactsTab || specialPanel;
// Keep the remaining side-pane tabs available after moving Controls into the composer.
$: if (!showCommentsTab && activeTab === 'comments') activeTab = 'files';
$: if (!showFilesTab && showCommentsTab && activeTab === 'files') activeTab = 'comments';
$: if (
$showTabs &&
!$showEmbeds &&
!$showCallOverlay &&
!showFilesTab &&
!showCommentsTab &&
showArtifactsTab
)
showArtifacts.set(true);
$: if (!sidePanelAvailable) showTabs.set(false);
// Auto-switch to Files tab when display_file is triggered
@@ -340,29 +352,43 @@
</div>
{:else if $showEmbeds}
<Embeds />
{:else if $showArtifacts}
<Artifacts {history} />
{:else}
<!-- Files and Comments tabs -->
<!-- Files, Artifacts, and Comments tabs -->
<div class="flex flex-col h-full min-h-0">
<!-- Tab bar -->
<div class="flex items-center justify-between px-2 pt-2 pb-2 shrink-0">
<div class="flex gap-1 min-w-0 overflow-x-auto scrollbar-hidden">
{#if showFilesTab}
<button
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {activeTab ===
'files'
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {!$showArtifacts &&
activeTab === 'files'
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => showTabs.set('files')}
on:click={() => {
showArtifacts.set(false);
showTabs.set('files');
}}
>
{$i18n.t('Files')}
</button>
{/if}
{#if showArtifactsTab}
<button
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {$showArtifacts
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => {
showTabs.set(true);
showArtifacts.set(true);
}}
>
{$i18n.t('Artifacts')}
</button>
{/if}
{#if showCommentsTab}
<button
class="inline-flex items-center justify-center gap-1 px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {activeTab ===
'comments'
class="inline-flex items-center justify-center gap-1 px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {!$showArtifacts &&
activeTab === 'comments'
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => showTabs.set('comments')}
@@ -393,7 +419,9 @@
</div>
<div class="flex-1 min-h-0">
{#if activeTab === 'comments'}
{#if $showArtifacts}
<Artifacts {history} />
{:else if activeTab === 'comments'}
{#if currentComments}
{#key `${$user.id}:${chatId}:${currentComments.comment_id ?? ''}`}
<CommentsPanel
@@ -449,29 +477,43 @@
</div>
{:else if $showEmbeds}
<Embeds overlay={dragged} />
{:else if $showArtifacts}
<Artifacts {history} overlay={dragged} />
{:else}
<!-- Files and Comments tabs -->
<!-- Files, Artifacts, and Comments tabs -->
<div class="flex flex-col h-full min-h-0">
<!-- Tab bar -->
<div class="flex items-center justify-between px-2 pt-2 pb-2 shrink-0">
<div class="flex gap-1 min-w-0 overflow-x-auto scrollbar-hidden">
{#if showFilesTab}
<button
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {activeTab ===
'files'
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {!$showArtifacts &&
activeTab === 'files'
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => showTabs.set('files')}
on:click={() => {
showArtifacts.set(false);
showTabs.set('files');
}}
>
{$i18n.t('Files')}
</button>
{/if}
{#if showArtifactsTab}
<button
class="px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {$showArtifacts
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => {
showTabs.set(true);
showArtifacts.set(true);
}}
>
{$i18n.t('Artifacts')}
</button>
{/if}
{#if showCommentsTab}
<button
class="inline-flex items-center justify-center gap-1 px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {activeTab ===
'comments'
class="inline-flex items-center justify-center gap-1 px-2.5 py-0.5 text-sm rounded-lg transition whitespace-nowrap {!$showArtifacts &&
activeTab === 'comments'
? 'bg-gray-100/40 dark:bg-gray-800/25 font-normal text-gray-700 dark:text-gray-200'
: 'text-gray-500 dark:text-gray-400 hover:bg-gray-100/30 dark:hover:bg-gray-800/20 hover:text-gray-600 dark:hover:text-gray-300'}"
on:click={() => showTabs.set('comments')}
@@ -502,7 +544,9 @@
</div>
<div class="flex-1 min-h-0">
{#if activeTab === 'comments'}
{#if $showArtifacts}
<Artifacts {history} overlay={dragged} />
{:else if activeTab === 'comments'}
{#if currentComments}
{#key `${$user.id}:${chatId}:${currentComments.comment_id ?? ''}`}
<CommentsPanel
+2 -2
View File
@@ -2490,7 +2490,7 @@
<button
type="button"
id="input-menu-button"
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-[1.875rem] flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
class="bg-transparent hover:bg-gray-100/40 text-gray-700 dark:text-white dark:hover:bg-gray-800/40 rounded-full size-[1.875rem] flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
aria-label={$i18n.t('More')}
>
<PlusAlt className="size-5" />
@@ -2540,7 +2540,7 @@
<button
type="button"
id="integration-menu-button"
class="bg-transparent hover:bg-gray-100 text-gray-700 dark:text-white dark:hover:bg-gray-800 rounded-full size-[1.875rem] flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
class="bg-transparent hover:bg-gray-100/40 text-gray-700 dark:text-white dark:hover:bg-gray-800/40 rounded-full size-[1.875rem] flex justify-center items-center outline-hidden focus:outline-hidden shrink-0"
aria-label={$i18n.t('Integrations')}
>
<Component className="size-4.5" strokeWidth="1.5" />
+13 -10
View File
@@ -10,6 +10,7 @@
chatTitle as _chatTitle,
config,
mobile,
selectedTerminalId,
settings,
showSidebar,
showTabs,
@@ -368,16 +369,18 @@
</Menu>
{/if}
<Tooltip content={$i18n.t('Tabs')}>
<button
class="flex size-6 cursor-pointer items-center justify-center rounded-lg text-gray-500 transition hover:bg-gray-50/40 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/40 dark:hover:text-gray-200"
on:click={() => showTabs.set(!$showTabs)}
aria-label={$i18n.t('Tabs')}
aria-expanded={!!$showTabs}
>
<SplitPanel className="size-5" strokeWidth="1" />
</button>
</Tooltip>
{#if history.currentId || $selectedTerminalId}
<Tooltip content={$i18n.t('Tabs')}>
<button
class="flex size-6 cursor-pointer items-center justify-center rounded-lg text-gray-500 transition hover:bg-gray-50/40 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800/40 dark:hover:text-gray-200"
on:click={() => showTabs.set(!$showTabs)}
aria-label={$i18n.t('Tabs')}
aria-expanded={!!$showTabs}
>
<SplitPanel className="size-5" strokeWidth="1" />
</button>
</Tooltip>
{/if}
</div>
</div>
</div>