Skip to content

Commit

Permalink
Fix hotkeys for tasks page (#1034)
Browse files Browse the repository at this point in the history
- fix hotkeys for tasks
  • Loading branch information
brendanlaschke authored Aug 2, 2023
1 parent 991cadb commit 0ad3554
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions front/src/AppNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function AppNavbar() {
<NavItem
label="Tasks"
to="/tasks"
active={currentPath === '/tasks'}
icon={<IconCheckbox size={theme.icon.size.md} />}
/>
<NavTitle label="Workspace" />
Expand Down
12 changes: 9 additions & 3 deletions front/src/modules/command-menu/components/CommandMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export function CommandMenu() {
label: 'Go to Settings',
shortcuts: ['G', 'S'],
},
{
to: '/tasks',
label: 'Go to Tasks',
shortcuts: ['G', 'T'],
},
];

const matchingCommand = commands.find(
Expand Down Expand Up @@ -162,7 +167,6 @@ export function CommandMenu() {
{matchingCommand && (
<StyledGroup heading="Navigate">
<CommandMenuItem
key={matchingCommand.shortcuts?.join('')}
to={matchingCommand.to}
label={matchingCommand.label}
shortcuts={matchingCommand.shortcuts}
Expand Down Expand Up @@ -222,8 +226,10 @@ export function CommandMenu() {
{!matchingCommand && (
<StyledGroup heading="Navigate">
{commands
.filter((cmd) =>
cmd.shortcuts?.join('').includes(search?.toUpperCase()),
.filter(
(cmd) =>
cmd.shortcuts?.join('').includes(search?.toUpperCase()) ||
cmd.label?.toUpperCase().includes(search?.toUpperCase()),
)
.map((cmd) => (
<CommandMenuItem
Expand Down
1 change: 1 addition & 0 deletions front/src/modules/types/PageHotkeyScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export enum PageHotkeyScope {
OpportunitiesPage = 'opportunities-page',
ProfilePage = 'profile-page',
WorkspaceMemberPage = 'workspace-member-page',
TaskPage = 'task-page',
}
5 changes: 5 additions & 0 deletions front/src/sync-hooks/AuthAutoRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ export function AuthAutoRouter() {
setHotkeyScope(PageHotkeyScope.OpportunitiesPage, { goto: true });
break;
}
case isMatchingLocation(AppPath.TasksPage): {
setHotkeyScope(PageHotkeyScope.TaskPage, { goto: true });
break;
}

case isMatchingLocation(AppPath.SignIn): {
setHotkeyScope(PageHotkeyScope.SignInUp);
break;
Expand Down
1 change: 1 addition & 0 deletions front/src/sync-hooks/GotoHotkeysHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function GotoHotkeysHooks() {
useGoToHotkeys('c', '/companies');
useGoToHotkeys('o', '/opportunities');
useGoToHotkeys('s', '/settings/profile');
useGoToHotkeys('t', '/tasks');

return <></>;
}

0 comments on commit 0ad3554

Please sign in to comment.