From c14a2c2e793d6be8850cf914cbd9c05b7b3900b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 21:42:49 +0100 Subject: [PATCH 1/5] refactor(navbar): move the navigation types into navbar-v2 The v2 navbar, the v2 footer and the menu hooks import NavItem and DropdownItem from the v1 navbar folder, which is about to be deleted. The types file now lives in app/components/navbar-v2/types.ts and every import points there. --- app/components/design-system/navbar-footer-section.tsx | 2 +- app/components/footer-v2/footer-v2.tsx | 2 +- app/components/navbar-v2/challenges-panel.tsx | 2 +- app/components/navbar-v2/method-panel.tsx | 2 +- app/components/navbar-v2/mobile-menu.tsx | 2 +- app/components/navbar-v2/nav-panel-content.tsx | 2 +- app/components/navbar-v2/nav-panel-item.tsx | 2 +- app/components/navbar-v2/nav-styles.ts | 2 +- app/components/navbar-v2/navbar-bar.test.tsx | 2 +- app/components/navbar-v2/navbar-bar.tsx | 2 +- app/components/navbar-v2/navbar.tsx | 2 +- app/components/{navbar => navbar-v2}/types.ts | 0 app/components/navbar/mobile-menu.tsx | 2 +- app/components/navbar/nav-dropdown-item.tsx | 2 +- app/components/navbar/nav-item-with-dropdown.tsx | 2 +- app/components/navbar/styles.ts | 2 +- app/components/navbar/use-navbar-scroll.ts | 5 ++++- app/hooks/use-challenge-menu-item.ts | 2 +- app/hooks/useMenuItems.test.tsx | 2 +- app/hooks/useMenuItems.ts | 2 +- 20 files changed, 22 insertions(+), 19 deletions(-) rename app/components/{navbar => navbar-v2}/types.ts (100%) diff --git a/app/components/design-system/navbar-footer-section.tsx b/app/components/design-system/navbar-footer-section.tsx index cea7697a..dbb9ec22 100644 --- a/app/components/design-system/navbar-footer-section.tsx +++ b/app/components/design-system/navbar-footer-section.tsx @@ -5,7 +5,7 @@ import { css } from '@ocobo/styled-system/css'; import { challengePalette } from '~/components/challenges/challenge-palette'; import { FooterV2 } from '~/components/footer-v2/footer-v2'; import { NavbarBar } from '~/components/navbar-v2/navbar-bar'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { placeChallengeItem, useMenuItems } from '~/hooks/useMenuItems'; import { ShowcaseSection } from './showcase-section'; diff --git a/app/components/footer-v2/footer-v2.tsx b/app/components/footer-v2/footer-v2.tsx index 5cf7477c..a78c6855 100644 --- a/app/components/footer-v2/footer-v2.tsx +++ b/app/components/footer-v2/footer-v2.tsx @@ -7,7 +7,7 @@ import { center } from '@ocobo/styled-system/patterns'; import { text } from '@ocobo/styled-system/recipes'; import { LanguageLinks } from '~/components/navbar-v2/language-links'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { Container } from '~/components/ui/Container'; import { Logocobo } from '~/components/ui/Logocobo'; import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; diff --git a/app/components/navbar-v2/challenges-panel.tsx b/app/components/navbar-v2/challenges-panel.tsx index 27b1c281..111b09e9 100644 --- a/app/components/navbar-v2/challenges-panel.tsx +++ b/app/components/navbar-v2/challenges-panel.tsx @@ -9,7 +9,7 @@ import { center } from '@ocobo/styled-system/patterns'; import { text } from '@ocobo/styled-system/recipes'; import { challengePalette } from '~/components/challenges/challenge-palette'; -import type { DropdownItem } from '~/components/navbar/types'; +import type { DropdownItem } from '~/components/navbar-v2/types'; import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; import { url } from '~/utils/url'; diff --git a/app/components/navbar-v2/method-panel.tsx b/app/components/navbar-v2/method-panel.tsx index f6c8ca1b..1bb0e871 100644 --- a/app/components/navbar-v2/method-panel.tsx +++ b/app/components/navbar-v2/method-panel.tsx @@ -6,7 +6,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { center } from '@ocobo/styled-system/patterns'; import { text } from '@ocobo/styled-system/recipes'; -import type { DropdownItem } from '~/components/navbar/types'; +import type { DropdownItem } from '~/components/navbar-v2/types'; import { focusRing, panelItemTint } from './nav-styles'; import { PanelFooter, panelLabelStyles } from './panel-parts'; diff --git a/app/components/navbar-v2/mobile-menu.tsx b/app/components/navbar-v2/mobile-menu.tsx index cf901054..d03103ea 100644 --- a/app/components/navbar-v2/mobile-menu.tsx +++ b/app/components/navbar-v2/mobile-menu.tsx @@ -10,7 +10,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { center } from '@ocobo/styled-system/patterns'; import { text } from '@ocobo/styled-system/recipes'; -import type { DropdownItem, NavItem } from '~/components/navbar/types'; +import type { DropdownItem, NavItem } from '~/components/navbar-v2/types'; import { ButtonLink } from '~/components/ui/button-link'; import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; diff --git a/app/components/navbar-v2/nav-panel-content.tsx b/app/components/navbar-v2/nav-panel-content.tsx index 5c028adb..66a510ae 100644 --- a/app/components/navbar-v2/nav-panel-content.tsx +++ b/app/components/navbar-v2/nav-panel-content.tsx @@ -1,6 +1,6 @@ import { css } from '@ocobo/styled-system/css'; -import type { DropdownItem, NavItem } from '~/components/navbar/types'; +import type { DropdownItem, NavItem } from '~/components/navbar-v2/types'; import { ChallengesPanel } from './challenges-panel'; import { MethodPanel } from './method-panel'; diff --git a/app/components/navbar-v2/nav-panel-item.tsx b/app/components/navbar-v2/nav-panel-item.tsx index 43fe05e1..74e58b37 100644 --- a/app/components/navbar-v2/nav-panel-item.tsx +++ b/app/components/navbar-v2/nav-panel-item.tsx @@ -4,7 +4,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { center } from '@ocobo/styled-system/patterns'; import { text } from '@ocobo/styled-system/recipes'; -import type { DropdownItem } from '~/components/navbar/types'; +import type { DropdownItem } from '~/components/navbar-v2/types'; import { focusRing, panelItemTint } from './nav-styles'; diff --git a/app/components/navbar-v2/nav-styles.ts b/app/components/navbar-v2/nav-styles.ts index da4b7dc0..9f00a9f9 100644 --- a/app/components/navbar-v2/nav-styles.ts +++ b/app/components/navbar-v2/nav-styles.ts @@ -1,7 +1,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { text } from '@ocobo/styled-system/recipes'; -import type { Color, DropdownItemTint } from '~/components/navbar/types'; +import type { Color, DropdownItemTint } from '~/components/navbar-v2/types'; /** * Icon box tint per colour, shared by the desktop panels and the mobile diff --git a/app/components/navbar-v2/navbar-bar.test.tsx b/app/components/navbar-v2/navbar-bar.test.tsx index 99c380b3..f5296d20 100644 --- a/app/components/navbar-v2/navbar-bar.test.tsx +++ b/app/components/navbar-v2/navbar-bar.test.tsx @@ -1,7 +1,7 @@ import { Target } from 'lucide-react'; import { describe, expect, it } from 'vitest'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { axe, render, screen, userEvent, waitFor, within } from '~/test/utils'; import { NavbarBar } from './navbar-bar'; diff --git a/app/components/navbar-v2/navbar-bar.tsx b/app/components/navbar-v2/navbar-bar.tsx index 1b3c427a..786dae80 100644 --- a/app/components/navbar-v2/navbar-bar.tsx +++ b/app/components/navbar-v2/navbar-bar.tsx @@ -5,7 +5,7 @@ import { NavLink, useLocation } from 'react-router'; import { css, cx } from '@ocobo/styled-system/css'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { ButtonLink } from '~/components/ui/button-link'; import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; import { useMenuItems } from '~/hooks/useMenuItems'; diff --git a/app/components/navbar-v2/navbar.tsx b/app/components/navbar-v2/navbar.tsx index d301fe97..11844121 100644 --- a/app/components/navbar-v2/navbar.tsx +++ b/app/components/navbar-v2/navbar.tsx @@ -1,6 +1,6 @@ import { css } from '@ocobo/styled-system/css'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { NavbarBar } from './navbar-bar'; import { useScrolled } from './use-scrolled'; diff --git a/app/components/navbar/types.ts b/app/components/navbar-v2/types.ts similarity index 100% rename from app/components/navbar/types.ts rename to app/components/navbar-v2/types.ts diff --git a/app/components/navbar/mobile-menu.tsx b/app/components/navbar/mobile-menu.tsx index 1bf41e76..e9e315ca 100644 --- a/app/components/navbar/mobile-menu.tsx +++ b/app/components/navbar/mobile-menu.tsx @@ -11,8 +11,8 @@ import { center, flex, hstack, vstack } from '@ocobo/styled-system/patterns'; import { ButtonLink } from '~/components/ui/button-link'; import { useMenuItems } from '~/hooks/useMenuItems'; +import type { DropdownItem, NavItem } from '~/components/navbar-v2/types'; import { dropdownItemTint } from './styles'; -import type { DropdownItem, NavItem } from './types'; type MobileMenuProps = { open: boolean; diff --git a/app/components/navbar/nav-dropdown-item.tsx b/app/components/navbar/nav-dropdown-item.tsx index 45c70ba7..672eb535 100644 --- a/app/components/navbar/nav-dropdown-item.tsx +++ b/app/components/navbar/nav-dropdown-item.tsx @@ -6,8 +6,8 @@ import { NavLink } from 'react-router'; import { css, cx } from '@ocobo/styled-system/css'; import { center, flex } from '@ocobo/styled-system/patterns'; +import type { DropdownItem } from '~/components/navbar-v2/types'; import { dropdownItemTint } from './styles'; -import type { DropdownItem } from './types'; type NavDropdownItemProps = React.ComponentPropsWithoutRef<'a'> & { item: DropdownItem; diff --git a/app/components/navbar/nav-item-with-dropdown.tsx b/app/components/navbar/nav-item-with-dropdown.tsx index d089ddd8..e338ac9c 100644 --- a/app/components/navbar/nav-item-with-dropdown.tsx +++ b/app/components/navbar/nav-item-with-dropdown.tsx @@ -4,8 +4,8 @@ import { ChevronDown } from 'lucide-react'; import { css, cx } from '@ocobo/styled-system/css'; import { flex } from '@ocobo/styled-system/patterns'; +import type { NavItem } from '~/components/navbar-v2/types'; import { NavDropdownItem } from './nav-dropdown-item'; -import type { NavItem } from './types'; type NavItemWithDropdownProps = { item: NavItem; diff --git a/app/components/navbar/styles.ts b/app/components/navbar/styles.ts index f848542d..3e56ac22 100644 --- a/app/components/navbar/styles.ts +++ b/app/components/navbar/styles.ts @@ -1,6 +1,6 @@ import { css, cx } from '@ocobo/styled-system/css'; -import type { Color, DropdownItemTint } from './types'; +import type { Color, DropdownItemTint } from '~/components/navbar-v2/types'; /** * Icon background/colour styles per colour variant. diff --git a/app/components/navbar/use-navbar-scroll.ts b/app/components/navbar/use-navbar-scroll.ts index 695accf4..fc6d7d96 100644 --- a/app/components/navbar/use-navbar-scroll.ts +++ b/app/components/navbar/use-navbar-scroll.ts @@ -1,7 +1,10 @@ import * as React from 'react'; +import type { + NavbarScrollState, + ScrollDirection, +} from '~/components/navbar-v2/types'; import { SCROLL_THRESHOLD } from './styles'; -import type { NavbarScrollState, ScrollDirection } from './types'; type UseNavbarScrollReturn = { scrollState: NavbarScrollState; diff --git a/app/hooks/use-challenge-menu-item.ts b/app/hooks/use-challenge-menu-item.ts index 9bf051b8..e6c45d3e 100644 --- a/app/hooks/use-challenge-menu-item.ts +++ b/app/hooks/use-challenge-menu-item.ts @@ -11,7 +11,7 @@ import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { challengePalette } from '~/components/challenges/challenge-palette'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import { setChallengeLoadFailed } from '~/modules/challenge-menu-state'; import type { ChallengeKey } from '~/modules/challenge-schema'; diff --git a/app/hooks/useMenuItems.test.tsx b/app/hooks/useMenuItems.test.tsx index e11b36fc..c00c148d 100644 --- a/app/hooks/useMenuItems.test.tsx +++ b/app/hooks/useMenuItems.test.tsx @@ -3,7 +3,7 @@ */ import { afterEach, describe, expect, it } from 'vitest'; -import type { NavItem } from '~/components/navbar/types'; +import type { NavItem } from '~/components/navbar-v2/types'; import type { ChallengeMenuEntry } from '~/modules/challenge-menu'; import { type PageSlug, getDisabledPages } from '~/modules/feature-flags'; import { render, screen } from '~/test/utils'; diff --git a/app/hooks/useMenuItems.ts b/app/hooks/useMenuItems.ts index c6021769..45a947bf 100644 --- a/app/hooks/useMenuItems.ts +++ b/app/hooks/useMenuItems.ts @@ -11,7 +11,7 @@ import { import { useTranslation } from 'react-i18next'; import { useRouteLoaderData } from 'react-router'; -import type { DropdownItem, NavItem } from '~/components/navbar/types'; +import type { DropdownItem, NavItem } from '~/components/navbar-v2/types'; import type { PageSlug } from '~/modules/feature-flags'; import type { loader as rootLoader } from '~/root'; import { url } from '~/utils/url'; From c9e916fa93567b93c264ea8b2d395e0a766b7861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 21:45:06 +0100 Subject: [PATCH 2/5] refactor(navbar): delete the v1 navbar and footer Since #324 the layout renders only the v2 navbar and footer, and no module imports the v1 ones. - Delete app/components/navbar/ and app/components/Footer.tsx, with the v1 navbar test. - Drop the NavbarScrollState and ScrollDirection types, used only by the v1 scroll hook. - Remove the footer.company, footer.services, footer.method, footer.resources and footer.newsletter keys from both locales. Only the v1 footer used them. - Move the check of the challenge load flag, read by shouldRevalidate in the main route, from the v1 navbar test to the useMenuItems test. It was its only test. --- app/components/Footer.tsx | 270 --------------- app/components/navbar-v2/types.ts | 4 - app/components/navbar/mobile-menu.tsx | 307 ------------------ app/components/navbar/nav-dropdown-item.tsx | 136 -------- .../navbar/nav-item-with-dropdown.tsx | 109 ------- app/components/navbar/navbar.test.tsx | 221 ------------- app/components/navbar/navbar.tsx | 210 ------------ app/components/navbar/styles.ts | 68 ---- app/components/navbar/use-navbar-scroll.ts | 48 --- app/hooks/useMenuItems.test.tsx | 16 +- locales/en/common.json | 16 - locales/fr/common.json | 16 - 12 files changed, 15 insertions(+), 1406 deletions(-) delete mode 100644 app/components/Footer.tsx delete mode 100644 app/components/navbar/mobile-menu.tsx delete mode 100644 app/components/navbar/nav-dropdown-item.tsx delete mode 100644 app/components/navbar/nav-item-with-dropdown.tsx delete mode 100644 app/components/navbar/navbar.test.tsx delete mode 100644 app/components/navbar/navbar.tsx delete mode 100644 app/components/navbar/styles.ts delete mode 100644 app/components/navbar/use-navbar-scroll.ts diff --git a/app/components/Footer.tsx b/app/components/Footer.tsx deleted file mode 100644 index 659364bd..00000000 --- a/app/components/Footer.tsx +++ /dev/null @@ -1,270 +0,0 @@ -import { ArrowRight, Linkedin, Youtube } from 'lucide-react'; -import { useTranslation } from 'react-i18next'; -import { NavLink, useLocation, useParams } from 'react-router'; - -import { css, cx } from '@ocobo/styled-system/css'; -import { - center, - flex, - grid, - hstack, - vstack, -} from '@ocobo/styled-system/patterns'; - -import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; -import { useMenuItems } from '~/hooks/useMenuItems'; -import { languages } from '~/localization/resources'; -import { getLang } from '~/utils/lang'; -import { url } from '~/utils/url'; - -import { NewsletterForm } from './NewsletterForm'; -import { Logocobo } from './ui/Logocobo'; - -const sectionTitleStyles = css({ - fontFamily: 'display', - fontWeight: 'bold', - mb: '6', - color: 'gray.400', - fontSize: 'sm', - textTransform: 'uppercase', - letterSpacing: 'wider', -}); - -const linkStyles = css({ - transition: 'colors', - _hover: { color: 'ocobo.yellow' }, -}); - -const socialButtonStyles = cx( - center(), - css({ - w: '8', - h: '8', - rounded: 'full', - bg: 'gray.800', - transition: 'all', - transitionDuration: 'slow', - _hover: { bg: 'white', color: 'ocobo.dark' }, - }), -); - -type FooterLinkItem = { - label: string; - path: string; - isExternal?: boolean; -}; - -function FooterLinkList({ items }: { items: FooterLinkItem[] }) { - return ( - - ); -} - -function Footer() { - const { t } = useTranslation('common'); - const items = useMenuItems(); - const getLocalizedPath = useLocalizedPathname(); - const { pathname } = useLocation(); - const params = useParams(); - const currentLang = getLang(params); - - const companyItems: FooterLinkItem[] = - items - ?.find((item) => item.key === 'company') - ?.dropdown?.filter((item) => !item.shouldHide) - ?.map((item) => ({ - label: item.label, - path: item.path, - isExternal: item.isExternal, - })) ?? []; - - const methodItems: FooterLinkItem[] = - items - ?.find((item) => item.key === 'method') - ?.dropdown?.filter((item) => !item.shouldHide) - ?.map((item) => ({ - label: item.label, - path: item.path, - isExternal: item.isExternal, - })) ?? []; - - return ( -
-
- {/* Top section */} -
- {/* Brand & Social */} -
- - - - - - {t('contact.cta')} - - -
- - {/* Company links */} -
-

{t('footer.company.title')}

- -
- - {/* Method links */} -
-

{t('footer.method.title')}

- -
- - {/* Newsletter */} -
-

- {t('footer.newsletter.title')} -

- -
-
- - {/* Bottom section */} -
-

{t('footer.copyright', { year: new Date().getFullYear() })}

- | - - {t('footer.legal.privacy')} - - | - - {t('footer.legal.terms')} - - | - {languages.map((lng) => ( - - {lng} - - ))} -
-
-
- ); -} - -export { Footer }; diff --git a/app/components/navbar-v2/types.ts b/app/components/navbar-v2/types.ts index dbaa2b72..afa6d388 100644 --- a/app/components/navbar-v2/types.ts +++ b/app/components/navbar-v2/types.ts @@ -3,10 +3,6 @@ import type { LucideIcon } from 'lucide-react'; // Matching prototype naming exactly export type Color = 'yellow' | 'sky' | 'coral' | 'mint'; -export type NavbarScrollState = 'at-top' | 'scrolled'; - -export type ScrollDirection = 'up' | 'down'; - /** * Item tint: a navbar colour, or a class that sets `colorPalette` (the * challenge entries pass `challengePalette[key]`). diff --git a/app/components/navbar/mobile-menu.tsx b/app/components/navbar/mobile-menu.tsx deleted file mode 100644 index e9e315ca..00000000 --- a/app/components/navbar/mobile-menu.tsx +++ /dev/null @@ -1,307 +0,0 @@ -import * as React from 'react'; - -import { Dialog } from '@ark-ui/react/dialog'; -import { Portal } from '@ark-ui/react/portal'; -import { Menu as MenuIcon, X } from 'lucide-react'; -import { NavLink, useNavigation } from 'react-router'; - -import { css, cx } from '@ocobo/styled-system/css'; -import { center, flex, hstack, vstack } from '@ocobo/styled-system/patterns'; - -import { ButtonLink } from '~/components/ui/button-link'; -import { useMenuItems } from '~/hooks/useMenuItems'; - -import type { DropdownItem, NavItem } from '~/components/navbar-v2/types'; -import { dropdownItemTint } from './styles'; - -type MobileMenuProps = { - open: boolean; - onOpenChange: (open: boolean) => void; -}; - -function MobileDropdownItem({ - item, - onClose, -}: { - item: DropdownItem; - onClose: () => void; -}) { - const { label, description, path, icon: Icon, imageSrc, isExternal } = item; - - const content = ( - <> -
- {imageSrc ? ( - {label} - ) : ( - Icon && - )} -
-
- - {label} - - {description && ( - - {description} - - )} -
- - ); - - const className = cx( - hstack({ gap: '4' }), - css({ - transition: 'transform', - _active: { transform: 'translateX(4px)' }, - }), - ); - - if (isExternal) { - return ( - - {content} - - ); - } - - return ( - - {content} - - ); -} - -function MobileNavItem({ - item, - onClose, -}: { - item: NavItem; - onClose: () => void; -}) { - const { label, path, dropdown, isButton } = item; - const visibleItems = dropdown?.filter((sub) => !sub.shouldHide) ?? []; - - const headingStyles = css({ - fontFamily: 'display', - fontSize: '2xl', - fontWeight: 'black', - display: 'block', - letterSpacing: 'tight', - color: 'ocobo.dark', - }); - - if (isButton && path) { - return ( -
- - {label} - -
- ); - } - - if (path && visibleItems.length === 0) { - return ( - - {label} - - ); - } - - if (visibleItems.length === 0) { - return null; - } - - return ( -
- {path ? ( - - {label} - - ) : ( - {label} - )} -
- {visibleItems.map((subItem) => ( - - ))} -
-
- ); -} - -export function MobileMenu({ open, onOpenChange }: MobileMenuProps) { - const items = useMenuItems(); - const navigation = useNavigation(); - - React.useEffect(() => { - if (navigation.state === 'loading' && open) { - onOpenChange(false); - } - }, [navigation.state, open, onOpenChange]); - - React.useEffect(() => { - // 1024px matches Panda CSS `lg` breakpoint - const mediaQueryList = window.matchMedia('(min-width: 1024px)'); - - const handleChange = () => { - if (mediaQueryList.matches && open) { - onOpenChange(false); - } - }; - - handleChange(); - mediaQueryList.addEventListener('change', handleChange); - return () => mediaQueryList.removeEventListener('change', handleChange); - }, [open, onOpenChange]); - - const handleClose = () => onOpenChange(false); - - const regularItems = items.filter((item) => !item.isButton); - const buttonItem = items.find((item) => item.isButton); - - return ( - onOpenChange(details.open)} - > - - - - - - -
- Ocobo Logo - - - -
- -
- {regularItems.map((item) => ( - - ))} -
- - {buttonItem && ( - - )} -
-
-
-
- ); -} diff --git a/app/components/navbar/nav-dropdown-item.tsx b/app/components/navbar/nav-dropdown-item.tsx deleted file mode 100644 index 672eb535..00000000 --- a/app/components/navbar/nav-dropdown-item.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import * as React from 'react'; - -import { ExternalLink } from 'lucide-react'; -import { NavLink } from 'react-router'; - -import { css, cx } from '@ocobo/styled-system/css'; -import { center, flex } from '@ocobo/styled-system/patterns'; - -import type { DropdownItem } from '~/components/navbar-v2/types'; -import { dropdownItemTint } from './styles'; - -type NavDropdownItemProps = React.ComponentPropsWithoutRef<'a'> & { - item: DropdownItem; - onClose?: () => void; -}; - -export const NavDropdownItem = React.forwardRef< - HTMLAnchorElement, - NavDropdownItemProps ->(function NavDropdownItem({ item, onClose, ...props }, ref) { - const { label, description, path, icon: Icon, imageSrc, isExternal } = item; - const tint = dropdownItemTint(item); - - const content = ( - <> -
- {imageSrc ? ( - {label} - ) : ( - Icon && - )} -
-
-

- {label} - {isExternal && } -

- {description && ( -

- {description} -

- )} -
- - ); - - const itemClass = cx( - 'group', - flex({ gap: '4', align: 'flex-start' }), - css({ - p: '4', - rounded: '2xl', - transition: 'all', - cursor: 'pointer', - outline: 'none', - _focus: { - outlineWidth: '2px', - outlineStyle: 'solid', - outlineColor: 'ocobo.dark', - outlineOffset: '0.5', - }, - }), - tint.hover, - ); - - if (isExternal) { - return ( - - {content} - - ); - } - - return ( - - {content} - - ); -}); diff --git a/app/components/navbar/nav-item-with-dropdown.tsx b/app/components/navbar/nav-item-with-dropdown.tsx deleted file mode 100644 index e338ac9c..00000000 --- a/app/components/navbar/nav-item-with-dropdown.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { Menu } from '@ark-ui/react/menu'; -import { ChevronDown } from 'lucide-react'; - -import { css, cx } from '@ocobo/styled-system/css'; -import { flex } from '@ocobo/styled-system/patterns'; - -import type { NavItem } from '~/components/navbar-v2/types'; -import { NavDropdownItem } from './nav-dropdown-item'; - -type NavItemWithDropdownProps = { - item: NavItem; - isCurrentPath: boolean; - activeDropdown: string | null; - setActiveDropdown: (label: string | null) => void; -}; - -export function NavItemWithDropdown({ - item, - isCurrentPath, - activeDropdown, - setActiveDropdown, -}: NavItemWithDropdownProps) { - const { key, label, dropdown } = item; - const visibleItems = dropdown?.filter((sub) => !sub.shouldHide) ?? []; - const isOpen = activeDropdown === key; - - if (visibleItems.length === 0) { - return null; - } - - const triggerStyles = cx( - flex({ gap: '1', align: 'center' }), - css({ - // Same spacing as the plain links in `navbar.tsx`. - px: { base: '4', lg: '3', xl: '4' }, - py: '2', - rounded: 'full', - fontSize: 'sm', - fontWeight: 'bold', - cursor: 'pointer', - transition: 'all', - transitionDuration: 'slow', - color: isOpen || isCurrentPath ? 'ocobo.dark' : 'gray.500', - _hover: { color: 'ocobo.dark' }, - whiteSpace: 'nowrap', - }), - ); - - return ( - { - setActiveDropdown(details.open ? key : null); - }} - positioning={{ placement: 'bottom', gutter: 28 }} - closeOnSelect - > - - - - - - {visibleItems.map((subItem) => ( - - setActiveDropdown(null)} - /> - - ))} - - - - ); -} diff --git a/app/components/navbar/navbar.test.tsx b/app/components/navbar/navbar.test.tsx deleted file mode 100644 index e0a7eb4b..00000000 --- a/app/components/navbar/navbar.test.tsx +++ /dev/null @@ -1,221 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -import { challengePalette } from '~/components/challenges/challenge-palette'; -import type { ChallengeMenuEntry } from '~/modules/challenge-menu'; -import { didChallengeLoadFail } from '~/modules/challenge-menu-state'; -import { render, screen, userEvent, waitFor, within } from '~/test/utils'; - -import { Navbar } from './navbar'; - -describe('Navbar', () => { - it('renders the navigation element and top-level items', () => { - render(); - - expect(screen.getByRole('navigation')).toBeInTheDocument(); - expect( - screen.getByRole('link', { name: 'Notre Offre' }), - ).toBeInTheDocument(); - expect(screen.getByRole('link', { name: 'Clients' })).toBeInTheDocument(); - expect( - screen.getByRole('button', { name: /méthode/i }), - ).toBeInTheDocument(); - expect( - screen.getByRole('button', { name: /à propos/i }), - ).toBeInTheDocument(); - expect( - screen.getByRole('button', { name: /ressources/i }), - ).toBeInTheDocument(); - expect(screen.getByTestId('nav-cta')).toBeInTheDocument(); - }); - - it('mobile hamburger opens the navigation drawer', async () => { - const user = userEvent.setup(); - render(); - - await user.click(screen.getByRole('button', { name: 'Open menu' })); - - expect( - await screen.findByRole('dialog', { name: 'Navigation menu' }), - ).toBeInTheDocument(); - }); - - it('close button dismisses the mobile drawer', async () => { - const user = userEvent.setup(); - render(); - - await user.click(screen.getByRole('button', { name: 'Open menu' })); - await screen.findByRole('dialog', { name: 'Navigation menu' }); - - await user.click(screen.getByRole('button', { name: 'Close menu' })); - - // Ark's presence unmounts the dialog asynchronously after close. - await waitFor(() => - expect( - screen.queryByRole('dialog', { name: 'Navigation menu' }), - ).not.toBeInTheDocument(), - ); - }); - - it('current route link gets aria-current="page"', () => { - render(, { initialEntries: ['/fr/offer'] }); - - expect(screen.getByRole('link', { name: 'Notre Offre' })).toHaveAttribute( - 'aria-current', - 'page', - ); - expect(screen.getByRole('link', { name: 'Clients' })).not.toHaveAttribute( - 'aria-current', - ); - }); -}); - -const frenchChallenges: ChallengeMenuEntry[] = [ - { - slug: 'sales-experience', - key: 'se', - name: 'Sales Experience', - tagline: "Une organisation commerciale qui passe à l'échelle", - }, - { - slug: 'revenue-performance', - key: 'rp', - name: 'Revenue Performance', - tagline: 'Un chiffre que vous voyez venir', - }, -]; - -const withChallenges = (challenges: ChallengeMenuEntry[], failed = false) => ({ - loaderData: { 'routes/_main': { challenges, failed } }, -}); - -describe('Navbar challenge entry', () => { - it('is hidden when no challenge is published, and the offer stays', () => { - render(, withChallenges([])); - - expect( - screen.queryByRole('button', { name: /vos enjeux/i }), - ).not.toBeInTheDocument(); - expect( - screen.getByRole('link', { name: 'Notre Offre' }), - ).toBeInTheDocument(); - }); - - it('replaces the offer entry and lists the challenges in order', async () => { - const user = userEvent.setup(); - render(, withChallenges(frenchChallenges)); - - const trigger = screen.getByRole('button', { name: /vos enjeux/i }); - expect( - screen.queryByRole('link', { name: 'Notre Offre' }), - ).not.toBeInTheDocument(); - const stories = screen.getByRole('link', { name: 'Clients' }); - expect( - trigger.compareDocumentPosition(stories) & - Node.DOCUMENT_POSITION_FOLLOWING, - ).toBeTruthy(); - - await user.click(trigger); - - const items = await screen.findAllByRole('menuitem'); - expect(items.map((item) => item.getAttribute('href'))).toEqual([ - '/fr/challenges/sales-experience', - '/fr/challenges/revenue-performance', - ]); - expect(items[0]).toHaveTextContent('Sales Experience'); - expect(items[0]).toHaveTextContent( - "Une organisation commerciale qui passe à l'échelle", - ); - }); - - it('tints each item with its challenge palette', async () => { - const user = userEvent.setup(); - render(, withChallenges(frenchChallenges)); - - await user.click(screen.getByRole('button', { name: /vos enjeux/i })); - - const [sales, revenue] = await screen.findAllByRole('menuitem'); - // The item carries the palette for its hover, the icon box for its tint. - expect(sales).toHaveClass(challengePalette.se); - expect(sales.getElementsByClassName(challengePalette.se)).toHaveLength(1); - expect(revenue).toHaveClass(challengePalette.rp); - expect(revenue).not.toHaveClass(challengePalette.se); - }); - - it('records whether the last load failed, for shouldRevalidate', () => { - const { unmount } = render(, withChallenges([], true)); - expect(didChallengeLoadFail()).toBe(true); - unmount(); - - // An empty list that loaded fine (flag off, nothing published). - render(, withChallenges([])); - expect(didChallengeLoadFail()).toBe(false); - }); - - it('opens, moves and closes with the keyboard', async () => { - const user = userEvent.setup(); - render(, withChallenges(frenchChallenges)); - - const trigger = screen.getByRole('button', { name: /vos enjeux/i }); - trigger.focus(); - await user.keyboard('{Enter}'); - - await waitFor(() => - expect(trigger).toHaveAttribute('aria-expanded', 'true'), - ); - const menu = await screen.findByRole('menu'); - // The menu takes focus on a later frame: a key sent before that reaches - // the trigger instead. - await waitFor(() => expect(menu).toHaveFocus()); - await user.keyboard('{ArrowDown}'); - await waitFor(() => - expect( - within(menu).getByRole('menuitem', { name: /revenue performance/i }), - ).toHaveAttribute('data-highlighted'), - ); - - // Focus return to the trigger after Escape is checked in the browser: - // Zag restores it on a microtask that jsdom does not run reliably. - await user.keyboard('{Escape}'); - await waitFor(() => - expect(trigger).toHaveAttribute('aria-expanded', 'false'), - ); - }); - - it('renders in English with English paths', async () => { - const user = userEvent.setup(); - render(, { - ...withChallenges([ - { - slug: 'revenue-performance', - key: 'rp', - name: 'Revenue Performance', - tagline: 'A number you can see coming', - }, - ]), - path: ':lang/*', - initialEntries: ['/en/offer'], - i18nLang: 'en', - }); - - await user.click(screen.getByRole('button', { name: /your challenges/i })); - - expect( - await screen.findByRole('menuitem', { name: /revenue performance/i }), - ).toHaveAttribute('href', '/en/challenges/revenue-performance'); - }); - - it('lists the challenges in the mobile menu', async () => { - const user = userEvent.setup(); - render(, withChallenges(frenchChallenges)); - - await user.click(screen.getByRole('button', { name: 'Open menu' })); - const drawer = await screen.findByRole('dialog', { - name: 'Navigation menu', - }); - - expect(within(drawer).getByText('Vos enjeux')).toBeInTheDocument(); - expect( - within(drawer).getByRole('link', { name: /sales experience/i }), - ).toHaveAttribute('href', '/fr/challenges/sales-experience'); - }); -}); diff --git a/app/components/navbar/navbar.tsx b/app/components/navbar/navbar.tsx deleted file mode 100644 index 574c8b7a..00000000 --- a/app/components/navbar/navbar.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import * as React from 'react'; - -import { NavLink, useLocation, useNavigation } from 'react-router'; - -import { css, cx } from '@ocobo/styled-system/css'; -import { flex, hstack } from '@ocobo/styled-system/patterns'; - -import { ButtonLink } from '~/components/ui/button-link'; -import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; -import { useMenuItems } from '~/hooks/useMenuItems'; - -import { Spinner } from '../ui/Spinner'; -import { MobileMenu } from './mobile-menu'; -import { NavItemWithDropdown } from './nav-item-with-dropdown'; -import { SCROLL_THRESHOLD } from './styles'; -import { useNavbarScroll } from './use-navbar-scroll'; - -const getLinkStyles = (isDropdownActive: boolean, isCurrent: boolean) => - cx( - flex({ gap: '1', align: 'center' }), - css({ - // Tighter between 1024px and 1280px, so the bar stays on one line. - px: { base: '4', lg: '3', xl: '4' }, - py: '2', - rounded: 'full', - fontSize: 'sm', - fontWeight: 'bold', - cursor: 'pointer', - transition: 'all', - transitionDuration: 'slow', - color: isDropdownActive || isCurrent ? 'ocobo.dark' : 'gray.500', - _hover: { color: 'ocobo.dark' }, - textDecoration: 'none', - whiteSpace: 'nowrap', - }), - ); - -export function Navbar() { - const navigation = useNavigation(); - const location = useLocation(); - const getLocalizedPath = useLocalizedPathname(); - const items = useMenuItems(); - const { scrollY } = useNavbarScroll(); - const [mobileMenuOpen, setMobileMenuOpen] = React.useState(false); - const [activeDropdown, setActiveDropdown] = React.useState( - null, - ); - - const scrolled = scrollY > SCROLL_THRESHOLD; - - React.useEffect(() => { - setMobileMenuOpen(false); - setActiveDropdown(null); - }, [location.pathname]); - - return ( -
- -
- ); -} diff --git a/app/components/navbar/styles.ts b/app/components/navbar/styles.ts deleted file mode 100644 index 3e56ac22..00000000 --- a/app/components/navbar/styles.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { css, cx } from '@ocobo/styled-system/css'; - -import type { Color, DropdownItemTint } from '~/components/navbar-v2/types'; - -/** - * Icon background/colour styles per colour variant. - * Shared between desktop dropdown items and mobile menu items. - */ -export const iconStyles: Record = { - yellow: css({ bg: 'ocobo.yellow/10', color: 'ocobo.yellow' }), - sky: css({ bg: 'ocobo.sky/10', color: 'ocobo.sky' }), - coral: css({ bg: 'ocobo.coral/10', color: 'ocobo.coral' }), - mint: css({ bg: 'ocobo.mint/10', color: 'ocobo.mint' }), -}; - -/** - * Hover background styles for dropdown items. - */ -export const hoverStyles: Record = { - yellow: css({ _hover: { bg: 'ocobo.yellow.light' } }), - sky: css({ _hover: { bg: 'ocobo.sky.light' } }), - coral: css({ _hover: { bg: 'ocobo.coral.light' } }), - mint: css({ _hover: { bg: 'ocobo.mint.light' } }), -}; - -/** - * Text colour on hover for dropdown item labels. - */ -export const hoverTextStyles: Record = { - yellow: css({ _groupHover: { color: 'ocobo.yellow' } }), - sky: css({ _groupHover: { color: 'ocobo.sky' } }), - coral: css({ _groupHover: { color: 'ocobo.coral' } }), - mint: css({ _groupHover: { color: 'ocobo.mint' } }), -}; - -/** - * Same roles for an item that sets `colorPalette`. The label keeps its dark - * colour on hover: some challenge colours are too light for text. - */ -const paletteIconStyles = css({ - bg: 'colorPalette/10', - color: 'colorPalette', -}); -const paletteHoverStyles = css({ _hover: { bg: 'colorPalette.light' } }); - -/** - * Tint classes of one dropdown item. A palette item carries its palette - * class on each element, so neither depends on the other's ancestors. - */ -export function dropdownItemTint(item: DropdownItemTint) { - if (item.palette !== undefined) { - return { - icon: cx(item.palette, paletteIconStyles), - hover: cx(item.palette, paletteHoverStyles), - label: undefined, - }; - } - return { - icon: iconStyles[item.color], - hover: hoverStyles[item.color], - label: hoverTextStyles[item.color], - }; -} - -/** - * Scroll threshold in pixels before navbar transitions to "scrolled" state. - */ -export const SCROLL_THRESHOLD = 30; diff --git a/app/components/navbar/use-navbar-scroll.ts b/app/components/navbar/use-navbar-scroll.ts deleted file mode 100644 index fc6d7d96..00000000 --- a/app/components/navbar/use-navbar-scroll.ts +++ /dev/null @@ -1,48 +0,0 @@ -import * as React from 'react'; - -import type { - NavbarScrollState, - ScrollDirection, -} from '~/components/navbar-v2/types'; -import { SCROLL_THRESHOLD } from './styles'; - -type UseNavbarScrollReturn = { - scrollState: NavbarScrollState; - scrollDirection: ScrollDirection; - scrollY: number; -}; - -export function useNavbarScroll(): UseNavbarScrollReturn { - const [scrollY, setScrollY] = React.useState(0); - const [scrollDirection, setScrollDirection] = - React.useState('up'); - const previousScrollY = React.useRef(0); - const ticking = React.useRef(false); - - React.useEffect(() => { - const handleScroll = () => { - if (ticking.current) return; - - ticking.current = true; - requestAnimationFrame(() => { - const currentScrollY = window.scrollY; - const direction = - currentScrollY > previousScrollY.current ? 'down' : 'up'; - - previousScrollY.current = currentScrollY; - setScrollY(currentScrollY); - setScrollDirection(direction); - ticking.current = false; - }); - }; - - handleScroll(); - window.addEventListener('scroll', handleScroll, { passive: true }); - return () => window.removeEventListener('scroll', handleScroll); - }, []); - - const scrollState: NavbarScrollState = - scrollY > SCROLL_THRESHOLD ? 'scrolled' : 'at-top'; - - return { scrollState, scrollDirection, scrollY }; -} diff --git a/app/hooks/useMenuItems.test.tsx b/app/hooks/useMenuItems.test.tsx index c00c148d..13a44830 100644 --- a/app/hooks/useMenuItems.test.tsx +++ b/app/hooks/useMenuItems.test.tsx @@ -1,10 +1,12 @@ /** * @vitest-environment jsdom */ +import { cleanup } from '@testing-library/react'; import { afterEach, describe, expect, it } from 'vitest'; import type { NavItem } from '~/components/navbar-v2/types'; import type { ChallengeMenuEntry } from '~/modules/challenge-menu'; +import { didChallengeLoadFail } from '~/modules/challenge-menu-state'; import { type PageSlug, getDisabledPages } from '~/modules/feature-flags'; import { render, screen } from '~/test/utils'; @@ -94,18 +96,20 @@ const revenueAi: ChallengeMenuEntry = { type MenuOptions = { challenges?: ChallengeMenuEntry[]; disabledPages?: PageSlug[]; + failed?: boolean; lang?: 'fr' | 'en'; }; function renderMenu({ challenges = [revenuePerformance, revenueAi], disabledPages = ['roi'], + failed = false, lang = 'fr', }: MenuOptions = {}): NavItem[] { render(, { loaderData: { root: { disabledPages }, - 'routes/_main': { challenges, failed: false }, + 'routes/_main': { challenges, failed }, }, ...(lang === 'en' ? { i18nLang: 'en', initialEntries: ['/en'], path: ':lang/*' } @@ -121,6 +125,16 @@ const find = (items: NavItem[], key: string) => items.find((item) => item.key === key); describe('useMenuItems', () => { + it('records whether the last challenge load failed, for shouldRevalidate', () => { + renderMenu({ challenges: [], failed: true }); + expect(didChallengeLoadFail()).toBe(true); + cleanup(); + + // An empty list that loaded fine (flag off, nothing published). + renderMenu({ challenges: [] }); + expect(didChallengeLoadFail()).toBe(false); + }); + it('follows the prototype order, IA after À propos', () => { expect(keysOf(renderMenu())).toEqual([ 'challenges', diff --git a/locales/en/common.json b/locales/en/common.json index 596a3b28..ef89cb6d 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -89,22 +89,6 @@ "clients.empty.title": "No client testimonials available", "clients.empty.subtitle": "Discover our clients' experiences soon.", "footer.copyright": "{{year}} © Ocobo - All rights reserved", - "footer.company.title": "Ocobo", - "footer.company.about": "About us", - "footer.company.jobs": "Join us", - "footer.services.title": "Services", - "footer.services.strategy": "Stratégies\n Revenue Operations", - "footer.services.revops": "Revenue Operations Projects", - "footer.method.title": "Method", - "footer.method.approach": "Our approach", - "footer.method.pillars": "The 4 pillars", - "footer.resources.title": "Learn more", - "footer.resources.events": "Webinars & Events", - "footer.resources.blog": "Blog", - "footer.resources.tools": "Tools", - "footer.newsletter.title": "Don't miss our news", - "footer.newsletter.placeholder": "Your professional email", - "footer.newsletter.submit": "Subscribe", "footer.legal.privacy": "Privacy policy", "footer.legal.terms": "Terms of use", "footer.navigation": "Site links", diff --git a/locales/fr/common.json b/locales/fr/common.json index 3232d191..51b33571 100644 --- a/locales/fr/common.json +++ b/locales/fr/common.json @@ -89,22 +89,6 @@ "clients.illustration.aria": "Illustration radar architecture", "see_more": "En savoir plus", "footer.copyright": "{{year}} © Ocobo - Tous droits réservés", - "footer.company.title": "Ocobo", - "footer.company.about": "Qui sommes-nous\u00a0?", - "footer.company.jobs": "Nous rejoindre", - "footer.services.title": "Services", - "footer.services.strategy": "Stratégies\n Revenue Operations", - "footer.services.revops": "Projets Revenue Operations", - "footer.method.title": "Méthode", - "footer.method.approach": "Notre approche", - "footer.method.pillars": "Les 4 piliers", - "footer.resources.title": "En savoir plus", - "footer.resources.events": "Webinars & Événements", - "footer.resources.blog": "Blog", - "footer.resources.tools": "Outils", - "footer.newsletter.title": "Ne manquez pas nos actualités", - "footer.newsletter.placeholder": "Votre e-mail professionnel", - "footer.newsletter.submit": "S'inscrire", "footer.legal.privacy": "Politique de confidentialité", "footer.legal.terms": "Conditions d'utilisation", "footer.navigation": "Liens du site", From 57487b966b7b80f4b45e619928d5471029ef999d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 21:45:55 +0100 Subject: [PATCH 3/5] docs: drop the v1 navbar and footer from the docs - Component inventory: replace the outdated navigation table with the v2 navbar parts, note where the navigation types live, and mark NewsletterForm as no longer rendered. - ADR 0001: remove the deleted v1 footer and mobile menu from the shared component follow-up table. - Source tree: list navbar-v2 and footer-v2 in place of Header.tsx and Footer.tsx. --- .../adr/0001-design-system-adoption-policy.md | 2 -- docs/architecture/source-tree.md | 4 ++-- docs/development/component-inventory.md | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/adr/0001-design-system-adoption-policy.md b/docs/adr/0001-design-system-adoption-policy.md index b93d615e..57550309 100644 --- a/docs/adr/0001-design-system-adoption-policy.md +++ b/docs/adr/0001-design-system-adoption-policy.md @@ -107,8 +107,6 @@ These shared/layout components were out of scope for the #86–#93 per-feature m | File | Occurrences | Note | |------|-------------|------| | `app/components/PageMarkdownContainer.tsx` | 4 | Markdown renderer headings | -| `app/components/Footer.tsx` | 1 | Footer heading | -| `app/components/navbar/mobile-menu.tsx` | 1 | Mobile nav heading | ### Deferred per-feature occurrences diff --git a/docs/architecture/source-tree.md b/docs/architecture/source-tree.md index 3b1cc62b..66789cac 100644 --- a/docs/architecture/source-tree.md +++ b/docs/architecture/source-tree.md @@ -39,8 +39,8 @@ ocobo-website/ │ │ │ └── StoryMetas.tsx # ℹ️ Story metadata display │ │ │ │ │ ├── ContactForm.tsx # 📧 HubSpot-integrated contact form -│ │ ├── Header.tsx # 📱 Site header with navigation -│ │ └── Footer.tsx # 📍 Site footer with links +│ │ ├── navbar-v2/ # 📱 Site navbar, desktop panels and mobile menu +│ │ └── footer-v2/ # 📍 Site footer with links │ │ │ ├── modules/ # 🧠 Business logic and utilities │ │ ├── content/ # 📚 Content management abstraction diff --git a/docs/development/component-inventory.md b/docs/development/component-inventory.md index 83ce4168..4e3302c0 100644 --- a/docs/development/component-inventory.md +++ b/docs/development/component-inventory.md @@ -224,11 +224,16 @@ One `*-section.tsx` module per `/design-system` section, each wrapped in `Showca ### Navigation Components | Component | File | Purpose | Usage | |-----------|------|---------|--------| -| **MainMenu** | `MainMenu.tsx` | Desktop navigation | Header component | -| **MainMobileMenu** | `MainMobileMenu.tsx` | Mobile navigation | Header component | -| **MobileMenu** | `MobileMenu.tsx` | Mobile menu wrapper | Mobile layouts | -| **SubMenu** | `SubMenu.tsx` | Secondary navigation | Contextual | -| **LanguageSwitcher** | `LanguageSwitcher.tsx` | Language toggle | Header component | +| **NavbarBar** | `navbar-v2/navbar-bar.tsx` | The v2 bar without positioning or scroll state | `NavbarV2`, `/design-system` | +| **NavDisclosure** | `navbar-v2/nav-disclosure.tsx` | Desktop dropdown (disclosure pattern) | `NavbarBar` | +| **ChallengesPanel** | `navbar-v2/challenges-panel.tsx` | "Vos enjeux" mega panel | `nav-panel-content.tsx` | +| **MethodPanel** | `navbar-v2/method-panel.tsx` | "Méthode" mega panel, with the ROI card | `nav-panel-content.tsx` | +| **NavPanelItem** | `navbar-v2/nav-panel-item.tsx` | One panel or accordion entry | Desktop panels, mobile menu | +| **MobileMenu** | `navbar-v2/mobile-menu.tsx` | Burger and dialog card with accordion groups | `NavbarBar` | +| **LanguageLinks** | `navbar-v2/language-links.tsx` | FR and EN links to the current page | Navbar, footer | +| **LanguageSwitcher** | `LanguageSwitcher.tsx` | Language select | Not rendered by the v2 layout | + +The navigation types (`NavItem`, `DropdownItem`) live in `navbar-v2/types.ts`. The menu data comes from `useMenuItems` (`app/hooks/useMenuItems.ts`). ## Content Components @@ -252,7 +257,7 @@ One `*-section.tsx` module per `/design-system` section, each wrapped in `Showca |-----------|------|---------|--------| | **ContactForm** | `ContactForm.tsx` | Main contact form | Contact page | | **IntContactForm** | `IntContactForm.tsx` | International contact form | Localized contact | -| **NewsletterForm** | `NewsletterForm.tsx` | Newsletter subscription | Footer, CTAs | +| **NewsletterForm** | `NewsletterForm.tsx` | Newsletter subscription | Not rendered since the v1 footer was deleted | ### Form Support | Component | File | Purpose | Usage | @@ -270,7 +275,7 @@ One `*-section.tsx` module per `/design-system` section, each wrapped in `Showca ### Highly Reusable (Design System) - All `ui/` components -- Layout components (LayoutMain, Header, Footer) +- Layout components (LayoutMain, LayoutPost, NavbarV2, FooterV2) - Content wrappers (MarkdownContainer, etc.) - Form components (ContactForm patterns) From ed9f0f01859c1c73893c105f1a91e71567888da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 21:49:29 +0100 Subject: [PATCH 4/5] test(navbar): cover the challenge entries the v1 navbar test checked The deleted v1 navbar test was the only check on how the challenge entries are built and shown. - useMenuItems: each published challenge maps to an entry with its label, tagline, localised path and palette. Reset the challenge load flag after each test, since it is module state. - NavbarBar mobile menu: the close button closes the dialog, and the challenges from the layout data appear in the menu. - LayoutMain: update the comment that named the v1 footer. --- app/components/LayoutMain.test.tsx | 2 +- app/components/navbar-v2/navbar-bar.test.tsx | 38 ++++++++++++++++++-- app/hooks/useMenuItems.test.tsx | 32 ++++++++++++++++- 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/app/components/LayoutMain.test.tsx b/app/components/LayoutMain.test.tsx index e58fa5af..cc35137d 100644 --- a/app/components/LayoutMain.test.tsx +++ b/app/components/LayoutMain.test.tsx @@ -19,7 +19,7 @@ describe('LayoutMain', () => { ).toBeInTheDocument(); // A single banner: the navbar. Page heroes must not add another. expect(screen.getAllByRole('banner')).toHaveLength(1); - // The v1 footer has no labelled link row. + // The labelled link row identifies the v2 footer. expect( screen.getByRole('navigation', { name: 'Liens du site' }), ).toBeInTheDocument(); diff --git a/app/components/navbar-v2/navbar-bar.test.tsx b/app/components/navbar-v2/navbar-bar.test.tsx index f5296d20..0187e35a 100644 --- a/app/components/navbar-v2/navbar-bar.test.tsx +++ b/app/components/navbar-v2/navbar-bar.test.tsx @@ -453,10 +453,42 @@ describe('NavbarBar mobile menu', () => { await user.click(screen.getByRole('button', { name: 'Ouvrir le menu' })); const dialog = await screen.findByRole('dialog', { name: 'Menu' }); - expect( - within(dialog).getByRole('button', { name: 'Fermer le menu' }), - ).toBeInTheDocument(); expect(await axe(dialog)).toHaveNoViolations(); + await user.click( + within(dialog).getByRole('button', { name: 'Fermer le menu' }), + ); + await waitFor(() => + expect(screen.queryByRole('dialog')).not.toBeInTheDocument(), + ); + }); + + it('lists the published challenges from the layout data', async () => { + const user = userEvent.setup(); + render(, { + loaderData: { + 'routes/_main': { + challenges: [ + { + slug: 'revenue-performance', + key: 'rp', + name: 'Revenue Performance', + tagline: 'Un chiffre que vous voyez venir', + }, + ], + failed: false, + }, + }, + }); + + await user.click(screen.getByRole('button', { name: 'Ouvrir le menu' })); + const dialog = await screen.findByRole('dialog', { name: 'Menu' }); + await user.click( + within(dialog).getByRole('button', { name: 'Vos enjeux' }), + ); + + expect( + within(dialog).getByRole('link', { name: /Revenue Performance/ }), + ).toHaveAttribute('href', '/fr/challenges/revenue-performance'); }); it('uses English labels on English pages', async () => { diff --git a/app/hooks/useMenuItems.test.tsx b/app/hooks/useMenuItems.test.tsx index 13a44830..ad9d4855 100644 --- a/app/hooks/useMenuItems.test.tsx +++ b/app/hooks/useMenuItems.test.tsx @@ -4,9 +4,13 @@ import { cleanup } from '@testing-library/react'; import { afterEach, describe, expect, it } from 'vitest'; +import { challengePalette } from '~/components/challenges/challenge-palette'; import type { NavItem } from '~/components/navbar-v2/types'; import type { ChallengeMenuEntry } from '~/modules/challenge-menu'; -import { didChallengeLoadFail } from '~/modules/challenge-menu-state'; +import { + didChallengeLoadFail, + setChallengeLoadFailed, +} from '~/modules/challenge-menu-state'; import { type PageSlug, getDisabledPages } from '~/modules/feature-flags'; import { render, screen } from '~/test/utils'; @@ -125,6 +129,32 @@ const find = (items: NavItem[], key: string) => items.find((item) => item.key === key); describe('useMenuItems', () => { + // The flag is module state: reset it so no test sees another's value. + afterEach(() => setChallengeLoadFailed(false)); + + it('maps each published challenge to a tinted, localised entry', () => { + expect(find(renderMenu(), 'challenges')?.dropdown).toMatchObject([ + { + key: 'challenge-revenue-performance', + label: 'Revenue Performance', + description: 'Un chiffre que vous voyez venir', + path: '/fr/challenges/revenue-performance', + palette: challengePalette.rp, + }, + { + key: 'challenge-revenue-ai', + path: '/fr/challenges/revenue-ai', + palette: challengePalette.ai, + }, + ]); + cleanup(); + + const english = find(renderMenu({ lang: 'en' }), 'challenges'); + expect(english?.dropdown?.[0]?.path).toBe( + '/en/challenges/revenue-performance', + ); + }); + it('records whether the last challenge load failed, for shouldRevalidate', () => { renderMenu({ challenges: [], failed: true }); expect(didChallengeLoadFail()).toBe(true); From d5fa4d4a3719d593c0d261f4cc08e582a9e687c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 21:49:29 +0100 Subject: [PATCH 5/5] docs(inventory): mark Spinner as unused since the v1 navbar was deleted --- docs/development/component-inventory.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/component-inventory.md b/docs/development/component-inventory.md index 4e3302c0..7f3e4aa6 100644 --- a/docs/development/component-inventory.md +++ b/docs/development/component-inventory.md @@ -55,7 +55,7 @@ The OCOBO website implements a comprehensive component library built on Ark UI p | Component | File | Purpose | Dependencies | |-----------|------|---------|--------------| | **Loader** | `Loader.tsx` | Loading states | SVG animations | -| **Spinner** | `Spinner.tsx` | Inline loading indicator | CSS animations | +| **Spinner** | `Spinner.tsx` | Inline loading indicator, unused since the v1 navbar was deleted | CSS animations | | **ScrollProgressBar** | `ScrollProgressBar.tsx` | Reading progress indicator | Scroll events | ## Feature-Specific Components