Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): restore landing palette keyboard and themed previews

Gus9a1b0f9d25be
diff --git a/src/web/.deploy-version b/src/web/.deploy-version
index c52af3e24..413f130df 100644
--- a/src/web/.deploy-version
+++ b/src/web/.deploy-version
@@ -1 +1 @@
-0.1.56
+0.1.56-landing-fix-20261021
diff --git a/src/web/public/landing/posters/continuity-dark.webp b/src/web/public/landing/posters/continuity-dark.webp
new file mode 100644
index 000000000..f009923d0
Binary files /dev/null and b/src/web/public/landing/posters/continuity-dark.webp differ
diff --git a/src/web/public/landing/posters/identity-dark.webp b/src/web/public/landing/posters/identity-dark.webp
new file mode 100644
index 000000000..1f4aba3b2
Binary files /dev/null and b/src/web/public/landing/posters/identity-dark.webp differ
diff --git a/src/web/public/landing/posters/machine-dark.webp b/src/web/public/landing/posters/machine-dark.webp
new file mode 100644
index 000000000..3c523683c
Binary files /dev/null and b/src/web/public/landing/posters/machine-dark.webp differ
diff --git a/src/web/public/landing/posters/mobile-dark.webp b/src/web/public/landing/posters/mobile-dark.webp
new file mode 100644
index 000000000..2c22a98d2
Binary files /dev/null and b/src/web/public/landing/posters/mobile-dark.webp differ
diff --git a/src/web/public/landing/posters/profile-dark.webp b/src/web/public/landing/posters/profile-dark.webp
new file mode 100644
index 000000000..2665c79be
Binary files /dev/null and b/src/web/public/landing/posters/profile-dark.webp differ
diff --git a/src/web/public/landing/posters/server-dark.webp b/src/web/public/landing/posters/server-dark.webp
new file mode 100644
index 000000000..43fd73453
Binary files /dev/null and b/src/web/public/landing/posters/server-dark.webp differ
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index 2696e4b2e..c856cc18f 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -966,12 +966,8 @@ body.driver-active .community-ws-reconnect-overlay * {
overflow: visible;
}
-.hero-artwork[data-static-paper] .tw-body-front {
- transform-style: preserve-3d;
-}
-
-.hero-artwork[data-static-paper] .tw-paper-track {
- transform: translateX(-50%) translateZ(-1px);
+.tw-body > .tw-paper-track {
+ transform: translateX(-50%) translateZ(79px);
}
/* Back face */
diff --git a/src/web/src/components/home/deferred-landing-media.dom.test.tsx b/src/web/src/components/home/deferred-landing-media.dom.test.tsx
index 299dbb59a..2b0d433b5 100644
--- a/src/web/src/components/home/deferred-landing-media.dom.test.tsx
+++ b/src/web/src/components/home/deferred-landing-media.dom.test.tsx
@@ -4,8 +4,8 @@ import { act, fireEvent, render, screen } from "@/test/react-dom-harness"
import { afterEach, describe, expect, it, vi } from "vitest"
import { DeferredLandingMedia } from "./deferred-landing-media"
-const props = { poster: "/landing/posters/server.webp", width: 1120, height: 660 }
-afterEach(() => vi.unstubAllGlobals())
+const props = { poster: "/landing/posters/server.webp", darkPoster: "/landing/posters/server-dark.webp", width: 1120, height: 660 }
+afterEach(() => { vi.unstubAllGlobals(); vi.restoreAllMocks() })
describe("deferred landing media", () => {
it("keeps a dimensioned static image in server HTML without invoking the chunk", () => {
@@ -16,9 +16,10 @@ describe("deferred landing media", () => {
expect(html).toContain('width="1120"')
expect(html).toContain('height="660"')
expect(html).toContain('loading="lazy"')
+ expect(html).toContain(props.darkPoster)
})
- it("loads only on intersection and preserves the poster while the chunk is pending", async () => {
+ it.each([0, 1])("loads only on intersection after poster %s decodes and preserves it while pending", async (posterIndex) => {
let observeCallback: IntersectionObserverCallback = () => undefined
const disconnect = vi.fn()
vi.stubGlobal("IntersectionObserver", class {
@@ -39,7 +40,7 @@ describe("deferred landing media", () => {
await act(async () => observeCallback([{ isIntersecting: true }] as IntersectionObserverEntry[], {} as IntersectionObserver))
expect(load).not.toHaveBeenCalled()
let finishDecode!: () => void
- const image = container.querySelector("img")!
+ const image = container.querySelectorAll("img")[posterIndex]!
Object.defineProperty(image, "decode", { value: () => new Promise<void>((done) => { finishDecode = done }) })
await act(async () => fireEvent.load(image))
expect(load).not.toHaveBeenCalled()
@@ -55,6 +56,26 @@ describe("deferred landing media", () => {
expect(disconnect.mock.calls.length).toBeGreaterThan(1)
})
+ it("activates on intersection when only the dark poster completed before hydration", async () => {
+ vi.spyOn(HTMLImageElement.prototype, "complete", "get").mockImplementation(function (this: HTMLImageElement) {
+ return this.getAttribute("src") === props.darkPoster
+ })
+ let observeCallback: IntersectionObserverCallback = () => undefined
+ vi.stubGlobal("IntersectionObserver", class {
+ constructor(callback: IntersectionObserverCallback) { observeCallback = callback }
+ observe = vi.fn()
+ disconnect = vi.fn()
+ })
+ const load = vi.fn(async () => ({ default: () => <span>Cached dark demo</span> }))
+ const Demo = lazy(load)
+ render(<DeferredLandingMedia {...props}><Demo /></DeferredLandingMedia>)
+ await act(async () => { await Promise.resolve() })
+ expect(load).not.toHaveBeenCalled()
+ await act(async () => observeCallback([{ isIntersecting: true }] as IntersectionObserverEntry[], {} as IntersectionObserver))
+ expect(load).toHaveBeenCalledTimes(1)
+ expect(screen.getByText("Cached dark demo")).toBeTruthy()
+ })
+
it("activates without IntersectionObserver and keeps a poster on chunk failure", async () => {
vi.stubGlobal("IntersectionObserver", undefined)
const error = vi.spyOn(console, "error").mockImplementation(() => undefined)
diff --git a/src/web/src/components/home/deferred-landing-media.module.css b/src/web/src/components/home/deferred-landing-media.module.css
new file mode 100644
index 000000000..0e7ccb326
--- /dev/null
+++ b/src/web/src/components/home/deferred-landing-media.module.css
@@ -0,0 +1,21 @@
+.lightPoster,
+.darkPoster {
+ width: 100%;
+ height: auto;
+}
+
+.lightPoster {
+ display: block;
+}
+
+.darkPoster {
+ display: none;
+}
+
+:global(.dark) .lightPoster {
+ display: none;
+}
+
+:global(.dark) .darkPoster {
+ display: block;
+}
diff --git a/src/web/src/components/home/deferred-landing-media.tsx b/src/web/src/components/home/deferred-landing-media.tsx
index f511b679a..fea353fcf 100644
--- a/src/web/src/components/home/deferred-landing-media.tsx
+++ b/src/web/src/components/home/deferred-landing-media.tsx
@@ -4,6 +4,7 @@ import { useAtom, useCreateAtom } from "@tanstack/react-store"
import { Component, lazy, Suspense, useCallback, useEffect, useRef, type ReactNode } from "react"
import type { LandingShellMotion } from "./landing-shell-motion"
import type { ComponentProps } from "react"
+import styles from "./deferred-landing-media.module.css"
const Shell = lazy(() => import("./landing-shell-motion").then((module) => ({ default: module.LandingShellMotion })))
const Mobile = lazy(() => import("./landing-shell-motion").then((module) => ({ default: module.LandingMobileChatMotion })))
@@ -15,8 +16,9 @@ class MediaFallback extends Component<{ children: ReactNode; fallback: ReactNode
render() { return this.state.failed ? this.props.fallback : this.props.children }
}
-export function DeferredLandingMedia({ poster, width, height, children, priority = false, alt = "" }: {
+export function DeferredLandingMedia({ poster, darkPoster, width, height, children, priority = false, alt = "" }: {
poster: string
+ darkPoster: string
priority?: boolean
alt?: string
width: number
@@ -27,14 +29,16 @@ export function DeferredLandingMedia({ poster, width, height, children, priority
const [near, setNear] = useAtom(useCreateAtom(false))
const [posterReady, setPosterReady] = useAtom(useCreateAtom(false))
const imageRef = useRef<HTMLImageElement>(null)
+ const darkImageRef = useRef<HTMLImageElement>(null)
const active = near && posterReady
const finishPoster = useCallback(async (image: HTMLImageElement) => {
try { await image.decode() } catch {}
setPosterReady(true)
}, [setPosterReady])
useEffect(() => {
- const image = imageRef.current
- if (image?.complete) void finishPoster(image)
+ for (const image of [imageRef.current, darkImageRef.current]) {
+ if (image?.complete) void finishPoster(image)
+ }
}, [finishPoster])
useEffect(() => {
const element = ref.current
@@ -53,10 +57,12 @@ export function DeferredLandingMedia({ poster, width, height, children, priority
return () => observer.disconnect()
}, [setNear])
const fallback = (
- <img ref={imageRef} src={poster} width={width} height={height} alt={alt}
- loading={priority ? "eager" : "lazy"} fetchPriority={priority ? "high" : "auto"} decoding="async"
- onLoad={(event) => { void finishPoster(event.currentTarget) }} onError={() => setPosterReady(true)}
- style={{ display: "block", width: "100%", height: "auto" }} />
+ <>{[poster, darkPoster].map((src, index) => (
+ <img key={src} ref={index === 0 ? imageRef : darkImageRef} src={src} width={width} height={height} alt={alt}
+ className={index === 0 ? styles.lightPoster : styles.darkPoster}
+ loading={priority ? "eager" : "lazy"} fetchPriority={priority ? "high" : "auto"} decoding="async"
+ onLoad={(event) => { void finishPoster(event.currentTarget) }} onError={() => setPosterReady(true)} />
+ ))}</>
)
return (
<div ref={ref} data-landing-deferred={poster} style={{ width: "100%", aspectRatio: `${width} / ${height}` }}>
@@ -66,13 +72,13 @@ export function DeferredLandingMedia({ poster, width, height, children, priority
}
export function DeferredShellMotion(props: ComponentProps<typeof LandingShellMotion>) {
- return <DeferredLandingMedia poster={`/landing/posters/${props.scene}.webp`} width={1120} height={660} priority={props.scene === "server"}><Shell {...props} /></DeferredLandingMedia>
+ return <DeferredLandingMedia poster={`/landing/posters/${props.scene}.webp`} darkPoster={`/landing/posters/${props.scene}-dark.webp`} width={1120} height={660} priority={props.scene === "server"}><Shell {...props} /></DeferredLandingMedia>
}
export function DeferredMobileChatMotion(props: { beat: number }) {
- return <DeferredLandingMedia poster="/landing/posters/mobile.webp" width={390} height={788}><Mobile {...props} /></DeferredLandingMedia>
+ return <DeferredLandingMedia poster="/landing/posters/mobile.webp" darkPoster="/landing/posters/mobile-dark.webp" width={390} height={788}><Mobile {...props} /></DeferredLandingMedia>
}
export function DeferredProfileCard() {
- return <DeferredLandingMedia poster="/landing/posters/profile.webp" width={300} height={308} alt="Maya — Free for dinner. I keep the same account, identity, and relationships across every room."><Profile /></DeferredLandingMedia>
+ return <DeferredLandingMedia poster="/landing/posters/profile.webp" darkPoster="/landing/posters/profile-dark.webp" width={300} height={308} alt="Maya — Free for dinner. I keep the same account, identity, and relationships across every room."><Profile /></DeferredLandingMedia>
}
diff --git a/src/web/src/components/home/landing-content.test.ts b/src/web/src/components/home/landing-content.test.ts
index 902846f0a..fc0840bdc 100644
--- a/src/web/src/components/home/landing-content.test.ts
+++ b/src/web/src/components/home/landing-content.test.ts
@@ -450,10 +450,10 @@ describe("landing content contract", () => {
expect(landingStyles).toContain("prefers-reduced-motion: reduce")
expect(landingPageSource).toContain("styles.productLayout")
expect(landingPageSource).not.toContain("PaletteSwitcher")
- expect(landingStyles).toMatch(/\.page\s*\{[\s\S]*?--landing-bg: #f4f9e9;/)
- expect(landingStyles).toMatch(/\.page\s*\{[\s\S]*?--landing-accent: #356f95;/)
- expect(landingStyles).toMatch(/\.page\s*\{[\s\S]*?--tw-blob-theme: var\(--landing-section-bg\);/)
- expect(landingStyles).toMatch(/\.page\s*\{[\s\S]*?--landing-text-muted: #47633b;/)
+ expect(landingStyles).toMatch(/\.page:global\(\.landing\)\s*\{[\s\S]*?--landing-bg: #f4f9e9;/)
+ expect(landingStyles).toMatch(/\.page:global\(\.landing\)\s*\{[\s\S]*?--landing-accent: #356f95;/)
+ expect(landingStyles).toMatch(/\.page:global\(\.landing\)\s*\{[\s\S]*?--tw-blob-theme: var\(--landing-section-bg\);/)
+ expect(landingStyles).toMatch(/\.page:global\(\.landing\)\s*\{[\s\S]*?--landing-text-muted: #47633b;/)
expect(landingStyles).toMatch(/\.landingHeroEmphasis\s*\{[\s\S]*?color: var\(--landing-accent\);/)
expect(landingStyles).toMatch(/\.landingHeroTail\s*\{[\s\S]*?color: var\(--landing-text\);/)
expect(landingPageSource).toContain("showMobileDesktopHint={false}")
diff --git a/src/web/src/components/home/landing-page.module.css b/src/web/src/components/home/landing-page.module.css
index aa3acb736..d2ee4069a 100644
--- a/src/web/src/components/home/landing-page.module.css
+++ b/src/web/src/components/home/landing-page.module.css
@@ -1,4 +1,4 @@
-.page {
+.page:global(.landing) {
--landing-content-max: 1320px;
--landing-page-gutter: clamp(24px, 5vw, 72px);
--landing-bg: #f4f9e9;
diff --git a/src/web/src/components/typewriter-visual.dom.test.tsx b/src/web/src/components/typewriter-visual.dom.test.tsx
index 3d540c0ba..c6958e039 100644
--- a/src/web/src/components/typewriter-visual.dom.test.tsx
+++ b/src/web/src/components/typewriter-visual.dom.test.tsx
@@ -23,6 +23,14 @@ describe("typewriter paper", () => {
expect(container.querySelector("pre")?.textContent).toBe(TYPEWRITER_CITY_ART);
});
+ it.each([false, true])("keeps keyboard on a flat front with animated paper=%s", (animateEntrance) => {
+ const { container } = render(<TypewriterVisual animateEntrance={animateEntrance} />);
+ const front = container.querySelector(".tw-body-front")!;
+ const track = container.querySelector(".tw-paper-track")!;
+ expect(front.querySelectorAll(".tw-key")).toHaveLength(26);
+ expect(track.parentElement).toBe(animateEntrance ? front : container.querySelector(".tw-body"));
+ });
+
it("shows the city without a switch control or consuming Enter", () => {
const { container } = render(<TypewriterVisual />);
expect(screen.getByRole("img", { name: /Alook sculpture/ })).toBeTruthy();
diff --git a/src/web/src/components/typewriter-visual.tsx b/src/web/src/components/typewriter-visual.tsx
index e514154f2..19ebabdf6 100644
--- a/src/web/src/components/typewriter-visual.tsx
+++ b/src/web/src/components/typewriter-visual.tsx
@@ -75,6 +75,14 @@ export function TypewriterVisual({
);
}, { scope: containerRef });
+ const paperTrack = (
+ <div className="tw-paper-track">
+ <div className={`tw-paper${paper == null ? " tw-paper-city" : ""}`} style={animateEntrance ? undefined : { opacity: 1 }}>
+ {paper ?? <TypewriterCityArt />}
+ </div>
+ </div>
+ );
+
return (
<div
ref={containerRef}
@@ -94,12 +102,9 @@ export function TypewriterVisual({
<div className="tw-body-top" />
<div className="tw-body-bottom" />
+ {!animateEntrance && paperTrack}
<div className="tw-body-front">
- <div className="tw-paper-track">
- <div className={`tw-paper${paper == null ? " tw-paper-city" : ""}`} style={animateEntrance ? undefined : { opacity: 1 }}>
- {paper ?? <TypewriterCityArt />}
- </div>
- </div>
+ {animateEntrance && paperTrack}
<div className="tw-roller-assembly">
<div className="tw-knob tw-knob-left" />
<div className="tw-roller" />