feat: integrate global keyboard shortcuts across multiple components
- Added `KeyboardShortcutsProvider` to `RootLayout` for centralized keyboard shortcut management. - Implemented `useGlobalKeyboardShortcuts` in `DailyPageClient`, `KanbanPageClient`, and `HomePageClient` to enhance navigation and task management with keyboard shortcuts. - Updated `KeyboardShortcuts` component to render a modal for displaying available shortcuts, improving user accessibility. - Enhanced `Header` component with buttons to open the keyboard shortcuts modal, streamlining user interaction.
This commit is contained in:
@@ -10,6 +10,7 @@ import { RecentTasks } from '@/components/dashboard/RecentTasks';
|
||||
import { ProductivityAnalytics } from '@/components/dashboard/ProductivityAnalytics';
|
||||
import { ProductivityMetrics } from '@/services/analytics/analytics';
|
||||
import { DeadlineMetrics } from '@/services/analytics/deadline-analytics';
|
||||
import { useGlobalKeyboardShortcuts } from '@/hooks/useGlobalKeyboardShortcuts';
|
||||
|
||||
interface HomePageClientProps {
|
||||
initialTasks: Task[];
|
||||
@@ -31,6 +32,20 @@ function HomePageContent({ productivityMetrics, deadlineMetrics }: {
|
||||
await createTask(data);
|
||||
};
|
||||
|
||||
// Raccourcis clavier globaux pour la page Dashboard
|
||||
useGlobalKeyboardShortcuts({
|
||||
onOpenSearch: () => {
|
||||
// Focus sur le champ de recherche s'il existe, sinon naviguer vers Kanban
|
||||
const searchInput = document.querySelector('input[placeholder*="Rechercher"]') as HTMLInputElement;
|
||||
if (searchInput) {
|
||||
searchInput.focus();
|
||||
} else {
|
||||
// Naviguer vers Kanban où il y a une recherche
|
||||
window.location.href = '/kanban';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[var(--background)]">
|
||||
<Header
|
||||
|
||||
Reference in New Issue
Block a user