Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): clean up homepage heading outline (#454)

Genere5992e16f185
diff --git a/scripts/ci/e2e-shards.mjs b/scripts/ci/e2e-shards.mjs
index f7705f7cb..0432a30ea 100644
--- a/scripts/ci/e2e-shards.mjs
+++ b/scripts/ci/e2e-shards.mjs
@@ -25,6 +25,7 @@ export const SPEC_SECONDS = {
"16-jump-to-present.spec.ts": 30,
"17-forum-sidebar-stage-b.spec.ts": 35,
"18-new-divider-scroll.spec.ts": 46,
+ "19-marketing-seo.spec.ts": 5,
}
function walk(directory) {
diff --git a/scripts/ci/e2e-shards.test.ts b/scripts/ci/e2e-shards.test.ts
index 153f83ef7..430f5fdf8 100644
--- a/scripts/ci/e2e-shards.test.ts
+++ b/scripts/ci/e2e-shards.test.ts
@@ -37,7 +37,7 @@ describe("planE2eShards", () => {
expect(first).toHaveLength(E2E_SHARD_COUNT)
expect([...assigned].sort()).toEqual(specs)
expect(new Set(assigned).size).toBe(specs.length)
- expect(totals.sort((left, right) => left - right)).toEqual([118, 121, 121, 122, 126])
+ expect(totals.sort((left, right) => left - right)).toEqual([121, 121, 122, 123, 126])
expect(Math.max(...totals) / Math.min(...totals)).toBeLessThanOrEqual(1.15)
})
diff --git a/src/web/lighthouserc.json b/src/web/lighthouserc.json
index e42a560f6..53e15834f 100644
--- a/src/web/lighthouserc.json
+++ b/src/web/lighthouserc.json
@@ -12,7 +12,7 @@
},
"assert": {
"assertions": {
- "categories:seo": ["error", { "minScore": 0.9 }],
+ "categories:seo": ["error", { "minScore": 1 }],
"categories:accessibility": ["warn", { "minScore": 0.8 }],
"categories:best-practices": ["warn", { "minScore": 0.8 }]
}
diff --git a/src/web/src/components/community/dm-header.tsx b/src/web/src/components/community/dm-header.tsx
index 96be6d87d..fec8baef8 100644
--- a/src/web/src/components/community/dm-header.tsx
+++ b/src/web/src/components/community/dm-header.tsx
@@ -4,9 +4,10 @@ import { Skeleton } from "@/components/ui/skeleton"
import { Avatar } from "./avatar"
import type { DM } from "./_types"
-export function DmHeader({ dm, onBack }: {
+export function DmHeader({ dm, onBack, titleAs: Title = "h1" }: {
dm: DM
onBack?: () => void
+ titleAs?: "h1" | "div"
}) {
return (
<header className="flex h-12 shrink-0 items-center gap-2 border-b border-border/40 px-3">
@@ -14,14 +15,14 @@ export function DmHeader({ dm, onBack }: {
<Button variant="ghost" size="icon-sm" onClick={onBack} className="text-muted-foreground hover:text-foreground" aria-label="Back"><ChevronLeft className="size-5" /></Button>
)}
<Avatar label={dm.avatar} seed={dm.userId} size={24} presence={dm.status} />
- <h1 className="min-w-0 truncate text-base font-medium">
+ <Title className="min-w-0 truncate font-heading text-base font-medium leading-[1.15] tracking-[-0.015em]">
{dm.name}
{dm.discriminator && (
<span className="ml-1 text-xs font-normal tracking-wide text-muted-foreground">
#{dm.discriminator}
</span>
)}
- </h1>
+ </Title>
</header>
)
}
diff --git a/src/web/src/components/community/machines/pair-machine-sheet.tsx b/src/web/src/components/community/machines/pair-machine-sheet.tsx
index dcd0c9238..2b704d131 100644
--- a/src/web/src/components/community/machines/pair-machine-sheet.tsx
+++ b/src/web/src/components/community/machines/pair-machine-sheet.tsx
@@ -150,6 +150,7 @@ export function PairMachineSteps({
step2MotionTarget,
step1ClassName,
step2ClassName,
+ headingAs = "h3",
}: {
command: string
generating: boolean
@@ -159,14 +160,15 @@ export function PairMachineSteps({
step2MotionTarget?: string
step1ClassName?: string
step2ClassName?: string
+ headingAs?: "h3" | "div"
}) {
return (
<>
<div data-motion-target={step1MotionTarget} className={step1ClassName}>
- <Step1 command={command} generating={generating} onCopy={onCopy} />
+ <Step1 command={command} generating={generating} onCopy={onCopy} headingAs={headingAs} />
</div>
<div data-motion-target={step2MotionTarget} className={step2ClassName}>
- <Step2 ready={Boolean(command)} connectedHostname={connectedHostname} />
+ <Step2 ready={Boolean(command)} connectedHostname={connectedHostname} headingAs={headingAs} />
</div>
</>
)
@@ -176,16 +178,20 @@ function Step1({
command,
generating,
onCopy,
+ headingAs: Heading,
}: {
command: string
generating: boolean
onCopy: () => void
+ headingAs: "h3" | "div"
}) {
return (
<section className="flex flex-col gap-3">
<header className="flex items-center gap-2">
<Marker n={1} done={!generating} />
- <h3 className="text-sm font-medium text-foreground">Run this on your machine</h3>
+ <Heading className="font-heading text-sm font-medium leading-tight tracking-[-0.015em] text-foreground">
+ Run this on your machine
+ </Heading>
</header>
<p className="text-sm text-muted-foreground">
Open a terminal on the computer you want to connect, paste the command,
@@ -218,16 +224,20 @@ function Step1({
function Step2({
ready,
connectedHostname,
+ headingAs: Heading,
}: {
ready: boolean
connectedHostname: string | null
+ headingAs: "h3" | "div"
}) {
if (connectedHostname) {
return (
<section className="flex flex-col gap-3">
<header className="flex items-center gap-2">
<Marker n={2} done />
- <h3 className="text-sm font-medium text-foreground">Connected</h3>
+ <Heading className="font-heading text-sm font-medium leading-tight tracking-[-0.015em] text-foreground">
+ Connected
+ </Heading>
</header>
<div className="flex flex-col gap-1 text-sm">
<span className="flex items-center gap-2">
@@ -245,14 +255,14 @@ function Step2({
<section className="flex flex-col gap-3">
<header className="flex items-center gap-2">
<Marker n={2} muted={!ready} spinning={ready} />
- <h3
+ <Heading
className={[
- "text-sm font-medium",
+ "font-heading text-sm font-medium leading-tight tracking-[-0.015em]",
ready ? "text-foreground" : "text-muted-foreground",
].join(" ")}
>
Waiting for the daemon…
- </h3>
+ </Heading>
</header>
</section>
)
diff --git a/src/web/src/components/home/landing-content.test.ts b/src/web/src/components/home/landing-content.test.ts
index cdeac53dd..2b1afe1ce 100644
--- a/src/web/src/components/home/landing-content.test.ts
+++ b/src/web/src/components/home/landing-content.test.ts
@@ -107,6 +107,29 @@ describe("landing content contract", () => {
expect(landingStyles).not.toMatch(/\.footer\s*\{[\s\S]*?border-top:/)
})
+ it("keeps product-demo labels out of the homepage heading tree", () => {
+ const root = webRoot()
+ const shellSource = readFileSync(path.join(root, "src/components/home/landing-shell-motion.tsx"), "utf8")
+ const dmHeaderSource = readFileSync(path.join(root, "src/components/community/dm-header.tsx"), "utf8")
+ const pairMachineSource = readFileSync(
+ path.join(root, "src/components/community/machines/pair-machine-sheet.tsx"),
+ "utf8",
+ )
+
+ expect(shellSource).not.toMatch(/<h[1-6]\b/)
+ expect(shellSource.match(/<DmHeader dm=\{DMS\[0\]\} titleAs="div" \/>/g)).toHaveLength(2)
+ expect(shellSource).toContain('headingAs="div"')
+ expect(dmHeaderSource).toContain('titleAs: Title = "h1"')
+ expect(pairMachineSource).toContain('headingAs = "h3"')
+ })
+
+ it("requires every Lighthouse SEO audit to pass", () => {
+ const root = webRoot()
+ const config = JSON.parse(readFileSync(path.join(root, "lighthouserc.json"), "utf8"))
+
+ expect(config.ci.assert.assertions["categories:seo"]).toEqual(["error", { minScore: 1 }])
+ })
+
it("promotes the approved landing while preserving the legacy route", () => {
const root = webRoot()
const rootRoute = readFileSync(path.join(root, "src/app/page.tsx"), "utf8")
diff --git a/src/web/src/components/home/landing-shell-motion.tsx b/src/web/src/components/home/landing-shell-motion.tsx
index bc5b316bf..d61ab6db8 100644
--- a/src/web/src/components/home/landing-shell-motion.tsx
+++ b/src/web/src/components/home/landing-shell-motion.tsx
@@ -1218,7 +1218,7 @@ function ContinuityScene({ snapshot }: { snapshot: SceneSnapshot }) {
if (snapshot.beat < 7) {
return (
<>
- <DmHeader dm={DMS[0]} />
+ <DmHeader dm={DMS[0]} titleAs="div" />
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
<div className="flex-1 overflow-hidden px-4 py-3">
{CONTINUITY_DM_MESSAGES.map((message, index) => (
@@ -1292,7 +1292,9 @@ function PrototypeInviteSurface({ snapshot }: { snapshot: SceneSnapshot }) {
className={styles.inviteSurface}
>
<header className="border-b border-border/50 px-4 py-3">
- <h2 className="truncate text-sm font-semibold">Invite friends to Home</h2>
+ <div className="truncate font-heading text-sm font-semibold leading-[1.2] tracking-[-0.015em]">
+ Invite friends to Home
+ </div>
</header>
<div className="px-4 pt-3">
<label className="relative block">
@@ -1426,7 +1428,9 @@ function MachineScene({
</div>
</div>
<div className="flex flex-col gap-1">
- <h2 className="text-lg font-medium text-foreground">No machines yet</h2>
+ <div className="font-heading text-lg font-medium leading-[1.2] tracking-[-0.015em] text-foreground">
+ No machines yet
+ </div>
<p className="max-w-md text-sm text-muted-foreground">
{introDescription ?? (
<>
@@ -1455,7 +1459,9 @@ function MachineScene({
>
<header className="flex items-center justify-between">
<div>
- <h1 className="text-xl font-medium text-foreground">Machines</h1>
+ <div className="font-heading text-xl font-medium leading-[1.15] tracking-[-0.015em] text-foreground">
+ Machines
+ </div>
<p className="text-sm text-muted-foreground">
Your computers running the alook daemon.
</p>
@@ -1486,7 +1492,9 @@ function MachineScene({
<PrototypeSheet label="Connect a machine" open={pairOpen}>
<SheetHeader>
- <h2 className="font-heading text-lg leading-tight font-semibold">Connect a machine</h2>
+ <div className="font-heading text-lg leading-tight font-semibold tracking-[-0.015em]">
+ Connect a machine
+ </div>
</SheetHeader>
<SheetBody className="flex flex-col gap-6">
<PairMachineSteps
@@ -1498,6 +1506,7 @@ function MachineScene({
step2MotionTarget={step2Target}
step1ClassName={targetClass(snapshot, "pair-step-1")}
step2ClassName={targetClass(snapshot, step2Target)}
+ headingAs="div"
/>
</SheetBody>
<SheetFooter>
@@ -1550,7 +1559,9 @@ function ProviderScene({ snapshot }: { snapshot: SceneSnapshot }) {
className={`${styles.stateLayer} flex min-w-0 flex-col gap-6 overflow-hidden p-6`}
>
<header>
- <h1 className="text-xl font-medium text-foreground">My Bots</h1>
+ <div className="font-heading text-xl font-medium leading-[1.15] tracking-[-0.015em] text-foreground">
+ My Bots
+ </div>
</header>
<div className="max-w-lg">
<BotCard
@@ -1566,7 +1577,7 @@ function ProviderScene({ snapshot }: { snapshot: SceneSnapshot }) {
data-visible={dmOpen}
className={`${styles.stateLayer} flex min-w-0 flex-col overflow-hidden`}
>
- <DmHeader dm={DMS[0]} />
+ <DmHeader dm={DMS[0]} titleAs="div" />
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
<div className="flex-1 overflow-hidden px-4 py-3">
{DM_MESSAGES.map((message, index) => (
@@ -1595,7 +1606,7 @@ function ProviderScene({ snapshot }: { snapshot: SceneSnapshot }) {
<PrototypeSheet label="Edit Alli" open={sheetOpen}>
<SheetHeader>
- <h2 className="font-heading text-lg leading-tight font-semibold">Edit Alli</h2>
+ <div className="font-heading text-lg leading-tight font-semibold tracking-[-0.015em]">Edit Alli</div>
</SheetHeader>
<SheetBody ref={sheetBodyRef} className="flex flex-col gap-6">
<BotFormFields
diff --git a/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts b/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts
new file mode 100644
index 000000000..5e96a524f
--- /dev/null
+++ b/src/web/src/test/e2e-ui/19-marketing-seo.spec.ts
@@ -0,0 +1,16 @@
+import { expect, test } from "@playwright/test"
+
+test("homepage SSR keeps product demos out of the heading tree", async ({ page, request }) => {
+ const response = await request.get("/")
+
+ expect(response.ok()).toBe(true)
+ const counts = await page.evaluate((html) => {
+ const document = new DOMParser().parseFromString(html, "text/html")
+ return {
+ h1: document.querySelectorAll("h1").length,
+ demoHeadings: document.querySelectorAll('[role="img"] :is(h1, h2, h3, h4, h5, h6)').length,
+ }
+ }, await response.text())
+
+ expect(counts).toEqual({ h1: 1, demoHeadings: 0 })
+})