Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

refactor(web): extract TypewriterVisual component and adjust hero brand spacing

Generf724f0ed8d5b
diff --git a/src/web/public/placeholder.svg b/src/web/public/placeholder.svg
deleted file mode 100644
index 55ba01e1f..000000000
--- a/src/web/public/placeholder.svg
+++ /dev/null
@@ -1,31 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" viewBox="0 0 800 800">
- <defs>
- <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
- <stop offset="0%" stop-color="#f5f0eb"/>
- <stop offset="100%" stop-color="#e8e0d8"/>
- </linearGradient>
- </defs>
- <rect width="800" height="800" fill="url(#bg)"/>
- <!-- Warm geometric composition -->
- <circle cx="520" cy="280" r="180" fill="#d4cbc2" opacity="0.5"/>
- <circle cx="360" cy="480" r="120" fill="#c4b8ac" opacity="0.4"/>
- <rect x="160" y="200" width="140" height="140" rx="24" fill="#b8aa9c" opacity="0.35" transform="rotate(12 230 270)"/>
- <rect x="480" y="460" width="100" height="100" rx="18" fill="#c8bdb0" opacity="0.4" transform="rotate(-8 530 510)"/>
- <!-- Subtle grid dots -->
- <g fill="#b0a496" opacity="0.2">
- <circle cx="100" cy="100" r="3"/>
- <circle cx="200" cy="100" r="3"/>
- <circle cx="300" cy="100" r="3"/>
- <circle cx="400" cy="100" r="3"/>
- <circle cx="500" cy="100" r="3"/>
- <circle cx="600" cy="100" r="3"/>
- <circle cx="700" cy="100" r="3"/>
- <circle cx="100" cy="700" r="3"/>
- <circle cx="200" cy="700" r="3"/>
- <circle cx="300" cy="700" r="3"/>
- <circle cx="400" cy="700" r="3"/>
- <circle cx="500" cy="700" r="3"/>
- <circle cx="600" cy="700" r="3"/>
- <circle cx="700" cy="700" r="3"/>
- </g>
-</svg>
diff --git a/src/web/src/app/(auth)/sign-in/page.tsx b/src/web/src/app/(auth)/sign-in/page.tsx
index a34dc6110..b59df25ad 100644
--- a/src/web/src/app/(auth)/sign-in/page.tsx
+++ b/src/web/src/app/(auth)/sign-in/page.tsx
@@ -20,6 +20,7 @@ import {
} from "@/components/ui/field"
import { SiGithub, SiGoogle } from "@icons-pack/react-simple-icons"
import { GradientBackground } from "@/components/gradient-background"
+import { TypewriterVisual } from "@/components/typewriter-visual"
const isProd = process.env.NEXTJS_ENV === "production"
@@ -277,12 +278,8 @@ export default function SignInPage() {
<div className="p-6 md:p-8">
{isProd ? <OTPSignIn /> : <PasswordSignIn />}
</div>
- <div className="relative hidden bg-muted md:block">
- <img
- src="/placeholder.svg"
- alt="Alook"
- className="absolute inset-0 h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"
- />
+ <div className="relative hidden bg-muted md:block overflow-hidden">
+ <TypewriterVisual className="h-full scale-[0.6] origin-center" />
</div>
</CardContent>
</Card>
diff --git a/src/web/src/app/(auth)/sign-up/page.tsx b/src/web/src/app/(auth)/sign-up/page.tsx
index 980cf4f7e..3d5590829 100644
--- a/src/web/src/app/(auth)/sign-up/page.tsx
+++ b/src/web/src/app/(auth)/sign-up/page.tsx
@@ -14,6 +14,7 @@ import {
FieldLabel,
} from "@/components/ui/field"
import { GradientBackground } from "@/components/gradient-background"
+import { TypewriterVisual } from "@/components/typewriter-visual"
const isProd = process.env.NEXTJS_ENV === "production"
@@ -92,12 +93,8 @@ function SignUpForm() {
</FieldDescription>
</FieldGroup>
</form>
- <div className="relative hidden bg-muted md:block">
- <img
- src="/placeholder.svg"
- alt="Alook"
- className="absolute inset-0 h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"
- />
+ <div className="relative hidden bg-muted md:block overflow-hidden">
+ <TypewriterVisual className="h-full scale-[0.6] origin-center" />
</div>
</CardContent>
</Card>
diff --git a/src/web/src/components/home/hero-section.tsx b/src/web/src/components/home/hero-section.tsx
index a25edebde..e4ae9f695 100644
--- a/src/web/src/components/home/hero-section.tsx
+++ b/src/web/src/components/home/hero-section.tsx
@@ -1,170 +1,20 @@
"use client";
-import { useRef, useCallback, useState, useEffect } from "react";
+import { useRef } from "react";
import Image from "next/image";
import gsap from "gsap";
import { useGSAP } from "@gsap/react";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { SplitText } from "gsap/SplitText";
+import { TypewriterVisual } from "@/components/typewriter-visual";
gsap.registerPlugin(ScrollTrigger, SplitText);
-// Key layout: 3 rows of oval keys (front-facing view)
-const KEY_ROWS = [9, 7, 9];
-
-// Mock emails from Jarvis
-const EMAILS = [
- {
- subject: "Re: Deploy the hotfix to staging",
- body: "Done. Pulled feat/fix-session-token, all 47 tests passing. Deployed to staging \u2014 verified the login flow manually. It\u2019s live now.",
- },
- {
- subject: "Re: Check API health",
- body: "All endpoints responding. p99 latency at 42ms, error rate 0.01%. The alerting threshold is 200ms so we\u2019re well within range.",
- },
- {
- subject: "Re: Summarize today\u2019s PRs",
- body: "3 PRs merged: auth token rotation (#412), rate limiter fix (#415), dashboard chart update (#418). One open review from Sarah on #420.",
- },
- {
- subject: "Re: Update the landing page copy",
- body: "Replaced the hero tagline and updated the feature descriptions. Pushed to feat/landing-copy. Preview link is live \u2014 check staging.",
- },
- {
- subject: "Re: Run the test suite",
- body: "Full suite passed: 847 tests, 0 failures. Coverage at 84.2%, up from 83.1% last run. No flaky tests detected this time.",
- },
-];
-
export function HeroSection() {
const sectionRef = useRef<HTMLDivElement>(null);
- const visualRef = useRef<HTMLDivElement>(null);
const headingRef = useRef<HTMLHeadingElement>(null);
const sublineRef = useRef<HTMLParagraphElement>(null);
const ctaRef = useRef<HTMLDivElement>(null);
- const paperTlRef = useRef<gsap.core.Timeline | null>(null);
- const isAnimatingRef = useRef(false);
- const [emailIndex, setEmailIndex] = useState(0);
-
- const handleMouseMove = useCallback(
- (e: React.MouseEvent<HTMLElement>) => {
- const el = visualRef.current;
- if (!el) return;
- const scene = el.querySelector<HTMLElement>(".typewriter-scene");
- if (!scene) return;
- const rect = el.getBoundingClientRect();
- const nx = (e.clientX - (rect.left + rect.width / 2)) / (rect.width / 2);
- const ny = (e.clientY - (rect.top + rect.height / 2)) / (rect.height / 2);
- scene.style.transition = "transform 0.12s ease-out";
- scene.style.transform = `rotateY(${-20 + nx * 15}deg) rotateX(${10 + ny * -10}deg)`;
- },
- []
- );
-
- const handleMouseLeave = useCallback(() => {
- const el = visualRef.current;
- if (!el) return;
- const scene = el.querySelector<HTMLElement>(".typewriter-scene");
- if (!scene) return;
- scene.style.transition = "transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1)";
- scene.style.transform = "";
- }, []);
-
- // Play the paper feed animation — paper slides up, text types in
- const playPaperFeed = useCallback(() => {
- if (paperTlRef.current) {
- paperTlRef.current.kill();
- }
-
- const bodySplit = SplitText.create(".tw-email-body", { type: "words" });
-
- // Measure paper height, then push it down behind the roller
- const paper = document.querySelector<HTMLElement>(".tw-paper");
- const paperH = paper ? paper.offsetHeight : 300;
- gsap.set(".tw-paper", { y: paperH, opacity: 1 });
- gsap.set(".tw-email-line", { opacity: 0 });
- gsap.set(bodySplit.words, { opacity: 0 });
- const tl = gsap.timeline({
- onComplete: () => { isAnimatingRef.current = false; },
- });
-
- // Paper slides up + text types in simultaneously
- tl.to(".tw-paper", {
- y: 0,
- duration: 3,
- ease: "power1.out",
- })
- // Headers type line by line (parallel with paper)
- .to(".tw-email-line", {
- opacity: 1,
- duration: 0.15,
- stagger: 0.3,
- ease: "none",
- }, "<+=0.3")
- // Body words type in (parallel with paper)
- .to(bodySplit.words, {
- opacity: 1,
- duration: 0.01,
- stagger: 0.06,
- ease: "none",
- }, "<+=0.5");
-
- paperTlRef.current = tl;
- }, []);
-
- const handleReturnKey = useCallback(() => {
- if (isAnimatingRef.current) return;
- isAnimatingRef.current = true;
-
- // Kill any running paper timeline
- if (paperTlRef.current) {
- paperTlRef.current.kill();
- }
-
- // Retract paper — slide back down behind roller
- const paper = document.querySelector<HTMLElement>(".tw-paper");
- const paperH = paper ? paper.offsetHeight : 300;
- gsap.to(".tw-paper", {
- y: paperH,
- duration: 0.4,
- ease: "power2.in",
- onComplete: () => {
- // Cycle to next email — use functional setState
- setEmailIndex((prev) => {
- const next = (prev + 1) % EMAILS.length;
- // Wait a tick for React to render the new email content, then animate
- requestAnimationFrame(() => {
- requestAnimationFrame(() => {
- playPaperFeed();
- });
- });
- return next;
- });
- },
- });
- }, [playPaperFeed]);
-
- // Listen for keyboard Enter to trigger the same effect
- useEffect(() => {
- const onKeyDown = (e: KeyboardEvent) => {
- if (e.key === "Enter") {
- e.preventDefault(); // prevent also activating a focused button
- handleReturnKey();
- }
- };
- window.addEventListener("keydown", onKeyDown);
- return () => window.removeEventListener("keydown", onKeyDown);
- }, [handleReturnKey]);
useGSAP(
() => {
@@ -178,16 +28,6 @@ export function HeroSection() {
const sloganSplit = SplitText.create(headingRef.current, {
type: "words, chars",
});
- const bodySplit = SplitText.create(".tw-email-body", {
- type: "words",
- });
-
- // Measure paper height, push it down behind roller, hide text
- const paper = document.querySelector<HTMLElement>(".tw-paper");
- const paperH = paper ? paper.offsetHeight : 300;
- gsap.set(".tw-paper", { y: paperH, opacity: 1 });
- gsap.set(".tw-email-line", { opacity: 0 });
- gsap.set(bodySplit.words, { opacity: 0 });
const entranceTl = gsap.timeline({ delay: 0.3 });
@@ -204,30 +44,10 @@ export function HeroSection() {
0.2
)
.from(sublineRef.current, { opacity: 0, duration: 0.03, ease: "none" }, "-=0.1")
- // Paper slides up from roller
- .to(".tw-paper", {
- y: 0,
- duration: 3,
- ease: "power1.out",
- }, "+=0.3")
- // Headers type in (parallel with paper slide)
- .to(".tw-email-line", {
- opacity: 1,
- duration: 0.15,
- stagger: 0.3,
- ease: "none",
- }, "<+=0.3")
- // Body words type in (parallel with paper slide)
- .to(bodySplit.words, {
- opacity: 1,
- duration: 0.01,
- stagger: 0.06,
- ease: "none",
- }, "<+=0.5")
.from(
".hero-specs",
{ y: 15, opacity: 0, duration: 0.5, ease: "power2.out" },
- "-=0.2"
+ "+=3.5"
)
.from(
ctaRef.current,
@@ -235,9 +55,6 @@ export function HeroSection() {
"-=0.2"
);
- // Store the paper part of the timeline
- paperTlRef.current = entranceTl;
-
// Scroll exit
const exitTl = gsap.timeline({
scrollTrigger: {
@@ -266,8 +83,6 @@ export function HeroSection() {
{ scope: sectionRef }
);
- const email = EMAILS[emailIndex];
-
return (
<section
ref={sectionRef}
@@ -286,7 +101,7 @@ export function HeroSection() {
<div className="hero-content relative z-10 mx-auto flex w-full max-w-4xl flex-col items-center px-6">
{/* Brand */}
- <div className="hero-brand mb-6 flex items-center gap-3">
+ <div className="hero-brand mb-6 flex items-center gap-1.5">
<Image src="/alook.svg" alt="Alook" width={28} height={28} />
<span
className="text-xl tracking-tight"
@@ -299,7 +114,7 @@ export function HeroSection() {
Alook
</span>
<span
- className="ml-2 text-xs tracking-widest uppercase"
+ className="ml-4 text-xs tracking-widest uppercase"
style={{
fontFamily: "var(--font-mono)",
color: "var(--landing-text-muted)",
@@ -309,17 +124,9 @@ export function HeroSection() {
</span>
</div>
- {/* Front-Facing Typewriter */}
- <div
- ref={visualRef}
- className="typewriter-visual relative w-full"
- style={{ height: 570 }}
- onMouseMove={handleMouseMove}
- onMouseLeave={handleMouseLeave}
- >
- <div className="typewriter-blob" />
-
- {/* Slogan */}
+ {/* Typewriter + Slogan wrapper */}
+ <div className="relative w-full" style={{ height: 570 }}>
+ {/* Slogan — positioned at top of typewriter area */}
<div className="absolute top-0 left-0 right-0 z-10 flex flex-col items-center pt-2">
<h1
ref={headingRef}
@@ -347,101 +154,12 @@ export function HeroSection() {
</p>
</div>
- <div className="typewriter-scene">
- <div className="tw-machine">
- {/* 3D Body */}
- <div className="tw-body">
- {/* 3D faces */}
- <div className="tw-body-back" />
- <div className="tw-body-left" />
- <div className="tw-body-right" />
- <div className="tw-body-top" />
- <div className="tw-body-bottom" />
-
- {/* Front face */}
- <div className="tw-body-front">
- {/* Paper track — clips paper as it feeds out */}
- <div className="tw-paper-track">
- <div className="tw-paper" key={emailIndex}>
- <div
- className="tw-email-headers"
- style={{
- fontFamily: "var(--font-crt)",
- fontSize: "15px",
- color: "var(--landing-text-muted)",
- lineHeight: 1.7,
- borderBottom: "1px solid oklch(0.15 0.01 55 / 10%)",
- paddingBottom: "10px",
- marginBottom: "12px",
- }}
- >
- <div className="tw-email-line">
- <span style={{ color: "var(--landing-text)" }}>From:</span>{" "}
- {email.from}
- </div>
- <div className="tw-email-line">
- <span style={{ color: "var(--landing-text)" }}>To:</span>{" "}
- {email.to}
- </div>
- <div className="tw-email-line">
- <span style={{ color: "var(--landing-text)" }}>Subject:</span>{" "}
- {email.subject}
- </div>
- </div>
-
- <div
- className="tw-email-body"
- style={{
- fontFamily: "var(--font-crt)",
- color: "var(--landing-text)",
- fontSize: "17px",
- lineHeight: 1.6,
- }}
- >
- {email.body}
- </div>
- </div>
- </div>{/* close tw-paper-track */}
-
- {/* Roller with knobs */}
- <div className="tw-roller-assembly">
- <div className="tw-knob tw-knob-left" />
- <div className="tw-roller" />
- <div className="tw-knob tw-knob-right" />
- </div>
-
- {/* Type-bar fan */}
- <div className="tw-typebar-fan" />
-
- {/* Key rows + return key */}
- <div className="tw-keys-layer">
- {KEY_ROWS.map((count, ri) => (
- <div key={ri} className="tw-key-row">
- {Array.from({ length: count }).map((_, ki) => (
- <div key={ki} className="tw-key" />
- ))}
- {ri === 1 && (
- <button
- className="tw-key tw-return-key"
- onClick={handleReturnKey}
- aria-label="Return — load next email"
- >
- <span className="tw-return-label">↵</span>
- </button>
- )}
- </div>
- ))}
- </div>
-
- {/* Bars */}
- <div className="tw-bars">
- <div className="tw-bar tw-bar-long" />
- <div className="tw-bar tw-bar-short" />
- </div>
- </div>{/* close tw-body-front */}
- </div>
- </div>
- </div>
+ {/* Full Typewriter */}
+ <TypewriterVisual
+ interactive
+ entranceDelay={1.2}
+ className="!absolute inset-0"
+ />
</div>
{/* Specs */}
diff --git a/src/web/src/components/typewriter-visual.tsx b/src/web/src/components/typewriter-visual.tsx
new file mode 100644
index 000000000..2c544bf30
--- /dev/null
+++ b/src/web/src/components/typewriter-visual.tsx
@@ -0,0 +1,345 @@
+"use client";
+
+import { useRef, useCallback, useState, useEffect } from "react";
+import gsap from "gsap";
+import { useGSAP } from "@gsap/react";
+import { SplitText } from "gsap/SplitText";
+
+gsap.registerPlugin(SplitText);
+
+// Key layout: 3 rows of oval keys (front-facing view)
+const KEY_ROWS = [9, 7, 9];
+
+// Mock emails from Jarvis
+const EMAILS = [
+ {
+ subject: "Re: Deploy the hotfix to staging",
+ body: "Done. Pulled feat/fix-session-token, all 47 tests passing. Deployed to staging \u2014 verified the login flow manually. It\u2019s live now.",
+ },
+ {
+ subject: "Re: Check API health",
+ body: "All endpoints responding. p99 latency at 42ms, error rate 0.01%. The alerting threshold is 200ms so we\u2019re well within range.",
+ },
+ {
+ subject: "Re: Summarize today\u2019s PRs",
+ body: "3 PRs merged: auth token rotation (#412), rate limiter fix (#415), dashboard chart update (#418). One open review from Sarah on #420.",
+ },
+ {
+ subject: "Re: Update the landing page copy",
+ body: "Replaced the hero tagline and updated the feature descriptions. Pushed to feat/landing-copy. Preview link is live \u2014 check staging.",
+ },
+ {
+ subject: "Re: Run the test suite",
+ body: "Full suite passed: 847 tests, 0 failures. Coverage at 84.2%, up from 83.1% last run. No flaky tests detected this time.",
+ },
+];
+
+// CSS variables the typewriter CSS needs — self-provided so
+// the component works outside the `.landing` scope too.
+const TW_VARS: React.CSSProperties = {
+ "--tw-body": "oklch(0.25 0.01 60)",
+ "--tw-body-hi": "oklch(0.30 0.01 60)",
+ "--tw-body-lo": "oklch(0.18 0.01 55)",
+ "--tw-body-top": "oklch(0.28 0.01 60)",
+ "--tw-chrome": "oklch(0.72 0.01 75)",
+ "--tw-chrome-hi": "oklch(0.82 0.005 80)",
+ "--tw-paper": "oklch(0.97 0.008 80)",
+ "--tw-blob": "oklch(0.88 0.025 82)",
+ "--tw-roller": "oklch(0.15 0.01 55)",
+} as React.CSSProperties;
+
+interface TypewriterVisualProps {
+ className?: string;
+ /** When true, keyboard Enter cycles emails. Default false. */
+ interactive?: boolean;
+ /** Delay (seconds) before the paper-feed entrance animation starts. */
+ entranceDelay?: number;
+}
+
+/**
+ * Full 3D typewriter with paper-feed animation, email cycling, and mouse parallax.
+ * `interactive` controls whether keyboard Enter triggers email cycling —
+ * only the homepage should set this to true.
+ */
+export function TypewriterVisual({
+ className,
+ interactive = false,
+ entranceDelay = 0.3,
+}: TypewriterVisualProps) {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const paperTlRef = useRef<gsap.core.Timeline | null>(null);
+ const isAnimatingRef = useRef(false);
+ const [emailIndex, setEmailIndex] = useState(0);
+
+ const handleMouseMove = useCallback(
+ (e: React.MouseEvent<HTMLElement>) => {
+ const el = containerRef.current;
+ if (!el) return;
+ const scene = el.querySelector<HTMLElement>(".typewriter-scene");
+ if (!scene) return;
+ const rect = el.getBoundingClientRect();
+ const nx = (e.clientX - (rect.left + rect.width / 2)) / (rect.width / 2);
+ const ny = (e.clientY - (rect.top + rect.height / 2)) / (rect.height / 2);
+ scene.style.transition = "transform 0.12s ease-out";
+ scene.style.transform = `rotateY(${-20 + nx * 15}deg) rotateX(${10 + ny * -10}deg)`;
+ },
+ []
+ );
+
+ const handleMouseLeave = useCallback(() => {
+ const el = containerRef.current;
+ if (!el) return;
+ const scene = el.querySelector<HTMLElement>(".typewriter-scene");
+ if (!scene) return;
+ scene.style.transition = "transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1)";
+ scene.style.transform = "";
+ }, []);
+
+ // Play the paper feed animation — paper slides up, text types in
+ const playPaperFeed = useCallback(() => {
+ const root = containerRef.current;
+ if (!root) return;
+
+ if (paperTlRef.current) {
+ paperTlRef.current.kill();
+ }
+
+ const bodyEl = root.querySelector(".tw-email-body");
+ if (!bodyEl) return;
+ const bodySplit = SplitText.create(bodyEl, { type: "words" });
+
+ const paper = root.querySelector<HTMLElement>(".tw-paper");
+ const paperH = paper ? paper.offsetHeight : 300;
+ gsap.set(paper, { y: paperH, opacity: 1 });
+ gsap.set(root.querySelectorAll(".tw-email-line"), { opacity: 0 });
+ gsap.set(bodySplit.words, { opacity: 0 });
+
+ const tl = gsap.timeline({
+ onComplete: () => {
+ isAnimatingRef.current = false;
+ },
+ });
+
+ tl.to(paper, {
+ y: 0,
+ duration: 3,
+ ease: "power1.out",
+ })
+ .to(root.querySelectorAll(".tw-email-line"), {
+ opacity: 1,
+ duration: 0.15,
+ stagger: 0.3,
+ ease: "none",
+ }, "<+=0.3")
+ .to(bodySplit.words, {
+ opacity: 1,
+ duration: 0.01,
+ stagger: 0.06,
+ ease: "none",
+ }, "<+=0.5");
+
+ paperTlRef.current = tl;
+ }, []);
+
+ const handleReturnKey = useCallback(() => {
+ if (isAnimatingRef.current) return;
+ isAnimatingRef.current = true;
+
+ const root = containerRef.current;
+ if (!root) return;
+
+ if (paperTlRef.current) {
+ paperTlRef.current.kill();
+ }
+
+ const paper = root.querySelector<HTMLElement>(".tw-paper");
+ const paperH = paper ? paper.offsetHeight : 300;
+ gsap.to(paper, {
+ y: paperH,
+ duration: 0.4,
+ ease: "power2.in",
+ onComplete: () => {
+ setEmailIndex((prev) => {
+ const next = (prev + 1) % EMAILS.length;
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ playPaperFeed();
+ });
+ });
+ return next;
+ });
+ },
+ });
+ }, [playPaperFeed]);
+
+ // Keyboard Enter listener — only when interactive
+ useEffect(() => {
+ if (!interactive) return;
+ const onKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ handleReturnKey();
+ }
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [interactive, handleReturnKey]);
+
+ // Entrance animation — paper feeds in on mount
+ useGSAP(
+ () => {
+ const root = containerRef.current;
+ if (!root) return;
+
+ const bodyEl = root.querySelector(".tw-email-body");
+ if (!bodyEl) return;
+ const bodySplit = SplitText.create(bodyEl, { type: "words" });
+
+ const paper = root.querySelector<HTMLElement>(".tw-paper");
+ const paperH = paper ? paper.offsetHeight : 300;
+ gsap.set(paper, { y: paperH, opacity: 1 });
+ gsap.set(root.querySelectorAll(".tw-email-line"), { opacity: 0 });
+ gsap.set(bodySplit.words, { opacity: 0 });
+
+ const tl = gsap.timeline({ delay: entranceDelay });
+
+ tl.to(paper, {
+ y: 0,
+ duration: 3,
+ ease: "power1.out",
+ })
+ .to(root.querySelectorAll(".tw-email-line"), {
+ opacity: 1,
+ duration: 0.15,
+ stagger: 0.3,
+ ease: "none",
+ }, "<+=0.3")
+ .to(bodySplit.words, {
+ opacity: 1,
+ duration: 0.01,
+ stagger: 0.06,
+ ease: "none",
+ }, "<+=0.5");
+
+ paperTlRef.current = tl;
+ },
+ { scope: containerRef }
+ );
+
+ const email = EMAILS[emailIndex];
+
+ return (
+ <div
+ ref={containerRef}
+ className={`typewriter-visual${className ? ` ${className}` : ""}`}
+ style={TW_VARS}
+ onMouseMove={handleMouseMove}
+ onMouseLeave={handleMouseLeave}
+ >
+ <div className="typewriter-blob" />
+
+ <div className="typewriter-scene">
+ <div className="tw-machine">
+ <div className="tw-body">
+ <div className="tw-body-back" />
+ <div className="tw-body-left" />
+ <div className="tw-body-right" />
+ <div className="tw-body-top" />
+ <div className="tw-body-bottom" />
+
+ <div className="tw-body-front">
+ {/* Paper track — clips paper as it feeds out */}
+ <div className="tw-paper-track">
+ <div className="tw-paper" key={emailIndex}>
+ <div
+ className="tw-email-headers"
+ style={{
+ fontFamily: "var(--font-crt)",
+ fontSize: "15px",
+ color: "var(--landing-text-muted)",
+ lineHeight: 1.7,
+ borderBottom: "1px solid oklch(0.15 0.01 55 / 10%)",
+ paddingBottom: "10px",
+ marginBottom: "12px",
+ }}
+ >
+ <div className="tw-email-line">
+ <span style={{ color: "var(--landing-text)" }}>From:</span>{" "}
+ {email.from}
+ </div>
+ <div className="tw-email-line">
+ <span style={{ color: "var(--landing-text)" }}>To:</span>{" "}
+ {email.to}
+ </div>
+ <div className="tw-email-line">
+ <span style={{ color: "var(--landing-text)" }}>Subject:</span>{" "}
+ {email.subject}
+ </div>
+ </div>
+
+ <div
+ className="tw-email-body"
+ style={{
+ fontFamily: "var(--font-crt)",
+ color: "var(--landing-text)",
+ fontSize: "17px",
+ lineHeight: 1.6,
+ }}
+ >
+ {email.body}
+ </div>
+ </div>
+ </div>
+
+ {/* Roller with knobs */}
+ <div className="tw-roller-assembly">
+ <div className="tw-knob tw-knob-left" />
+ <div className="tw-roller" />
+ <div className="tw-knob tw-knob-right" />
+ </div>
+
+ {/* Type-bar fan */}
+ <div className="tw-typebar-fan" />
+
+ {/* Key rows + return key */}
+ <div className="tw-keys-layer">
+ {KEY_ROWS.map((count, ri) => (
+ <div key={ri} className="tw-key-row">
+ {Array.from({ length: count }).map((_, ki) => (
+ <div key={ki} className="tw-key" />
+ ))}
+ {ri === 1 && (
+ <button
+ className="tw-key tw-return-key"
+ onClick={handleReturnKey}
+ aria-label="Return — load next email"
+ >
+ <span className="tw-return-label">{"\u21B5"}</span>
+ </button>
+ )}
+ </div>
+ ))}
+ </div>
+
+ {/* Bars */}
+ <div className="tw-bars">
+ <div className="tw-bar tw-bar-long" />
+ <div className="tw-bar tw-bar-short" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}