new chat shortcut
This commit is contained in:
parent
e4bb379d77
commit
f80d8f6ef7
2 changed files with 31 additions and 6 deletions
|
|
@ -5,6 +5,8 @@
|
|||
import { PUBLIC_CONVEX_URL } from '$env/static/public';
|
||||
import { models } from '$lib/state/models.svelte';
|
||||
import GlobalModal from '$lib/components/ui/modal/global-modal.svelte';
|
||||
import { shortcut } from '$lib/actions/shortcut.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
|
|
@ -12,6 +14,10 @@
|
|||
models.init();
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
use:shortcut={{ ctrl: true, shift: true, key: 'o', callback: () => goto('/chat') }}
|
||||
/>
|
||||
|
||||
<ModeWatcher />
|
||||
{@render children()}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,22 @@
|
|||
},
|
||||
];
|
||||
|
||||
type Shortcut = {
|
||||
name: string;
|
||||
keys: string[];
|
||||
};
|
||||
|
||||
const shortcuts: Shortcut[] = [
|
||||
{
|
||||
name: 'Toggle Sidebar',
|
||||
keys: [cmdOrCtrl, 'B'],
|
||||
},
|
||||
{
|
||||
name: 'New Chat',
|
||||
keys: [cmdOrCtrl, 'Shift', 'O'],
|
||||
},
|
||||
];
|
||||
|
||||
async function signOut() {
|
||||
await authClient.signOut();
|
||||
|
||||
|
|
@ -69,14 +85,17 @@
|
|||
<div class="mt-4 flex w-full flex-col gap-2">
|
||||
<span class="text-sm font-medium">Keyboard Shortcuts</span>
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex place-items-center justify-between">
|
||||
<span class="text-muted-foreground text-sm">Toggle Sidebar </span>
|
||||
{#each shortcuts as { name, keys } (name)}
|
||||
<div class="flex place-items-center justify-between">
|
||||
<span class="text-muted-foreground text-sm">{name}</span>
|
||||
|
||||
<div>
|
||||
<Kbd>{cmdOrCtrl}</Kbd>
|
||||
<Kbd>B</Kbd>
|
||||
<div class="flex place-items-center gap-1">
|
||||
{#each keys as key (key)}
|
||||
<Kbd>{key}</Kbd>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue