Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions app/components/challenges/challenge-diagnostic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ 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 hero CTA. */
/** Anchor of the block, the target of the experts CTA. */
export const DIAGNOSTIC_ID = 'diagnostic';

type ChallengeDiagnosticProps = {
Expand All @@ -20,8 +18,6 @@ export function ChallengeDiagnostic({
diagnostic,
fallbackCta,
}: ChallengeDiagnosticProps) {
const getLocalizedPath = useLocalizedPathname();

return (
<section
id={DIAGNOSTIC_ID}
Expand All @@ -44,13 +40,7 @@ export function ChallengeDiagnostic({
{diagnostic.subtitle}
</p>
) : null}
<ButtonLink
to={getLocalizedPath(url.contact)}
variant="primary"
size="lg"
>
{diagnostic.cta ?? fallbackCta}
</ButtonLink>
<ContactCta size="lg">{diagnostic.cta ?? fallbackCta}</ContactCta>
</Container>
</section>
);
Expand Down
1 change: 0 additions & 1 deletion app/components/challenges/challenge-hero.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function renderHero(data: ChallengeHeroData, challenge: 'sc' | 'ai') {
challenge={challenge}
name="Sales Compensation"
order={3}
hasDiagnostic={false}
hasWorkstreams={false}
/>,
{ i18nLang: 'en' },
Expand Down
18 changes: 3 additions & 15 deletions app/components/challenges/challenge-hero.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ArrowRight } from 'lucide-react';
import { useId } from 'react';
import { useTranslation } from 'react-i18next';

Expand All @@ -7,10 +6,10 @@ import { button, section, text } from '@ocobo/styled-system/recipes';

import { UnifiedBowtie } from '~/components/method/unified-bowtie';
import { Container } from '~/components/ui/Container';
import { ContactCta } from '~/components/ui/contact-cta';
import type { ChallengeHero as ChallengeHeroData } from '~/modules/challenge-page';
import type { ChallengeKey } from '~/modules/challenge-schema';

import { DIAGNOSTIC_ID } from './challenge-diagnostic';
import { challengeHeadlineAccent } from './challenge-palette';
import { challengePill } from './challenge-pill';
import { WORKSTREAMS_ID } from './challenge-workstreams';
Expand All @@ -27,8 +26,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;
};
Expand All @@ -38,12 +35,11 @@ export function ChallengeHero({
challenge,
name,
order,
hasDiagnostic,
hasWorkstreams,
}: ChallengeHeroProps) {
const { t } = useTranslation('challenges');
const titleId = useId();
const showCta = hero.cta !== null && hasDiagnostic;
const showCta = hero.cta !== null;

return (
<section
Expand Down Expand Up @@ -121,15 +117,7 @@ export function ChallengeHero({
justifyContent: 'center',
})}
>
{showCta ? (
<a
href={`#${DIAGNOSTIC_ID}`}
className={button({ variant: 'primary', size: 'lg' })}
>
{hero.cta}
<ArrowRight size={18} aria-hidden="true" />
</a>
) : null}
{showCta ? <ContactCta size="lg">{hero.cta}</ContactCta> : null}
{hasWorkstreams ? (
<a
href={`#${WORKSTREAMS_ID}`}
Expand Down
114 changes: 99 additions & 15 deletions app/components/home/ai-agent-windows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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', transform: 'translateY(5px)' },
'& .pw-score': { transform: 'scaleX(0)' },
'& .pw-typing': { display: 'none' },
});
const contentShown = css({
'& .pw-s': {
opacity: '1',
transform: 'none',
transitionProperty: '[opacity, transform]',
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({
Expand Down Expand Up @@ -133,11 +179,17 @@ function AgentWindow({
children: ReactNode;
}) {
const { t } = useTranslation('home');
const { ref, inView } = useInView<HTMLDivElement>({
rootMargin: '0px',
threshold: 0.45,
});
return (
<Reveal
<div
ref={ref}
className={cx(
'group',
css({ display: 'flex', flexDirection: 'column', gap: '4' }),
inView ? contentShown : contentWaiting,
)}
>
<div className={windowFrame}>
Expand Down Expand Up @@ -208,7 +260,7 @@ function AgentWindow({
{t(`ai.agents.${agent}.caption`)}
</p>
</div>
</Reveal>
</div>
);
}

Expand Down Expand Up @@ -242,7 +294,9 @@ export function AiAgentWindows() {
{accounts.map((account, index) => (
<li
key={account.name}
style={rowDelay(index)}
className={cx(
'pw-s',
divided,
css({
display: 'grid',
Expand All @@ -268,15 +322,23 @@ export function AiAgentWindows() {
>
<span
className={cx(
css({
display: 'block',
h: 'full',
rounded: 'full',
bgGradient: 'ai',
}),
css({ display: 'block', h: 'full' }),
SCORES[index],
)}
/>
>
<span
style={rowDelay(index, 0.2)}
className={cx(
'pw-score',
css({
display: 'block',
h: 'full',
rounded: 'full',
bgGradient: 'ai',
}),
)}
/>
</span>
</span>
<small className={cx(meta, css({ gridColumn: '1' }))}>
{account.signal}
Expand All @@ -289,10 +351,12 @@ export function AiAgentWindows() {
<AgentWindow agent="crm">
<AgentHeader agent="crm" />
<dl>
{fields.map((field) => (
{fields.map((field, index) => (
<div
key={field.name}
style={rowDelay(index)}
className={cx(
'pw-s',
divided,
css({
display: 'flex',
Expand Down Expand Up @@ -348,8 +412,8 @@ export function AiAgentWindows() {
color: 'gray.700',
})}
>
{points.map((point) => (
<li key={point.name}>
{points.map((point, index) => (
<li key={point.name} className="pw-s" style={rowDelay(index)}>
<b className={css({ fontWeight: 'semibold', color: 'dark' })}>
{point.name}
</b>{' '}
Expand Down Expand Up @@ -380,10 +444,30 @@ export function AiAgentWindows() {
{t('ai.agents.insight.meta')}
</small>
</p>
<p className={css({ mt: '1', color: 'gray.700' })}>
<span
aria-hidden="true"
className={cx(
'pw-typing',
css({ display: 'flex', gap: '1', mt: '1.5' }),
)}
>
<i className={typingDot} />
<i className={typingDot} style={{ animationDelay: '0.15s' }} />
<i className={typingDot} style={{ animationDelay: '0.3s' }} />
</span>
<p
className={cx('pw-s', css({ mt: '1', color: 'gray.700' }))}
style={rowDelay(0, 0.7)}
>
{t('ai.agents.insight.message')}
</p>
<div className={css({ display: 'flex', gap: '1.5', mt: '2' })}>
<div
className={cx(
'pw-s',
css({ display: 'flex', gap: '1.5', mt: '2' }),
)}
style={rowDelay(1, 0.7)}
>
{actions.map((action, index) => (
<span
key={action}
Expand Down
Loading
Loading