Files
sharper.ly/apps/web/app/components/ui/Navigation/nav-items.ts
T
IllusionandClaude Opus 5 aedef6daeb Rebuild the site to the Claude Design drafts
Carries the 11 page drafts plus the shared SiteNav and SiteFooter onto the
project's own design system: tier-2 tokens, the published type roles, logical
properties throughout, and both locales.

Surfaces
- The page stands on #0B0B0A with #1D1D1B bands lifted off it, as the drafts
  do; the body previously painted the band colour, so every band was a step
  too light.
- A card is drawn one step off whatever it stands on (#1D1D1B on the ground,
  #141413 inside a band). Components paint --surface-card and a band re-points
  it for its subtree, so a card can never come out the same colour as its band.

Shell
- Nav: translucent ground with a blur, chevrons on group triggers, an accent
  rule under the current section, the drafts' compact dropdown card, and an
  EN | AR toggle in place of the globe menu.
- Footer: the drafts' four-column grid, one-line brand text, Facebook as a
  bordered button, the EU lockup, the implemented-by row and the funding
  disclaimer.

Pages
- Home: hero with counting figures, launch band, three areas of change,
  newsroom, FAQ accordion and the consortium band.
- The nine interior pages rebuilt and then audited section by section against
  their drafts.
- Applications: the three-step application form now posts real submissions to
  the Strapi `application` type, validated server-side and working without
  JavaScript.

Motion
- Every animation in the drafts, as classes in _page-kit/motion.css: staggered
  entrances, scroll-driven reveals, the drifting washes (each page carries its
  own geometry), the sheen, the counting figures and the accordion. The
  drafts' coloured hover glow is deliberately not shipped.

CMS
- New `faq` collection type behind the home page's accordion.
- `role` added to the consortium member component so an editor can supply the
  chip and the deliverable separately.

Content
- No invented figure, date, name or commitment ships: the five-working-day
  reply, the placeholder email and Facebook handle, the sample news, events,
  publications and FAQs, the invented application rules and the TBD counters
  are all withheld pending real content. Figures that survived (3 consortium
  partners, 4 areas of work, 16 human security sub-projects, Dec 2025 - Dec
  2027) are verified against docs/ and the bundled draft copy.

Verified: pnpm typecheck (web + CMS) and pnpm --filter web build pass; all 20
page/locale URLs render 200 through the built SSR handler, including with the
CMS unreachable; no raw hex or physical-direction utility in components or
routes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 20:32:56 +02:00

156 lines
5.6 KiB
TypeScript

/* ============================================================================
DEFAULT INFORMATION ARCHITECTURE
----------------------------------------------------------------------------
The ten top-level destinations from the Figma navigation (frame 20:236) and
ToR 3.2. The app shell normally feeds `items` to <Navigation /> from the
Strapi site-settings single type; this module is the typed fallback that
renders when Strapi has not been wired yet.
It does NOT own the slugs: ~/lib/route-slugs is the one table the route
config is built from, and `NAV_PATHS` below is constrained to it.
Arabic copy is taken verbatim from the Arabic mega-menu frame (334:639).
========================================================================= */
import type { RouteSlugKey, RouteSlugs } from "~/lib/route-slugs";
import { buildLocalizedHref, type Locale } from "../LanguageSwitcher";
import type { NavItem, NavigationStrings, NavigationStringsByLocale } from "./types";
/**
* Unprefixed route paths. Both locales share the Latin slugs; the locale lives
* in the prefix (/en/contact, /ar/contact), never in the slug.
*
* The `satisfies` clause pins every entry to the slug `ROUTE_SLUGS` registers
* the route under - home's empty slug yielding "/" - so this table cannot
* drift away from the URLs the app actually serves, and cannot gain or lose a
* section without ~/lib/route-slugs gaining or losing one first.
*/
export const NAV_PATHS = {
home: "/",
about: "/about",
whatWeDo: "/what-we-do",
activities: "/activities-and-initiatives",
events: "/events-calendar",
applications: "/applications-and-opportunities",
news: "/news-and-updates",
contact: "/contact",
resources: "/resources-and-publications",
knowledgeHub: "/knowledge-hub",
} as const satisfies { readonly [K in RouteSlugKey]: `/${RouteSlugs[K]}` };
export type NavPathKey = keyof typeof NAV_PATHS;
type LabelKey =
| NavPathKey
| "aboutAndStrategy"
| "engagementAndOpportunities"
| "knowledgeAndImpact";
const LABELS: Record<Locale, Record<LabelKey, string>> = {
en: {
home: "Home",
aboutAndStrategy: "About and Strategy",
about: "About",
whatWeDo: "What We Do",
activities: "Activities and Initiatives",
engagementAndOpportunities: "Engagement and Opportunities",
events: "Events Calendar",
applications: "Applications and Opportunities",
news: "News and Updates",
contact: "Contact",
knowledgeAndImpact: "Knowledge and Impact",
resources: "Resources and Publications",
knowledgeHub: "Knowledge Hub",
},
ar: {
home: "الرئيسية",
aboutAndStrategy: "عن المشروع والاستراتيجية",
about: "عن المشروع",
whatWeDo: "ماذا نفعل",
activities: "الأنشطة والمبادرات",
engagementAndOpportunities: "المشاركة والفرص",
events: "تقويم الفعاليات",
applications: "التطبيقات والفرص",
news: "الأخبار والمستجدات",
contact: "اتصل بنا",
knowledgeAndImpact: "المعرفة والتأثير",
resources: "الموارد والمنشورات",
knowledgeHub: "مركز المعرفة",
},
};
/**
* The default navigation for a locale, with every href already prefixed.
* Returns a fresh array so a caller may safely sort or splice it.
*/
export function getDefaultNavItems(locale: Locale): NavItem[] {
const label = LABELS[locale];
const href = (key: NavPathKey) => buildLocalizedHref(NAV_PATHS[key], locale);
return [
{ id: "home", label: label.home, href: href("home") },
{
id: "about-and-strategy",
label: label.aboutAndStrategy,
children: [
{ id: "about", label: label.about, href: href("about") },
{ id: "what-we-do", label: label.whatWeDo, href: href("whatWeDo") },
{ id: "activities", label: label.activities, href: href("activities") },
],
},
{
id: "engagement-and-opportunities",
label: label.engagementAndOpportunities,
children: [
{ id: "events", label: label.events, href: href("events") },
{ id: "applications", label: label.applications, href: href("applications") },
{ id: "news", label: label.news, href: href("news") },
{ id: "contact", label: label.contact, href: href("contact") },
],
},
{
id: "knowledge-and-impact",
label: label.knowledgeAndImpact,
children: [
{ id: "resources", label: label.resources, href: href("resources") },
{ id: "knowledge-hub", label: label.knowledgeHub, href: href("knowledgeHub") },
],
},
];
}
/**
* EU visibility is mandatory on every page. "Funded by the European Union" is
* the prescribed wording; the Figma text layer reads "European nation", which
* is a typo in the design file and is corrected here.
*/
export const NAVIGATION_STRINGS: NavigationStringsByLocale = {
en: {
primaryNavLabel: "Main navigation",
openMenu: "Open menu",
closeMenu: "Close menu",
homeLinkLabel: "SHARP-ER home",
languageMenuLabel: "Language",
euStatement: "Funded by the European Union",
euEmblemAlt: "",
},
ar: {
primaryNavLabel: "التنقل الرئيسي",
openMenu: "فتح القائمة",
closeMenu: "إغلاق القائمة",
homeLinkLabel: "الصفحة الرئيسية لمشروع SHARP-ER",
languageMenuLabel: "اللغة",
euStatement: "بتمويل من الاتحاد الأوروبي",
euEmblemAlt: "",
},
};
export function getNavigationStrings(
locale: Locale,
overrides?: Partial<NavigationStrings>,
): NavigationStrings {
return { ...NAVIGATION_STRINGS[locale], ...overrides };
}