From 5dcfa19b0c2507a6a61c0975c2c75dd8053e8e13 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Fri, 10 Oct 2025 15:48:01 +0200 Subject: [PATCH] feat(HeaderNavigation): update navigation to use user preferences for Jira configuration - Replaced Jira configuration context with user preferences context to determine Jira setup. - Enhanced navigation links to reflect user-specific Jira project key. - Fixed CSS class syntax for hover effects and adjusted link display logic for larger screens. --- src/components/ui/header/HeaderNavigation.tsx | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/ui/header/HeaderNavigation.tsx b/src/components/ui/header/HeaderNavigation.tsx index 78e6c1d..bf81a55 100644 --- a/src/components/ui/header/HeaderNavigation.tsx +++ b/src/components/ui/header/HeaderNavigation.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; import { usePathname } from 'next/navigation'; -import { useJiraConfig } from '@/contexts/JiraConfigContext'; +import { useUserPreferences } from '@/contexts/UserPreferencesContext'; interface HeaderNavigationProps { variant: 'desktop' | 'mobile'; @@ -15,10 +15,18 @@ export function HeaderNavigation({ className = '', onLinkClick, }: HeaderNavigationProps) { - const { isConfigured: isJiraConfigured, config: jiraConfig } = - useJiraConfig(); + const { preferences } = useUserPreferences(); const pathname = usePathname(); + // Vérifier si Jira est configuré depuis les préférences utilisateur + const isJiraConfigured = Boolean( + preferences.jiraConfig?.enabled && + preferences.jiraConfig?.baseUrl && + preferences.jiraConfig?.email && + preferences.jiraConfig?.apiToken && + preferences.jiraConfig?.projectKey + ); + // Liste des liens de navigation const navLinks = [ { href: '/', label: 'Dashboard' }, @@ -30,7 +38,7 @@ export function HeaderNavigation({ ? [ { href: '/jira-dashboard', - label: `Jira${jiraConfig?.projectKey ? ` (${jiraConfig.projectKey})` : ''}`, + label: `Jira${preferences.jiraConfig?.projectKey ? ` (${preferences.jiraConfig.projectKey})` : ''}`, }, ] : []), @@ -66,7 +74,7 @@ export function HeaderNavigation({ return `${baseClasses} text-[var(--primary)] bg-[var(--primary)]/10 border border-[var(--primary)]/30`; } - return `${baseClasses} text-[var(--muted-foreground)] hover:text-[var(--primary)] hover:bg-[var(--card-hover"]`; + return `${baseClasses} text-[var(--muted-foreground)] hover:text-[var(--primary)] hover:bg-[var(--card-hover)]`; }; if (variant === 'mobile') { @@ -89,7 +97,7 @@ export function HeaderNavigation({ // Desktop version return (