close menu when it should
This commit is contained in:
		
							parent
							
								
									a3ae5a3926
								
							
						
					
					
						commit
						fdbb2ab76f
					
				| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<script lang="ts">
 | 
			
		||||
  import { replace } from 'svelte-spa-router'
 | 
			
		||||
  import type { Chat } from './Types.svelte'
 | 
			
		||||
  import { apiKeyStorage, deleteChat } from './Storage.svelte'
 | 
			
		||||
  import { apiKeyStorage, deleteChat, pinMainMenu } from './Storage.svelte'
 | 
			
		||||
  import Fa from 'svelte-fa/src/fa.svelte'
 | 
			
		||||
  import { faTrash, faCircleCheck } from '@fortawesome/free-solid-svg-icons/index'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
</script>
 | 
			
		||||
 | 
			
		||||
<li>
 | 
			
		||||
  <a class="chat-menu-item" href={`#/chat/${chat.id}`} class:is-waiting={waitingForConfirm} class:is-disabled={!$apiKeyStorage} class:is-active={activeChatId === chat.id}>
 | 
			
		||||
  <a class="chat-menu-item" href={`#/chat/${chat.id}`} on:click={() => { $pinMainMenu = false }} class:is-waiting={waitingForConfirm} class:is-disabled={!$apiKeyStorage} class:is-active={activeChatId === chat.id}>
 | 
			
		||||
    {#if waitingForConfirm}
 | 
			
		||||
    <a class="is-pulled-right is-hidden px-1 py-0 greyscale has-text-weight-bold delete-button" href={'$'} on:click|preventDefault={() => delChat()}><Fa icon={faCircleCheck} /></a>
 | 
			
		||||
    {:else}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@
 | 
			
		|||
    faEye,
 | 
			
		||||
    faEyeSlash
 | 
			
		||||
  } from '@fortawesome/free-solid-svg-icons/index'
 | 
			
		||||
  import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, globalStorage, setGlobalSettingValueByKey, showSetChatSettings } from './Storage.svelte'
 | 
			
		||||
  import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, globalStorage, setGlobalSettingValueByKey, showSetChatSettings, pinMainMenu } from './Storage.svelte'
 | 
			
		||||
  import { exportAsMarkdown, exportChatAsJSON } from './Export.svelte'
 | 
			
		||||
  import { applyProfile } from './Profiles.svelte'
 | 
			
		||||
  import { replace } from 'svelte-spa-router'
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +60,7 @@
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  const close = () => {
 | 
			
		||||
    $pinMainMenu = false
 | 
			
		||||
    showChatMenu = false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +92,7 @@
 | 
			
		|||
        <span class="menu-icon"><Fa icon={faGear}/></span> Chat Profile Settings
 | 
			
		||||
      </a>
 | 
			
		||||
      <hr class="dropdown-divider">
 | 
			
		||||
      <a href={'#/chat/new'} class="dropdown-item">
 | 
			
		||||
      <a href={'#/chat/new'} on:click={() => close()} 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) }}>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue