Improve fallback when no home found, add keyboard navigation

This commit is contained in:
Jackson Harper
2024-07-10 18:59:23 +08:00
parent a536b21c64
commit 486f0f2870
11 changed files with 674 additions and 461 deletions

View File

@ -52,7 +52,7 @@ export function NavigationLayout(props: NavigationLayoutProps): JSX.Element {
const [showKeyboardCommandsModal, setShowKeyboardCommandsModal] =
useState(false)
useKeyboardShortcuts(navigationCommands(router))
useRegisterActions(navigationCommands(router))
useKeyboardShortcuts(
primaryCommands((action) => {
@ -64,38 +64,6 @@ export function NavigationLayout(props: NavigationLayoutProps): JSX.Element {
})
)
useRegisterActions(
[
{
id: 'home',
section: 'Navigation',
name: 'Go to Home (Library) ',
shortcut: ['g h'],
keywords: 'go home',
perform: () => router?.push('/home'),
},
{
id: 'lightTheme',
section: 'Preferences',
name: 'Change theme (light) ',
shortcut: ['v', 'l'],
keywords: 'light theme',
priority: Priority.LOW,
perform: () => updateTheme(ThemeId.Light),
},
{
id: 'darkTheme',
section: 'Preferences',
name: 'Change theme (dark) ',
shortcut: ['v', 'd'],
keywords: 'dark theme',
priority: Priority.LOW,
perform: () => updateTheme(ThemeId.Dark),
},
],
[router]
)
// Attempt to identify the user if they are logged in.
useEffect(() => {
setupAnalytics(viewerData?.me)