feat: structure 2

This commit is contained in:
2026-04-07 00:15:00 +02:00
parent 46a0d7aba8
commit 6d1b227fb9
15 changed files with 7433 additions and 94 deletions

View File

@@ -0,0 +1,55 @@
import { useHotkeys } from 'react-hotkeys-hook'
interface KeyboardShortcutsProps {
onToggleLeftSidebar: () => void
onToggleRightSidebar: () => void
}
export function useKeyboardShortcuts(props: KeyboardShortcutsProps) {
const { onToggleLeftSidebar, onToggleRightSidebar } = props
// Toggle sidebars
useHotkeys('tab', (e) => {
e.preventDefault()
onToggleLeftSidebar()
})
useHotkeys('i', (e) => {
e.preventDefault()
onToggleRightSidebar()
})
// Navigation shortcuts
useHotkeys('g', () => {
// Go to grid view
console.log('Grid view')
})
useHotkeys('e', () => {
// Go to loupe view
console.log('Loupe view')
})
// Rating shortcuts
useHotkeys('1,2,3,4,5', (_e, handler) => {
const rating = parseInt(handler.keys![0])
console.log('Set rating:', rating)
})
useHotkeys('0', () => {
console.log('Remove rating')
})
// Flag shortcuts
useHotkeys('p', () => {
console.log('Pick photo')
})
useHotkeys('x', () => {
console.log('Reject photo')
})
useHotkeys('u', () => {
console.log('Unflag photo')
})
}