Add unsaved profile warning on new chat.

This commit is contained in:
Webifi
2023-06-08 15:25:16 -05:00
parent 567845be06
commit 5e86b302fc
3 changed files with 26 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
import { clickOutside } from 'svelte-use-click-outside'
import { openModal } from 'svelte-modals'
import PromptConfirm from './PromptConfirm.svelte'
import { startNewChatWithWarning } from './Util.svelte'
export let chatId
export const show = (showHide:boolean = true) => {
@@ -120,7 +121,7 @@
<span class="menu-icon"><Fa icon={faGear}/></span> Chat Profile Settings
</a>
<hr class="dropdown-divider">
<a href={$apiKeyStorage ? '#/chat/new' : '#/'} class:is-disabled={!$apiKeyStorage} on:click={() => close()} class="dropdown-item">
<a href={'#'} class:is-disabled={!$apiKeyStorage} on:click|preventDefault={() => { $apiKeyStorage && close(); $apiKeyStorage && startNewChatWithWarning(chatId) }} class="dropdown-item">
<span class="menu-icon"><Fa icon={faSquarePlus}/></span> New Chat
</a>
<a href={'#'} class="dropdown-item" class:is-disabled={!chatId} on:click|preventDefault={() => { if (chatId) close(); copyChat(chatId) }}>