From f7c105647aff3519a846af337423c2e5b99d520b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 15:20:13 +0100 Subject: [PATCH 1/5] fix(home): give the method section a white background, as in the mockup --- app/components/home/interventions-section.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home/interventions-section.tsx b/app/components/home/interventions-section.tsx index a891986a..08522b38 100644 --- a/app/components/home/interventions-section.tsx +++ b/app/components/home/interventions-section.tsx @@ -47,7 +47,7 @@ export const InterventionsSection = () => {
From c85daf27013537df152f77de3678854fd9966a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 15:39:54 +0100 Subject: [PATCH 2/5] feat(home): animate the mission illustration and the AI section, as in the mockup - The mission illustration plays its entry animation once scrolled into view. - The AI layers reveal one by one as the section scrolls in, and hide again on the way back up. - The agent windows stagger their rows in and show typing dots before the insight message. - Reduced motion and server render keep every element visible. --- app/components/home/ai-agent-windows.tsx | 114 ++- app/components/home/ai-section.tsx | 134 +-- .../home/dashboard-illustration.tsx | 833 ++++++++++-------- app/hooks/use-scroll-steps.test.ts | 37 + app/hooks/use-scroll-steps.ts | 94 ++ preset/keyframes.ts | 39 + preset/tokens/index.ts | 2 + 7 files changed, 820 insertions(+), 433 deletions(-) create mode 100644 app/hooks/use-scroll-steps.test.ts create mode 100644 app/hooks/use-scroll-steps.ts diff --git a/app/components/home/ai-agent-windows.tsx b/app/components/home/ai-agent-windows.tsx index cede4ffc..5e92a202 100644 --- a/app/components/home/ai-agent-windows.tsx +++ b/app/components/home/ai-agent-windows.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'; import { css, cx } from '@ocobo/styled-system/css'; import { text } from '@ocobo/styled-system/recipes'; -import { Reveal } from '~/components/ui/reveal'; +import { useInView } from '~/hooks/use-in-view'; type Account = { name: string; signal: string }; type Pair = { name: string; value: string }; @@ -33,6 +33,52 @@ const STEP_LABELS = { type AgentKey = keyof typeof STEP_DOTS; +// Once a window is nearly half in view, its rows fade in one after the +// other and the score bars fill (the mockup `#pw8`). Each row carries its +// own delay. The transition sits on the shown state only, so hiding after +// hydration is instant. +const contentWaiting = css({ + '& .pw-s': { opacity: '0', translate: '[0 5px]' }, + '& .pw-score': { transform: 'scaleX(0)' }, + '& .pw-typing': { display: 'none' }, +}); +const contentShown = css({ + '& .pw-s': { + opacity: '1', + translate: '[0 0]', + transitionProperty: '[opacity, translate]', + transitionDuration: 'slower', + transitionTimingFunction: 'smooth', + }, + '& .pw-score': { + transform: 'scaleX(1)', + transformOrigin: 'left', + transitionProperty: '[transform]', + transitionDuration: '[0.9s]', + transitionTimingFunction: 'smooth', + }, + '& .pw-typing': { + animation: '[typing-hide 0s linear 0.9s forwards]', + }, + _motionReduce: { + '& .pw-s, & .pw-score': { transition: '[none]' }, + '& .pw-typing': { display: 'none' }, + }, +}); + +/** Delay of the row at `index`, in the mockup rhythm. */ +const rowDelay = (index: number, offset = 0) => ({ + transitionDelay: `${(0.2 + index * 0.3 + offset).toFixed(1)}s`, +}); + +const typingDot = css({ + w: '[5px]', + h: '[5px]', + rounded: 'full', + bg: 'gray.300', + animation: 'typing-dot', +}); + // The windows draw a small app UI: the mockup sets them at 11 to 12px, under // the six v2 sizes, so they use the `xs` and `label` font sizes. const windowFrame = css({ @@ -133,11 +179,17 @@ function AgentWindow({ children: ReactNode; }) { const { t } = useTranslation('home'); + const { ref, inView } = useInView({ + rootMargin: '0px', + threshold: 0.45, + }); return ( -
@@ -208,7 +260,7 @@ function AgentWindow({ {t(`ai.agents.${agent}.caption`)}

-
+ ); } @@ -242,7 +294,9 @@ export function AiAgentWindows() { {accounts.map((account, index) => (
  • + > + + {account.signal} @@ -289,10 +351,12 @@ export function AiAgentWindows() {
    - {fields.map((field) => ( + {fields.map((field, index) => (
    - {points.map((point) => ( -
  • + {points.map((point, index) => ( +
  • {point.name} {' '} @@ -380,10 +444,30 @@ export function AiAgentWindows() { {t('ai.agents.insight.meta')}

    -

    + +

    {t('ai.agents.insight.message')}

    -
    +
    {actions.map((action, index) => ( (STEP_THRESHOLDS); return (
    -
    +
      +
    1. {layer.line ? ( - -
      - - {copy.label} - -

      - {copy.title} -

      -

      - {copy.description} -

      -
        - {layer.tools.map((name) => ( -
      • - - {name} -
      • - ))} -
      -
      -
      +
      + + {copy.label} + +

      + {copy.title} +

      +

      + {copy.description} +

      +
        + {layer.tools.map((name) => ( +
      • + + {name} +
      • + ))} +
      +
    2. ); })} @@ -307,6 +332,7 @@ export function AiSection({ aiChallengeSlug }: AiSectionProps) { className={cx( text({ variant: 'small', color: 'white' }), css({ color: 'white/50', mt: '3', ml: '14' }), + stepClass(reached, animate, LAYERS.length), )} > {t('ai.layersCaption')} diff --git a/app/components/home/dashboard-illustration.tsx b/app/components/home/dashboard-illustration.tsx index e04b0c82..056ae15e 100644 --- a/app/components/home/dashboard-illustration.tsx +++ b/app/components/home/dashboard-illustration.tsx @@ -1,33 +1,104 @@ -import { css } from '@ocobo/styled-system/css'; +import { css, cx } from '@ocobo/styled-system/css'; import { center } from '@ocobo/styled-system/patterns'; +import { useInView } from '~/hooks/use-in-view'; + +// The `smooth` easing token: `animation` shorthands cannot reference tokens. +const easeOut = 'cubic-bezier(0.2, 0.8, 0.2, 1)'; +const easeBack = 'cubic-bezier(0.2, 0.8, 0.2, 1.3)'; + +// The mockup `#mission` illustration. Once a quarter of it is in view, the +// shapes pop, the windows rise, then their content grows and the wave draws +// itself. On hover the windows drift apart and the shapes swell. +const box = css({ + position: 'relative', + w: 'full', + maxW: '[580px]', + aspectRatio: 'square', + '& .il-w': { + transitionProperty: '[translate]', + transitionDuration: 'slower', + transitionTimingFunction: 'smooth', + }, + // Keeps the mint circle's own 1s hover rotation, which this rule overrides. + '& .il-s': { transition: `[scale 0.4s ${easeBack}, transform 1s ease]` }, + '& .il-ln, & .il-bar, & .il-pie': { transformBox: 'fill-box' }, + '& .il-ln': { transformOrigin: 'left center' }, + '& .il-bar': { transformOrigin: 'center bottom' }, + '& .il-pie': { transformOrigin: 'center' }, + '& .il-wave': { strokeDasharray: '1' }, + '&:hover .il-w1': { translate: '[-4px -6px]' }, + '&:hover .il-w2': { translate: '[5px -8px]' }, + '&:hover .il-w3': { translate: '[6px 4px]' }, + '&:hover .il-w4': { translate: '[0 -5px]' }, + '&:hover .il-w5': { translate: '[-5px 3px]' }, + '&:hover .il-s': { scale: '[1.08]' }, +}); + +const waiting = css({ '& .il-s, & .il-w': { opacity: '0' } }); + +const playing = css({ + '& .il-s': { animation: `[il-pop 0.7s ${easeBack} backwards]` }, + '& .il-s1': { animationDelay: '[0.1s]' }, + '& .il-s2': { animationDelay: '[0.25s]' }, + '& .il-s3': { animationDelay: '[0.4s]' }, + '& .il-s4': { animationDelay: '[0.55s]' }, + '& .il-w': { animation: `[il-up 0.7s ${easeOut} backwards]` }, + '& .il-w1': { animationDelay: '[0.3s]' }, + '& .il-w2': { animationDelay: '[0.45s]' }, + '& .il-w3': { animationDelay: '[0.6s]' }, + '& .il-w4': { animationDelay: '[0.75s]' }, + '& .il-w5': { animationDelay: '[0.9s]' }, + '& .il-ln': { animation: `[il-x 0.6s ${easeOut} backwards]` }, + '& .il-ln:nth-of-type(1)': { animationDelay: '[0.9s]' }, + '& .il-ln:nth-of-type(2)': { animationDelay: '[1.0s]' }, + '& .il-ln:nth-of-type(3)': { animationDelay: '[1.1s]' }, + '& .il-ln:nth-of-type(4)': { animationDelay: '[1.2s]' }, + '& .il-ln:nth-of-type(5)': { animationDelay: '[1.3s]' }, + '& .il-bar': { + animation: '[il-y 0.6s cubic-bezier(0.2, 0.8, 0.2, 1.2) backwards]', + }, + '& .il-bar:nth-of-type(1)': { animationDelay: '[1.3s]' }, + '& .il-bar:nth-of-type(2)': { animationDelay: '[1.4s]' }, + '& .il-bar:nth-of-type(3)': { animationDelay: '[1.5s]' }, + '& .il-bar:nth-of-type(4)': { animationDelay: '[1.6s]' }, + '& .il-bar:nth-of-type(5)': { animationDelay: '[1.7s]' }, + '& .il-pie': { animation: `[il-pie 1s ${easeOut} 1s backwards]` }, + '& .il-wave': { animation: '[il-draw 1.4s ease 1.3s backwards]' }, + '& .il-wave2': { animation: '[il-fade 0.8s ease 1.9s backwards]' }, + _motionReduce: { + '& .il-s, & .il-w, & .il-ln, & .il-bar, & .il-pie, & .il-wave, & .il-wave2': + { animation: '[none]', opacity: '1' }, + }, +}); + export const DashboardIllustration = () => { + // `inView` starts true, so the server render shows the final state. + const { ref, inView } = useInView({ + rootMargin: '0px', + threshold: 0.25, + }); + return ( -
      +
      {
      { })} fill="none" > - - - - - - - - + + - - - - + + + + + + + + + + + + - - - - - - - - + + - - - - - - - - - - + + - - - + + + + + + + + + + - - - - - + + - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + diff --git a/app/hooks/use-scroll-steps.test.ts b/app/hooks/use-scroll-steps.test.ts new file mode 100644 index 00000000..58219652 --- /dev/null +++ b/app/hooks/use-scroll-steps.test.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from 'vitest'; + +import { countReached, scrollStepProgress } from './use-scroll-steps'; + +describe('scrollStepProgress', () => { + it('is -1 while the top sits below 80% of the viewport', () => { + expect(scrollStepProgress(900, 1000)).toBe(-1); + expect(scrollStepProgress(801, 1000)).toBe(-1); + }); + + it('runs from 0 to 1 over the next half viewport', () => { + expect(scrollStepProgress(800, 1000)).toBe(0); + expect(scrollStepProgress(550, 1000)).toBe(0.5); + expect(scrollStepProgress(300, 1000)).toBe(1); + }); + + it('caps at 1 once scrolled past', () => { + expect(scrollStepProgress(-200, 1000)).toBe(1); + }); +}); + +describe('countReached', () => { + const thresholds = [0.04, 0.38, 0.7, 0.85]; + + it('counts no step before the first threshold', () => { + expect(countReached(thresholds, -1)).toBe(0); + expect(countReached(thresholds, 0.03)).toBe(0); + }); + + it('counts a threshold reached exactly', () => { + expect(countReached(thresholds, 0.38)).toBe(2); + }); + + it('counts every step at the end', () => { + expect(countReached(thresholds, 1)).toBe(4); + }); +}); diff --git a/app/hooks/use-scroll-steps.ts b/app/hooks/use-scroll-steps.ts new file mode 100644 index 00000000..e80f5fc2 --- /dev/null +++ b/app/hooks/use-scroll-steps.ts @@ -0,0 +1,94 @@ +import { + type RefObject, + useEffect, + useLayoutEffect, + useRef, + useState, +} from 'react'; + +import { + matchesReducedMotion, + usePrefersReducedMotion, +} from './use-prefers-reduced-motion'; + +// useLayoutEffect warns on the server; it never runs there anyway. +const useIsomorphicLayoutEffect = + typeof window === 'undefined' ? useEffect : useLayoutEffect; + +/** + * Scroll progress of an element, as the mockup computes it: -1 while its top + * sits below 80% of the viewport, then 0 to 1 over the next half viewport. + */ +export function scrollStepProgress(top: number, viewportHeight: number) { + const progress = (viewportHeight * 0.8 - top) / (viewportHeight * 0.5); + if (progress < 0) return -1; + return Math.min(progress, 1); +} + +/** Number of thresholds, sorted ascending, that `progress` has reached. */ +export function countReached(thresholds: readonly number[], progress: number) { + return thresholds.filter((threshold) => progress >= threshold).length; +} + +type UseScrollStepsResult = { + ref: RefObject; + /** + * How many steps are shown, or null when every step shows: on the server, + * under reduced motion, and before hydration. + */ + reached: number | null; + /** + * False until the first measure has painted, so the steps the visitor + * cannot reach yet are hidden at once instead of fading out. + */ + animate: boolean; +}; + +/** + * Reveals steps one by one as the visitor scrolls an element into view, and + * hides them again when scrolling back up (the mockup `#ia8` scrub). + * `thresholds` must be sorted ascending and keep the same values. + */ +export function useScrollSteps( + thresholds: readonly number[], +): UseScrollStepsResult { + const ref = useRef(null); + const [reached, setReached] = useState(null); + const [animate, setAnimate] = useState(false); + const prefersReducedMotion = usePrefersReducedMotion(); + const thresholdsRef = useRef(thresholds); + + useIsomorphicLayoutEffect(() => { + const element = ref.current; + if (!element || prefersReducedMotion || matchesReducedMotion()) { + setReached(null); + return; + } + + let frame = 0; + const update = () => { + frame = 0; + const progress = scrollStepProgress( + element.getBoundingClientRect().top, + window.innerHeight, + ); + setReached(countReached(thresholdsRef.current, progress)); + }; + const onScroll = () => { + if (!frame) frame = window.requestAnimationFrame(update); + }; + + update(); + const settle = window.requestAnimationFrame(() => setAnimate(true)); + window.addEventListener('scroll', onScroll, { passive: true }); + window.addEventListener('resize', onScroll); + return () => { + window.removeEventListener('scroll', onScroll); + window.removeEventListener('resize', onScroll); + window.cancelAnimationFrame(settle); + if (frame) window.cancelAnimationFrame(frame); + }; + }, [prefersReducedMotion]); + + return { ref, reached, animate }; +} diff --git a/preset/keyframes.ts b/preset/keyframes.ts index 5181b4e2..840176f5 100644 --- a/preset/keyframes.ts +++ b/preset/keyframes.ts @@ -147,4 +147,43 @@ export const keyframes = defineKeyframes({ '0%': { transform: 'scale(1)', opacity: '0.8' }, '100%': { transform: 'scale(2.5)', opacity: '0' }, }, + // Mission illustration (the mockup `#mission`): on appearance the shapes pop, + // the windows rise, then their content grows and the wave draws itself. + 'il-pop': { + from: { opacity: '0', scale: '0.3' }, + to: { opacity: '1', scale: '1' }, + }, + 'il-up': { + from: { opacity: '0', transform: 'translateY(48px)' }, + to: { opacity: '1', transform: 'none' }, + }, + 'il-x': { + from: { transform: 'scaleX(0)' }, + to: { transform: 'scaleX(1)' }, + }, + 'il-y': { + from: { transform: 'scaleY(0)' }, + to: { transform: 'scaleY(1)' }, + }, + 'il-pie': { + from: { opacity: '0', transform: 'rotate(-120deg) scale(0.5)' }, + to: { opacity: '1', transform: 'none' }, + }, + 'il-draw': { + from: { strokeDashoffset: '1' }, + to: { strokeDashoffset: '0' }, + }, + 'il-fade': { + from: { opacity: '0' }, + to: { opacity: '1' }, + }, + // Agent windows of the home AI block: the typing dots bounce, then + // collapse once the message arrives. + 'typing-dot': { + '0%, 100%': { opacity: '0.3', transform: 'none' }, + '50%': { opacity: '1', transform: 'translateY(-2px)' }, + }, + 'typing-hide': { + to: { height: '0', margin: '0', opacity: '0', overflow: 'hidden' }, + }, }); diff --git a/preset/tokens/index.ts b/preset/tokens/index.ts index b1e36499..257aa332 100644 --- a/preset/tokens/index.ts +++ b/preset/tokens/index.ts @@ -85,6 +85,8 @@ export const tokens = defineTokens({ 'float-cursor': { value: 'float-cursor 5s infinite ease-in-out' }, 'float-very-slow': { value: 'float-very-slow 12s ease-in-out infinite' }, 'float-gentle': { value: 'float-gentle 8s ease-in-out infinite' }, + // One bounce: the dots collapse 0.9s after the window shows (`typing-hide`). + 'typing-dot': { value: 'typing-dot 1s ease-in-out' }, 'float-grid': { value: 'float-grid 6s ease-in-out infinite' }, 'float-blob': { value: 'float-blob 12s infinite ease-in-out' }, 'slow-fade': { value: 'slow-fade 6s infinite ease-in-out' }, From d294475ee8c22a99d076a754c7d2e69572fb19f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 15:39:54 +0100 Subject: [PATCH 3/5] fix(challenges): send the hero CTA to the contact page The hero CTA scrolled to the diagnostic block at the bottom of the page. It now links to the localised contact page, and shows even when the page has no diagnostic block. --- .../challenges/challenge-diagnostic.tsx | 2 +- .../challenges/challenge-hero.test.tsx | 1 - app/components/challenges/challenge-hero.tsx | 19 ++++++++++--------- .../_main.($lang).challenges.$slug.test.tsx | 10 +++++----- app/routes/_main.($lang).challenges.$slug.tsx | 1 - 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/components/challenges/challenge-diagnostic.tsx b/app/components/challenges/challenge-diagnostic.tsx index 14918355..be9c706a 100644 --- a/app/components/challenges/challenge-diagnostic.tsx +++ b/app/components/challenges/challenge-diagnostic.tsx @@ -7,7 +7,7 @@ import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; import type { ChallengeDiagnostic as ChallengeDiagnosticData } from '~/modules/challenge-page'; import { url } from '~/utils/url'; -/** Anchor of the block, the target of the hero CTA. */ +/** Anchor of the block, the target of the experts CTA. */ export const DIAGNOSTIC_ID = 'diagnostic'; type ChallengeDiagnosticProps = { diff --git a/app/components/challenges/challenge-hero.test.tsx b/app/components/challenges/challenge-hero.test.tsx index d3ed4db8..5d08105c 100644 --- a/app/components/challenges/challenge-hero.test.tsx +++ b/app/components/challenges/challenge-hero.test.tsx @@ -27,7 +27,6 @@ function renderHero(data: ChallengeHeroData, challenge: 'sc' | 'ai') { challenge={challenge} name="Sales Compensation" order={3} - hasDiagnostic={false} hasWorkstreams={false} />, { i18nLang: 'en' }, diff --git a/app/components/challenges/challenge-hero.tsx b/app/components/challenges/challenge-hero.tsx index 239795fd..aa0fef73 100644 --- a/app/components/challenges/challenge-hero.tsx +++ b/app/components/challenges/challenge-hero.tsx @@ -7,10 +7,12 @@ import { button, section, text } from '@ocobo/styled-system/recipes'; import { UnifiedBowtie } from '~/components/method/unified-bowtie'; import { Container } from '~/components/ui/Container'; +import { ButtonLink } from '~/components/ui/button-link'; +import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; import type { ChallengeHero as ChallengeHeroData } from '~/modules/challenge-page'; import type { ChallengeKey } from '~/modules/challenge-schema'; +import { url } from '~/utils/url'; -import { DIAGNOSTIC_ID } from './challenge-diagnostic'; import { challengeHeadlineAccent } from './challenge-palette'; import { challengePill } from './challenge-pill'; import { WORKSTREAMS_ID } from './challenge-workstreams'; @@ -27,8 +29,6 @@ type ChallengeHeroProps = { challenge: ChallengeKey; name: string; order: number; - /** Shows the CTA, which scrolls to the diagnostic block. */ - hasDiagnostic: boolean; /** Shows the secondary CTA, which scrolls to the workstreams. */ hasWorkstreams: boolean; }; @@ -38,12 +38,12 @@ export function ChallengeHero({ challenge, name, order, - hasDiagnostic, hasWorkstreams, }: ChallengeHeroProps) { const { t } = useTranslation('challenges'); const titleId = useId(); - const showCta = hero.cta !== null && hasDiagnostic; + const getLocalizedPath = useLocalizedPathname(); + const showCta = hero.cta !== null; return (
      {showCta ? ( - {hero.cta} + ) : null} {hasWorkstreams ? ( { name: 'Make my forecast reliable', }); expect(ctas.map((cta) => cta.getAttribute('href'))).toEqual([ - '#diagnostic', + '/en/contact', '/en/contact', ]); }); @@ -434,7 +434,7 @@ describe('challenge page', () => { expect(screen.queryByText('[Step]')).not.toBeInTheDocument(); }); - it('drops the hero CTA when the diagnostic block is absent', () => { + it('keeps the hero CTA on the contact page when the diagnostic block is absent', () => { const { frontmatter } = fixture; renderPage({ ...frontmatter, @@ -443,10 +443,10 @@ describe('challenge page', () => { expect(document.getElementById('diagnostic')).toBeNull(); expect( - screen.queryByRole('link', { name: 'Make my forecast reliable' }), - ).not.toBeInTheDocument(); + screen.getByRole('link', { name: 'Make my forecast reliable' }), + ).toHaveAttribute('href', '/en/contact'); expect(screen.queryByText('[Question]')).not.toBeInTheDocument(); - // The workstreams CTA stays, alone and secondary. + // The workstreams CTA stays, secondary. expect(screen.getByRole('link', { name: 'What we build' })).toHaveAttribute( 'href', '#chantiers', diff --git a/app/routes/_main.($lang).challenges.$slug.tsx b/app/routes/_main.($lang).challenges.$slug.tsx index ca48c9a7..0b34d157 100644 --- a/app/routes/_main.($lang).challenges.$slug.tsx +++ b/app/routes/_main.($lang).challenges.$slug.tsx @@ -111,7 +111,6 @@ export default function ChallengeRoute() { challenge={page.key} name={page.name} order={page.order} - hasDiagnostic={page.diagnostic !== null} hasWorkstreams={page.workstreams !== null} /> {page.symptoms ? ( From 2d2be225577b60c030082ac7f0eacf1d42b8caf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 15:48:34 +0100 Subject: [PATCH 4/5] refactor(cta): send every architect CTA to the contact page in the current language - New ContactCta component: a button that opens the localised contact page. - The home hero, challenges and why-Ocobo CTAs used to scroll to the diagnostic block. They now open the contact page. - The challenge hero and diagnostic CTAs use the component. The challenge hero no longer shows two arrows. - ButtonLink hides its arrow from screen readers. --- .../challenges/challenge-diagnostic.tsx | 14 +------ app/components/challenges/challenge-hero.tsx | 17 +------- app/components/home/challenges-section.tsx | 10 ++--- app/components/home/comparatif-section.tsx | 11 ++--- app/components/home/home-hero.tsx | 12 ++---- app/components/ui/button-link.tsx | 2 +- app/components/ui/contact-cta.test.tsx | 31 ++++++++++++++ app/components/ui/contact-cta.tsx | 42 +++++++++++++++++++ e2e/homepage.spec.ts | 4 +- 9 files changed, 91 insertions(+), 52 deletions(-) create mode 100644 app/components/ui/contact-cta.test.tsx create mode 100644 app/components/ui/contact-cta.tsx diff --git a/app/components/challenges/challenge-diagnostic.tsx b/app/components/challenges/challenge-diagnostic.tsx index be9c706a..a1bb8c84 100644 --- a/app/components/challenges/challenge-diagnostic.tsx +++ b/app/components/challenges/challenge-diagnostic.tsx @@ -2,10 +2,8 @@ import { css, cx } from '@ocobo/styled-system/css'; import { section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; -import { ButtonLink } from '~/components/ui/button-link'; -import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; +import { ContactCta } from '~/components/ui/contact-cta'; import type { ChallengeDiagnostic as ChallengeDiagnosticData } from '~/modules/challenge-page'; -import { url } from '~/utils/url'; /** Anchor of the block, the target of the experts CTA. */ export const DIAGNOSTIC_ID = 'diagnostic'; @@ -20,8 +18,6 @@ export function ChallengeDiagnostic({ diagnostic, fallbackCta, }: ChallengeDiagnosticProps) { - const getLocalizedPath = useLocalizedPathname(); - return (
      ) : null} - - {diagnostic.cta ?? fallbackCta} - + {diagnostic.cta ?? fallbackCta}
      ); diff --git a/app/components/challenges/challenge-hero.tsx b/app/components/challenges/challenge-hero.tsx index aa0fef73..768f001d 100644 --- a/app/components/challenges/challenge-hero.tsx +++ b/app/components/challenges/challenge-hero.tsx @@ -1,4 +1,3 @@ -import { ArrowRight } from 'lucide-react'; import { useId } from 'react'; import { useTranslation } from 'react-i18next'; @@ -7,11 +6,9 @@ import { button, section, text } from '@ocobo/styled-system/recipes'; import { UnifiedBowtie } from '~/components/method/unified-bowtie'; import { Container } from '~/components/ui/Container'; -import { ButtonLink } from '~/components/ui/button-link'; -import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; +import { ContactCta } from '~/components/ui/contact-cta'; import type { ChallengeHero as ChallengeHeroData } from '~/modules/challenge-page'; import type { ChallengeKey } from '~/modules/challenge-schema'; -import { url } from '~/utils/url'; import { challengeHeadlineAccent } from './challenge-palette'; import { challengePill } from './challenge-pill'; @@ -42,7 +39,6 @@ export function ChallengeHero({ }: ChallengeHeroProps) { const { t } = useTranslation('challenges'); const titleId = useId(); - const getLocalizedPath = useLocalizedPathname(); const showCta = hero.cta !== null; return ( @@ -121,16 +117,7 @@ export function ChallengeHero({ justifyContent: 'center', })} > - {showCta ? ( - - {hero.cta} - - ) : null} + {showCta ? {hero.cta} : null} {hasWorkstreams ? (
      - - {t('challenges.start.cta')} - + {t('challenges.start.cta')}
  • diff --git a/app/components/home/comparatif-section.tsx b/app/components/home/comparatif-section.tsx index bee94beb..893b66b0 100644 --- a/app/components/home/comparatif-section.tsx +++ b/app/components/home/comparatif-section.tsx @@ -1,11 +1,11 @@ import { useTranslation } from 'react-i18next'; import { css, cx } from '@ocobo/styled-system/css'; -import { button, section, text } from '@ocobo/styled-system/recipes'; +import { section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; -import { DIAGNOSTIC_ID } from './challenges-section'; import { ComparatifGap } from './comparatif-gap'; /** @@ -44,12 +44,9 @@ export function ComparatifSection() { diff --git a/app/components/home/home-hero.tsx b/app/components/home/home-hero.tsx index e32f7c39..48db97b2 100644 --- a/app/components/home/home-hero.tsx +++ b/app/components/home/home-hero.tsx @@ -1,4 +1,4 @@ -import { ArrowRight, Pause, Play } from 'lucide-react'; +import { Pause, Play } from 'lucide-react'; import { memo } from 'react'; import { Trans, useTranslation } from 'react-i18next'; @@ -6,6 +6,7 @@ import { css, cx } from '@ocobo/styled-system/css'; import { button, section, text } from '@ocobo/styled-system/recipes'; import { Container } from '~/components/ui/Container'; +import { ContactCta } from '~/components/ui/contact-cta'; import { CHALLENGES_ID } from './challenges-section'; import { SETTLED_FRAME, heroFrame } from './home-hero-frame'; @@ -169,14 +170,9 @@ export function HomeHero({ {t('heroV2.cta.challenges')} ) : null} - + {t('heroV2.cta.diagnostic')} - +
    diff --git a/app/components/ui/button-link.tsx b/app/components/ui/button-link.tsx index 98335a08..d2b9ba90 100644 --- a/app/components/ui/button-link.tsx +++ b/app/components/ui/button-link.tsx @@ -24,7 +24,7 @@ export const ButtonLink = ({ return ( {children} - + ); }; diff --git a/app/components/ui/contact-cta.test.tsx b/app/components/ui/contact-cta.test.tsx new file mode 100644 index 00000000..f197f256 --- /dev/null +++ b/app/components/ui/contact-cta.test.tsx @@ -0,0 +1,31 @@ +import { describe, expect, it } from 'vitest'; + +import { render, screen } from '~/test/utils'; + +import { ContactCta } from './contact-cta'; + +describe('ContactCta', () => { + it('opens the French contact page on a French page', async () => { + render(, { + initialEntries: ['/fr/challenges/x'], + path: ':lang/*', + i18nLang: 'fr', + }); + + expect( + await screen.findByRole('link', { name: 'Échanger avec un architecte' }), + ).toHaveAttribute('href', '/fr/contact'); + }); + + it('opens the English contact page on an English page', async () => { + render(Talk to one of us, { + initialEntries: ['/en'], + path: ':lang/*', + i18nLang: 'en', + }); + + expect( + await screen.findByRole('link', { name: 'Talk to one of us' }), + ).toHaveAttribute('href', '/en/contact'); + }); +}); diff --git a/app/components/ui/contact-cta.tsx b/app/components/ui/contact-cta.tsx new file mode 100644 index 00000000..688257d2 --- /dev/null +++ b/app/components/ui/contact-cta.tsx @@ -0,0 +1,42 @@ +import { useTranslation } from 'react-i18next'; + +import type { ButtonVariantProps } from '@ocobo/styled-system/recipes/button'; + +import { useLocalizedPathname } from '~/hooks/useLocalizedPathname'; +import { url } from '~/utils/url'; + +import { ButtonLink } from './button-link'; + +type ContactCtaProps = ButtonVariantProps & { + /** Label of the button; "Talk to an architect" when left out. */ + children?: React.ReactNode; + className?: string; + 'data-testid'?: string; +}; + +/** + * The "Talk to an architect" button. It always opens the contact page in the + * current language, never an anchor further down the page. + */ +export function ContactCta({ + children, + variant = 'primary', + size, + className, + 'data-testid': testId, +}: ContactCtaProps) { + const { t } = useTranslation('common'); + const getLocalizedPath = useLocalizedPathname(); + + return ( + + {children ?? t('navigation.cta')} + + ); +} diff --git a/e2e/homepage.spec.ts b/e2e/homepage.spec.ts index 5a710c64..442c0c27 100644 --- a/e2e/homepage.spec.ts +++ b/e2e/homepage.spec.ts @@ -13,11 +13,11 @@ test.describe('homepage golden path', () => { ).toBeVisible(); }); - test('primary CTA leads to the diagnostic block', async ({ page }) => { + test('primary CTA leads to the contact page', async ({ page }) => { await page.goto('/'); const cta = page.getByTestId('hero-cta'); await expect(cta).toBeVisible(); - await expect(cta).toHaveAttribute('href', '#diagnostic'); + await expect(cta).toHaveAttribute('href', /\/contact$/); await expect(page.getByTestId('diagnostic-cta')).toHaveAttribute( 'href', /\/contact/, From f9a2f1794559078a2f06d30a79884d32f1c8a5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?je=CC=81ro=CC=82me=20boileux?= Date: Mon, 16 Nov 2026 16:03:15 +0100 Subject: [PATCH 5/5] fix(home): make the motion move, and tidy after review - Use transform instead of the preset translate utility, which only sets shadow variables: the illustration hover drift, the AI layer rise and the agent window rows now move. - Respect reduced motion on the illustration hover. - Add ContactCta to the button recipe jsx list so its props are extracted. - Drop the unused hero-reveal keyframe and token. - Update the outdated diagnostic anchor comments. - Test ContactCta on the unprefixed home. --- app/components/home/ai-agent-windows.tsx | 6 +++--- app/components/home/ai-section.tsx | 8 +++++--- app/components/home/challenges-section.tsx | 5 ++++- app/components/home/cta-section.tsx | 2 +- app/components/home/dashboard-illustration.tsx | 17 ++++++++++------- app/components/ui/contact-cta.test.tsx | 8 ++++++++ preset/keyframes.ts | 4 ---- preset/recipes/button.ts | 2 +- preset/tokens/index.ts | 3 --- 9 files changed, 32 insertions(+), 23 deletions(-) diff --git a/app/components/home/ai-agent-windows.tsx b/app/components/home/ai-agent-windows.tsx index 5e92a202..229dd3ef 100644 --- a/app/components/home/ai-agent-windows.tsx +++ b/app/components/home/ai-agent-windows.tsx @@ -38,15 +38,15 @@ type AgentKey = keyof typeof STEP_DOTS; // own delay. The transition sits on the shown state only, so hiding after // hydration is instant. const contentWaiting = css({ - '& .pw-s': { opacity: '0', translate: '[0 5px]' }, + '& .pw-s': { opacity: '0', transform: 'translateY(5px)' }, '& .pw-score': { transform: 'scaleX(0)' }, '& .pw-typing': { display: 'none' }, }); const contentShown = css({ '& .pw-s': { opacity: '1', - translate: '[0 0]', - transitionProperty: '[opacity, translate]', + transform: 'none', + transitionProperty: '[opacity, transform]', transitionDuration: 'slower', transitionTimingFunction: 'smooth', }, diff --git a/app/components/home/ai-section.tsx b/app/components/home/ai-section.tsx index ae79707d..9ea9d648 100644 --- a/app/components/home/ai-section.tsx +++ b/app/components/home/ai-section.tsx @@ -169,12 +169,14 @@ const STEP_THRESHOLDS = [0.04, 0.38, 0.7, 0.85] as const; // The transition sits on both states: scrolling back up hides the steps // again, as in the mockup. const step = css({ - transitionProperty: '[opacity, translate]', + transitionProperty: '[opacity, transform]', transitionDuration: '[0.6s, 0.75s]', transitionTimingFunction: 'smooth', }); -const stepHidden = css({ opacity: '0', translate: '[0 28px]' }); -const stepShown = css({ opacity: '1', translate: '[0 0]' }); +// `transform`, not `translate`: the preset maps `translate` to its own +// transform variables, which nothing here reads. +const stepHidden = css({ opacity: '0', transform: 'translateY(28px)' }); +const stepShown = css({ opacity: '1', transform: 'none' }); function stepClass(reached: number | null, animate: boolean, index: number) { if (reached === null) return undefined; diff --git a/app/components/home/challenges-section.tsx b/app/components/home/challenges-section.tsx index b2ab875d..00402c94 100644 --- a/app/components/home/challenges-section.tsx +++ b/app/components/home/challenges-section.tsx @@ -10,7 +10,10 @@ import type { HomeChallengeCard } from '~/modules/home-challenges'; import { HomeChallengeCards } from './home-challenge-cards'; -/** Target of the final call to action, which the start panel links to. */ +/** + * Id of the final call to action. No home link targets it any more, but it + * keeps `/#diagnostic` links from outside working and gives the e2e test hook. + */ export const DIAGNOSTIC_ID = 'diagnostic'; /** Target of the hero's "challenges" call to action. */ diff --git a/app/components/home/cta-section.tsx b/app/components/home/cta-section.tsx index 9b9f9cf2..327119e0 100644 --- a/app/components/home/cta-section.tsx +++ b/app/components/home/cta-section.tsx @@ -17,7 +17,7 @@ interface CtaSectionProps { subtitle?: string; ctaText: string; ctaLink: string; - /** Anchor target, for example the hero's `#diagnostic` link. */ + /** Anchor target, for example `#diagnostic` on the home. */ id?: string; } diff --git a/app/components/home/dashboard-illustration.tsx b/app/components/home/dashboard-illustration.tsx index 056ae15e..df89675a 100644 --- a/app/components/home/dashboard-illustration.tsx +++ b/app/components/home/dashboard-illustration.tsx @@ -16,7 +16,7 @@ const box = css({ maxW: '[580px]', aspectRatio: 'square', '& .il-w': { - transitionProperty: '[translate]', + transitionProperty: '[transform]', transitionDuration: 'slower', transitionTimingFunction: 'smooth', }, @@ -27,12 +27,15 @@ const box = css({ '& .il-bar': { transformOrigin: 'center bottom' }, '& .il-pie': { transformOrigin: 'center' }, '& .il-wave': { strokeDasharray: '1' }, - '&:hover .il-w1': { translate: '[-4px -6px]' }, - '&:hover .il-w2': { translate: '[5px -8px]' }, - '&:hover .il-w3': { translate: '[6px 4px]' }, - '&:hover .il-w4': { translate: '[0 -5px]' }, - '&:hover .il-w5': { translate: '[-5px 3px]' }, - '&:hover .il-s': { scale: '[1.08]' }, + // No hover drift under reduced motion. + _motionSafe: { + '&:hover .il-w1': { transform: 'translate(-4px, -6px)' }, + '&:hover .il-w2': { transform: 'translate(5px, -8px)' }, + '&:hover .il-w3': { transform: 'translate(6px, 4px)' }, + '&:hover .il-w4': { transform: 'translate(0px, -5px)' }, + '&:hover .il-w5': { transform: 'translate(-5px, 3px)' }, + '&:hover .il-s': { scale: '[1.08]' }, + }, }); const waiting = css({ '& .il-s, & .il-w': { opacity: '0' } }); diff --git a/app/components/ui/contact-cta.test.tsx b/app/components/ui/contact-cta.test.tsx index f197f256..2b2a73a7 100644 --- a/app/components/ui/contact-cta.test.tsx +++ b/app/components/ui/contact-cta.test.tsx @@ -17,6 +17,14 @@ describe('ContactCta', () => { ).toHaveAttribute('href', '/fr/contact'); }); + it('opens the French contact page on the unprefixed home', async () => { + render(, { initialEntries: ['/'], i18nLang: 'fr' }); + + expect( + await screen.findByRole('link', { name: 'Échanger avec un architecte' }), + ).toHaveAttribute('href', '/fr/contact'); + }); + it('opens the English contact page on an English page', async () => { render(Talk to one of us, { initialEntries: ['/en'], diff --git a/preset/keyframes.ts b/preset/keyframes.ts index 840176f5..4a6a8c64 100644 --- a/preset/keyframes.ts +++ b/preset/keyframes.ts @@ -69,10 +69,6 @@ export const keyframes = defineKeyframes({ from: { opacity: '0', transform: 'translateY(15px)' }, to: { opacity: '1', transform: 'translateY(0)' }, }, - 'hero-reveal': { - from: { opacity: '0', transform: 'translateY(15px)' }, - to: { opacity: '1', transform: 'translateY(0)' }, - }, 'gentle-reveal': { '0%': { opacity: '0', transform: 'translateY(10px)' }, '100%': { opacity: '1', transform: 'translateY(0)' }, diff --git a/preset/recipes/button.ts b/preset/recipes/button.ts index e2a6e604..8deb3138 100644 --- a/preset/recipes/button.ts +++ b/preset/recipes/button.ts @@ -3,7 +3,7 @@ import { defineRecipe } from '@pandacss/dev'; export const button = defineRecipe({ className: 'button', description: 'Button component styles', - jsx: ['ButtonLink'], + jsx: ['ButtonLink', 'ContactCta'], base: { display: 'inline-flex', alignItems: 'center', diff --git a/preset/tokens/index.ts b/preset/tokens/index.ts index 257aa332..6961de51 100644 --- a/preset/tokens/index.ts +++ b/preset/tokens/index.ts @@ -97,9 +97,6 @@ export const tokens = defineTokens({ value: 'fade-in-up-small 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', }, - 'hero-reveal': { - value: 'hero-reveal 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', - }, 'gentle-reveal': { value: 'gentle-reveal 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards', },