feat: chat controls ui

This commit is contained in:
Timothy J. Baek
2024-07-08 16:55:12 -07:00
parent 781ad70598
commit b8d153ebb2
8 changed files with 158 additions and 66 deletions
+19 -1
View File
@@ -21,6 +21,7 @@
import { page } from '$app/stores';
import UserMenu from './Sidebar/UserMenu.svelte';
import MenuLines from '../icons/MenuLines.svelte';
import AdjustmentsHorizontal from '../icons/AdjustmentsHorizontal.svelte';
const i18n = getContext('i18n');
@@ -32,6 +33,7 @@
export let selectedModels;
export let showModelSelector = true;
export let showControls = false;
let showShareChatModal = false;
let showDownloadChatModal = false;
@@ -58,6 +60,7 @@
</div>
</button>
</div>
<div class="flex-1 overflow-hidden max-w-full">
{#if showModelSelector}
<ModelSelector bind:selectedModels showSetDefault={!shareEnabled} />
@@ -101,12 +104,27 @@
</button>
</Menu>
{/if}
<Tooltip content={$i18n.t('Controls')}>
<button
id="new-chat-button"
class=" flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition"
on:click={() => {
showControls = !showControls;
}}
>
<div class=" m-auto self-center">
<AdjustmentsHorizontal className=" size-5" strokeWidth="0.5" />
</div>
</button>
</Tooltip>
<Tooltip content={$i18n.t('New Chat')}>
<button
id="new-chat-button"
class=" flex {$showSidebar
? 'md:hidden'
: ''} cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-100 dark:hover:bg-gray-850 transition"
: ''} cursor-pointer px-2 py-2 rounded-xl text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-850 transition"
on:click={() => {
initNewChat();
}}
+4 -41
View File
@@ -261,7 +261,7 @@
alt="logo"
/>
</div>
<div class=" self-center font-medium text-sm text-gray-850 dark:text-white">
<div class=" self-center font-medium text-sm text-gray-850 dark:text-white font-primary">
{$i18n.t('New Chat')}
</div>
<div class="self-center ml-auto">
@@ -339,7 +339,7 @@
</div>
<div class="flex self-center">
<div class=" self-center font-medium text-sm">{$i18n.t('Workspace')}</div>
<div class=" self-center font-medium text-sm font-primary">{$i18n.t('Workspace')}</div>
</div>
</a>
</div>
@@ -533,7 +533,7 @@
<div class="px-2.5">
<!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
<div class="flex flex-col">
<div class="flex flex-col font-primary">
{#if $user !== undefined}
<UserMenu
role={$user.role}
@@ -556,50 +556,13 @@
alt="User profile"
/>
</div>
<div class=" self-center font-semibold">{$user.name}</div>
<div class=" self-center font-medium">{$user.name}</div>
</button>
</UserMenu>
{/if}
</div>
</div>
</div>
<!-- <div
id="sidebar-handle"
class=" hidden md:fixed left-0 top-[50dvh] -translate-y-1/2 transition-transform translate-x-[255px] md:translate-x-[260px] rotate-0"
>
<Tooltip
placement="right"
content={`${$showSidebar ? $i18n.t('Close') : $i18n.t('Open')} ${$i18n.t('sidebar')}`}
touch={false}
>
<button
id="sidebar-toggle-button"
class=" group"
on:click={() => {
showSidebar.set(!$showSidebar);
}}
><span class="" data-state="closed"
><div
class="flex h-[72px] w-8 items-center justify-center opacity-50 group-hover:opacity-100 transition"
>
<div class="flex h-6 w-6 flex-col items-center">
<div
class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[0.15rem] {$showSidebar
? 'group-hover:rotate-[15deg]'
: 'group-hover:rotate-[-15deg]'}"
/>
<div
class="h-3 w-1 rounded-full bg-[#0f0f0f] dark:bg-white rotate-0 translate-y-[-0.15rem] {$showSidebar
? 'group-hover:rotate-[-15deg]'
: 'group-hover:rotate-[15deg]'}"
/>
</div>
</div>
</span>
</button>
</Tooltip>
</div> -->
</div>
<style>
@@ -30,7 +30,7 @@
<slot name="content">
<DropdownMenu.Content
class="w-full {className} text-sm rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow"
class="w-full {className} text-sm rounded-xl px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-850 dark:text-white shadow font-primary"
sideOffset={8}
side="bottom"
align="start"