refac/fix: shortcut modal

This commit is contained in:
Timothy Jaeryang Baek 2025-07-18 12:47:22 +04:00
parent 43e11aa807
commit 3e67ce6e8e
3 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@
import { getUsage } from '$lib/apis';
import { userSignOut } from '$lib/apis/auths';
import { showSettings, mobile, showSidebar, user } from '$lib/stores';
import { showSettings, mobile, showSidebar, showShortcuts, user } from '$lib/stores';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
@ -29,8 +29,6 @@
export let help = false;
export let className = 'max-w-[240px]';
let showShortcuts = false;
const dispatch = createEventDispatcher();
let usage = null;
@ -51,7 +49,7 @@
}
</script>
<ShortcutsModal bind:show={showShortcuts} />
<ShortcutsModal bind:show={$showShortcuts} />
<!-- svelte-ignore a11y-no-static-element-interactions -->
<DropdownMenu.Root
@ -173,7 +171,7 @@
class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition"
id="chat-share-button"
on:click={() => {
showShortcuts = !showShortcuts;
showShortcuts.set(!$showShortcuts);
show = false;
}}
>

View file

@ -69,6 +69,7 @@ export const settings: Writable<Settings> = writable({});
export const showSidebar = writable(false);
export const showSearch = writable(false);
export const showSettings = writable(false);
export const showShortcuts = writable(false);
export const showArchivedChats = writable(false);
export const showChangelog = writable(false);

View file

@ -34,6 +34,7 @@
tags,
banners,
showSettings,
showShortcuts,
showChangelog,
temporaryChatEnabled,
toolServers,
@ -185,8 +186,8 @@
// Check if Ctrl + / is pressed
if (isCtrlPressed && event.key === '/') {
event.preventDefault();
console.log('showShortcuts');
document.getElementById('show-shortcuts-button')?.click();
showShortcuts.set(!$showShortcuts);
}
// Check if Ctrl + Shift + ' is pressed