mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-24 10:02:26 +03:00
🔨 Refactor shortcuts in project layout page
- Add shortcuts to project pages - Add date-fns import for date formatting [src/routes/projects/[projectId]/+layout.svelte] - Add `format` import from `date-fns` - Add `Shift+p` shortcut to go to project page - Add `Meta+Shift+p` shortcut to go to project settings page - Add `Shift+r` shortcut to go to project player page - Add `a i p` shortcut to go to AI playground page
This commit is contained in:
parent
1ff5d46e7b
commit
7111ac0a3b
@ -8,6 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import tinykeys from 'tinykeys';
|
||||
import { derived } from 'svelte/store';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export let data: LayoutData;
|
||||
const { project } = data;
|
||||
@ -40,6 +41,21 @@
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;
|
||||
$project && goto(`/projects/${$project.id}/terminal/`);
|
||||
},
|
||||
'Shift+p': (event: KeyboardEvent) => {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;
|
||||
$project && goto(`/projects/${$project.id}/`);
|
||||
},
|
||||
'Meta+Shift+p': (event: KeyboardEvent) => {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;
|
||||
$project && goto(`/projects/${$project.id}/settings/`);
|
||||
},
|
||||
'Shift+r': (event: KeyboardEvent) => {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;
|
||||
$project && goto(`/projects/${$project.id}/player/${format(new Date(), 'yyyy-MM-dd')}`);
|
||||
},
|
||||
'a i p': () => $project && goto(`/projects/${$project.id}/aiplayground/`)
|
||||
})
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user