feat: share from chat menu

This commit is contained in:
Timothy J. Baek 2024-04-20 14:40:06 -05:00
parent 7eb14437ff
commit 2a10438b4d
6 changed files with 45 additions and 10 deletions

View file

@ -25,7 +25,7 @@
let showDownloadChatModal = false;
</script>
<ShareChatModal bind:show={showShareChatModal} />
<ShareChatModal bind:show={showShareChatModal} chatId={$chatId} />
<nav id="nav" class=" sticky py-2.5 top-0 flex flex-row justify-center z-30">
<div
class=" flex {$settings?.fullScreenMode ?? null ? 'max-w-full' : 'max-w-3xl'}

View file

@ -24,6 +24,7 @@
import { WEBUI_BASE_URL } from '$lib/constants';
import Tooltip from '../common/Tooltip.svelte';
import ChatMenu from './Sidebar/ChatMenu.svelte';
import ShareChatModal from '../chat/ShareChatModal.svelte';
let show = false;
let navElement;
@ -31,12 +32,15 @@
let title: string = 'UI';
let search = '';
let shareChatId = null;
let selectedChatId = null;
let chatDeleteId = null;
let chatTitleEditId = null;
let chatTitle = '';
let showShareChatModal = false;
let showDropdown = false;
let isEditing = false;
@ -136,6 +140,8 @@
};
</script>
<ShareChatModal bind:show={showShareChatModal} chatId={shareChatId} />
<div
bind:this={navElement}
class="h-screen max-h-[100dvh] min-h-screen {show
@ -547,6 +553,10 @@
<div class="flex self-center space-x-1.5 z-10">
<ChatMenu
chatId={chat.id}
shareHandler={() => {
shareChatId = selectedChatId;
showShareChatModal = true;
}}
renameHandler={() => {
chatTitle = chat.title;
chatTitleEditId = chat.id;

View file

@ -7,7 +7,9 @@
import Pencil from '$lib/components/icons/Pencil.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Tags from '$lib/components/chat/Tags.svelte';
import Share from '$lib/components/icons/Share.svelte';
export let shareHandler: Function;
export let renameHandler: Function;
export let deleteHandler: Function;
export let onClose: Function;
@ -31,12 +33,22 @@
<div slot="content">
<DropdownMenu.Content
class="w-full max-w-[150px] rounded-lg px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-900 dark:text-white shadow"
class="w-full max-w-[180px] rounded-lg px-1 py-1.5 border border-gray-300/30 dark:border-gray-700/50 z-50 bg-white dark:bg-gray-900 dark:text-white shadow"
sideOffset={-2}
side="bottom"
align="start"
transition={flyAndScale}
>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer dark:hover:bg-gray-850 rounded-md"
on:click={() => {
shareHandler();
}}
>
<Share />
<div class="flex items-center">Share</div>
</DropdownMenu.Item>
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer dark:hover:bg-gray-850 rounded-md"
on:click={() => {