Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | 2x 2x 2x 2x 2x 2x 2x 3x 3x 3x 3x 1x 1x 1x 3x 9x 18x 12x 6x 9x 9x | import type { ComponentType, CSSProperties, ReactNode } from 'react'
import { useTranslation } from 'react-i18next'
import { Link, useNavigate } from 'react-router-dom'
import { toast } from 'sonner'
import { demoStartErrorKey, useStartDemoSession } from '@/features/auth/api/auth.hooks'
import { cn } from '@/lib/utils'
import { ServerWakingNotice } from '@/shared/components/ServerWakingNotice'
import { PlayIcon } from '@/shared/icons/play-icon'
import { SpinnerIcon } from '@/shared/icons/spinner-icon'
import { PortfolioStrip } from '@/shared/components/PortfolioStrip'
import { ProductPreviewCard } from '@/shared/components/ProductPreviewCard'
import { PublicHeaderBar } from '@/shared/components/PublicHeaderBar'
import { BookIcon } from '@/shared/icons/book-icon'
import { CheckIcon } from '@/shared/icons/check-icon'
import { CodeIcon } from '@/shared/icons/code-icon'
import type { IconProps } from '@/shared/icons/icon-base'
import { GrowthIcon } from '@/shared/icons/growth-icon'
import { PillIcon } from '@/shared/icons/pill-icon'
import { SparkleIcon } from '@/shared/icons/sparkle-icon'
import { StethoscopeIcon } from '@/shared/icons/stethoscope-icon'
import { SyringeIcon } from '@/shared/icons/syringe-icon'
import { UsersIcon } from '@/shared/icons/users-icon'
import { API_SOURCE_URL, DESIGN_SYSTEM_URL, SOURCE_URL } from '@/shared/portfolio-links'
import { PUBLIC_CONTAINER as CONTAINER } from '@/shared/public-layout'
import { ScheduleWidgetShowcase } from './ScheduleWidgetShowcase'
import './landing.css'
const EYEBROW = 'mb-3.5 text-xs font-semibold tracking-[0.1em] text-auth-action uppercase'
const SECTION_TITLE = 'font-display text-[30px] leading-[1.15] font-medium tracking-[-0.025em] text-balance text-ink md:text-4xl'
const PRIMARY_ACTION =
'inline-flex h-12 items-center justify-center rounded-xl bg-auth-button px-[22px] text-[15px] font-semibold text-white transition-colors hover:bg-auth-button-hover focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none'
const SECONDARY_ACTION =
'inline-flex h-12 items-center justify-center rounded-xl border border-border bg-card px-[22px] text-[15px] font-semibold text-ink transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none'
// The code a host pastes, shown as code: not translated, and kept in step with
// embed/README.md by hand because a page is not a place to import a contract from.
const EMBED_SNIPPET_LINES = [
['<div', ' id=', '"vacinas"', '></div>'],
['<script', ' src=', '"https://cygnus.samuelsantana.dev/embed/embed.js"', ''],
[' ', ' data-target=', '"#vacinas"', ' defer></script>'],
] as const
interface Feature {
key: 'vaccines' | 'appointments' | 'growth' | 'milestones' | 'medications' | 'family'
Icon: ComponentType<IconProps>
tone: string
}
// Each area keeps the colour it has inside the app, so the page introduces the
// map the product uses rather than a palette of its own.
const FEATURES: Feature[] = [
{ key: 'vaccines', Icon: SyringeIcon, tone: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300' },
{ key: 'appointments', Icon: StethoscopeIcon, tone: 'bg-violet-50 text-violet-700 dark:bg-violet-500/15 dark:text-violet-200' },
{ key: 'growth', Icon: GrowthIcon, tone: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300' },
{ key: 'milestones', Icon: SparkleIcon, tone: 'bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300' },
{ key: 'medications', Icon: PillIcon, tone: 'bg-sky-50 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300' },
{ key: 'family', Icon: UsersIcon, tone: 'bg-violet-50 text-violet-700 dark:bg-violet-500/15 dark:text-violet-200' },
]
const INSIDE_ITEMS = ['a11y', 'contract', 'session', 'widget'] as const
interface LandingPageProps {
/** Passed through to the widget; stories pass `null` (see ScheduleWidgetShowcase). */
widgetScriptSrc?: string | null
/**
* The visitor is inside a demo already (LandingRoute shows this page to a
* demo session, so the browser's back button can return here). The demo
* buttons then go back to it: starting another would throw away what the
* visitor changed and spend one of the ten demos an address gets per hour.
*/
demoActive?: boolean
}
/**
* What `/` shows a visitor with no session: the product, before any form.
*
* Until this page, the CV's link opened straight onto a login screen and
* nothing of the app was visible without an account. The page shows it four
* ways, in the order a stranger needs them: what it is (the hero, with a still
* of the vaccine card), the one part anyone can use without signing up (the
* public widget, running for real), what else it does, and — because the
* audience is often a recruiter — how it is built, with the code one click
* away.
*
* Every claim under "Por dentro" is something the repositories enforce and a
* reader can check; none is a count, because counts drift and nothing would
* update this page when they do.
*/
export function LandingPage({ widgetScriptSrc, demoActive = false }: LandingPageProps) {
const { t } = useTranslation()
const navigate = useNavigate()
const demo = useStartDemoSession()
// Pushed, not replaced: this page stays in the history under the dashboard,
// so the browser's back button returns to it, as a visitor expects.
const openDemo = () => {
Eif (demoActive) {
navigate('/dashboard')
return
}
demo.mutate(undefined, {
onSuccess: () => navigate('/dashboard'),
onError: (error) => toast.error(t(demoStartErrorKey(error))),
})
}
return (
<div className="landing flex min-h-dvh flex-col bg-auth-surface">
<PortfolioStrip />
{/* Sticky and settled by default; landing.css makes it transparent at the
top and settle as the page scrolls, where the browser supports that. */}
<header className="landing-header sticky top-0 z-20 border-b border-border/70 bg-auth-surface/85 shadow-[0_10px_28px_-18px_rgba(26,46,37,0.45)] backdrop-blur-[10px]">
<PublicHeaderBar>
<Link
to="/login"
className="hidden h-10 items-center rounded-[10px] px-3.5 text-sm font-semibold text-ink transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none sm:inline-flex"
>
{t('landing.nav.signIn')}
</Link>
{/* Off below sm (640px), like "Entrar". From 480px it fit in Portuguese,
but "Ver demostración" squeezed the row and the language switcher
moved again; the hero repeats the button a few pixels lower. */}
<button
type="button"
onClick={openDemo}
disabled={demo.isPending}
aria-busy={demo.isPending}
className="hidden h-10 items-center gap-2 rounded-[10px] bg-auth-button px-4 text-sm font-semibold whitespace-nowrap text-white transition-colors hover:bg-auth-button-hover focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none sm:inline-flex"
>
{demo.isPending ? (
<>
<SpinnerIcon className="size-4 animate-spin" />
{t('demo.openingShort')}
</>
) : (
t('demo.start')
)}
</button>
</PublicHeaderBar>
</header>
<main className="flex-1">
<section className={cn(CONTAINER, 'grid gap-10 pt-10 pb-14 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)] lg:items-center lg:gap-14 lg:pt-[72px] lg:pb-[88px]')}>
<div>
<p className={EYEBROW}>{t('landing.hero.eyebrow')}</p>
<h1 className="font-display text-[38px] leading-[1.08] font-medium tracking-[-0.03em] text-balance text-ink md:text-[52px]">
{t('landing.hero.titleLead')} <em className="text-auth-action">{t('landing.hero.titleEmphasis')}</em>
</h1>
<p className="mt-5 max-w-[34rem] text-base leading-relaxed text-ink-muted">{t('landing.hero.subtitle')}</p>
{/* The demo first: the person this page is for wants to see the app,
not to open an account. Sign-up second, on the page itself: it
used to be one screen away, behind "Entrar", and a visitor who
did want an account had nothing here to click. Signing in drops
to a line below, since the header offers it too from 640px. */}
<div className="mt-7 flex flex-wrap gap-2.5">
<button type="button" onClick={openDemo} disabled={demo.isPending} aria-busy={demo.isPending} className={cn(PRIMARY_ACTION, 'gap-2')}>
{demo.isPending ? (
<>
<SpinnerIcon className="size-4 animate-spin" />
{t('demo.opening')}
</>
) : (
<>
<PlayIcon className="size-4" />
{t('demo.start')}
</>
)}
</button>
<Link to="/register" className={SECONDARY_ACTION}>
{t('landing.hero.signUp')}
</Link>
</div>
<div className="max-w-[34rem]">
<ServerWakingNotice active={demo.isPending} />
</div>
<p className="mt-4 text-sm text-ink-muted">
{t('auth.register.hasAccount')}{' '}
<Link
to="/login"
className="rounded-sm font-semibold text-auth-action underline-offset-4 hover:underline focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none"
>
{t('landing.hero.signIn')}
</Link>
</p>
<p className="mt-2 flex items-center gap-2 text-[12.5px] text-ink-muted">
<CheckIcon className="size-3.5 shrink-0 text-auth-action" />
{t('landing.hero.trust')}
</p>
</div>
<div className="flex justify-center pt-3">
<ProductPreviewCard animated />
</div>
</section>
<Section id="calendario" labelledBy="landing-schedule-title">
<div data-reveal className="grid gap-8 lg:grid-cols-2 lg:items-center lg:gap-14">
{/* min-w-0: a grid item will not shrink below its content, and the
snippet's longest line is wider than a phone. Without it the
whole column grew to 490px at 360px and the page scrolled
sideways; with it, only the snippet scrolls. */}
<div className="min-w-0">
<p className={EYEBROW}>{t('landing.schedule.eyebrow')}</p>
<h2 id="landing-schedule-title" className={SECTION_TITLE}>
{t('landing.schedule.title')}
</h2>
<p className="mt-3.5 max-w-[34rem] text-[15px] leading-relaxed text-ink-muted">{t('landing.schedule.body')}</p>
{/* A named, focusable region because it scrolls sideways on a
phone: a region that scrolls has to be reachable without a
mouse, and a tab stop has to say what it is. A bare <pre> is
`generic`, where aria-label is prohibited. */}
<pre
role="region"
tabIndex={0}
aria-label={t('landing.schedule.codeLabel')}
// A light card in the light theme, beside the widget's own white
// card. It was a near-black slab, and on the cream page it was
// the heaviest thing on screen. The token colours are the 700
// steps here (4.8:1 and up on the card) and the 300 steps on the
// dark card.
className="mt-5 overflow-x-auto rounded-xl border border-border bg-card px-4 py-3.5 font-mono text-[12.5px] leading-relaxed text-ink focus-visible:ring-3 focus-visible:ring-emerald-600/40 focus-visible:outline-none"
>
<code>
{EMBED_SNIPPET_LINES.map(([tag, attribute, value, rest], index) => (
<span key={index} className="block">
<span className="text-emerald-700 dark:text-emerald-300">{tag}</span>
{attribute}
<span className="text-amber-700 dark:text-amber-300">{value}</span>
<span className="text-emerald-700 dark:text-emerald-300">{rest}</span>
</span>
))}
</code>
</pre>
<p className="mt-2.5 text-[12.5px] text-ink-muted">{t('landing.schedule.note')}</p>
</div>
<div className="w-full max-w-[26.5rem] justify-self-center lg:justify-self-end">
<ScheduleWidgetShowcase scriptSrc={widgetScriptSrc} />
</div>
</div>
</Section>
<Section labelledBy="landing-features-title">
<div data-reveal>
<p className={EYEBROW}>{t('landing.features.eyebrow')}</p>
<h2 id="landing-features-title" className={SECTION_TITLE}>
{t('landing.features.title')}
</h2>
</div>
<ul className="mt-8 grid gap-3.5 sm:grid-cols-2 lg:grid-cols-3">
{FEATURES.map(({ key, Icon, tone }, index) => (
<li
key={key}
data-reveal
data-reveal-column
// Its column on the three-wide grid, so the cascade runs left to right.
style={{ '--column': index % 3 } as CSSProperties}
className="card-lift rounded-2xl border border-border bg-card p-[18px]"
>
<span className={cn('mb-3 flex size-9 items-center justify-center rounded-xl', tone)}>
<Icon className="size-[18px]" />
</span>
<h3 className="font-display text-[17px] font-medium text-ink">{t(`landing.features.${key}Title`)}</h3>
<p className="mt-1 text-[13.5px] leading-normal text-ink-muted">{t(`landing.features.${key}Body`)}</p>
</li>
))}
</ul>
</Section>
<section aria-labelledby="landing-inside-title" className="bg-auth-panel text-emerald-50">
<div data-reveal className={cn(CONTAINER, 'py-12 md:py-[72px]')}>
<p className="mb-3.5 text-xs font-semibold tracking-[0.1em] text-emerald-300 uppercase">{t('landing.inside.eyebrow')}</p>
<h2
id="landing-inside-title"
className="font-display text-[30px] leading-[1.15] font-medium tracking-[-0.025em] text-balance text-white md:text-4xl"
>
{t('landing.inside.title')}
</h2>
<ul className="mt-7 grid gap-3.5 md:grid-cols-2">
{INSIDE_ITEMS.map((key) => (
<li key={key} className="rounded-[14px] border border-white/12 bg-white/[0.04] px-[18px] py-4">
<h3 className="text-sm font-semibold text-white">{t(`landing.inside.${key}Title`)}</h3>
<p className="mt-1 text-[13px] leading-normal text-emerald-100">{t(`landing.inside.${key}Body`)}</p>
</li>
))}
</ul>
<div className="mt-6 flex flex-wrap gap-2.5">
<InsideLink href={SOURCE_URL} icon={<CodeIcon className="size-4" />}>
{t('landing.inside.appCode')}
</InsideLink>
<InsideLink href={API_SOURCE_URL} icon={<CodeIcon className="size-4" />}>
{t('landing.inside.apiCode')}
</InsideLink>
<InsideLink href={DESIGN_SYSTEM_URL} icon={<BookIcon className="size-4" />}>
{t('landing.inside.designSystem')}
</InsideLink>
</div>
</div>
</section>
</main>
<footer className="px-4 pt-7 pb-8 text-center text-xs leading-5 text-ink-muted">
<p>
<span className="block sm:inline">{t('auth.brand.copyright', { year: new Date().getFullYear() })}</span>
<span aria-hidden="true" className="hidden sm:inline">
{' · '}
</span>
<span className="block sm:inline">{t('auth.brand.footerNote')}</span>
</p>
<p>
<Link to="/privacidade" className="underline-offset-4 hover:underline">
{t('legal.footerPrivacy')}
</Link>
{' · '}
<Link to="/termos" className="underline-offset-4 hover:underline">
{t('legal.footerTerms')}
</Link>
</p>
</footer>
</div>
)
}
function Section({ id, labelledBy, children }: { id?: string; labelledBy: string; children: ReactNode }) {
return (
<section id={id} aria-labelledby={labelledBy} className="border-t border-border/70">
<div className={cn(CONTAINER, 'py-12 md:py-[72px]')}>{children}</div>
</section>
)
}
function InsideLink({ href, icon, children }: { href: string; icon: ReactNode; children: string }) {
const { t } = useTranslation()
return (
<a
href={href}
target="_blank"
rel="noopener noreferrer"
className="inline-flex h-10 items-center gap-2 rounded-[10px] border border-white/25 px-3.5 text-[13.5px] font-semibold text-white transition-colors hover:bg-white/10 focus-visible:ring-3 focus-visible:ring-emerald-300 focus-visible:outline-none"
>
{icon}
{children}
<span className="sr-only"> {t('landing.newTab')}</span>
</a>
)
}
|