feat: toggle settings shortcut added

This commit is contained in:
Timothy J. Baek 2023-12-29 23:35:08 -08:00
parent b916f1b07d
commit 7ffc1902a9
3 changed files with 28 additions and 3 deletions

View file

@ -6,7 +6,7 @@
export let disabled = false; export let disabled = false;
const saveDefaultModel = () => { const saveDefaultModel = () => {
const hasEmptyModel = selectedModels.filter(it => it === ''); const hasEmptyModel = selectedModels.filter((it) => it === '');
if (hasEmptyModel.length) { if (hasEmptyModel.length) {
toast.error('Choose a model before saving...'); toast.error('Choose a model before saving...');
return; return;
@ -88,8 +88,9 @@
{#if selectedModelIdx === 0} {#if selectedModelIdx === 0}
<button <button
class=" self-center dark:hover:text-gray-300" class=" self-center dark:hover:text-gray-300"
id="open-settings-button"
on:click={async () => { on:click={async () => {
await showSettings.set(true); await showSettings.set(!$showSettings);
}} }}
> >
<svg <svg

View file

@ -123,6 +123,23 @@
</div> </div>
<div class="flex flex-col space-y-3 w-full self-start"> <div class="flex flex-col space-y-3 w-full self-start">
<div class="w-full flex justify-between items-center">
<div class=" text-sm">Toggle settings</div>
<div class="flex space-x-1 text-xs">
<div
class=" h-fit py-1 px-2 flex items-center justify-center rounded border border-black/10 capitalize text-gray-600 dark:border-white/10 dark:text-gray-300"
>
Ctrl/⌘
</div>
<div
class=" h-fit py-1 px-2 flex items-center justify-center rounded border border-black/10 capitalize text-gray-600 dark:border-white/10 dark:text-gray-300"
>
S
</div>
</div>
</div>
<div class="w-full flex justify-between items-center"> <div class="w-full flex justify-between items-center">
<div class=" text-sm">Toggle sidebar</div> <div class=" text-sm">Toggle sidebar</div>

View file

@ -160,6 +160,13 @@
document.getElementById('delete-chat-button')?.click(); document.getElementById('delete-chat-button')?.click();
} }
// Check if Ctrl + S is pressed
if (isCtrlPressed && event.key.toLowerCase() === 's') {
event.preventDefault();
console.log('openSettings');
document.getElementById('open-settings-button')?.click();
}
// Check if Ctrl + / is pressed // Check if Ctrl + / is pressed
if (isCtrlPressed && event.key === '/') { if (isCtrlPressed && event.key === '/') {
event.preventDefault(); event.preventDefault();