diff --git a/dashboard-v2/index.html b/dashboard-v2/index.html index dc85adc7f..a95742230 100644 --- a/dashboard-v2/index.html +++ b/dashboard-v2/index.html @@ -5,7 +5,7 @@ Status | Archie diff --git a/dashboard-v2/src/components/ArchieLogo.tsx b/dashboard-v2/src/components/ArchieLogo.tsx new file mode 100644 index 000000000..9c00cb55b --- /dev/null +++ b/dashboard-v2/src/components/ArchieLogo.tsx @@ -0,0 +1,209 @@ +import { + useCallback, + useEffect, + useLayoutEffect, + useRef, + useState, + type CSSProperties, +} from "react"; + +/** Brand sage, mirroring v1's shared `--sage` accent. */ +export const ARCHIE_SAGE = "#51a580"; + +const LEGS_LEFT = "M2.00 21.00 L6.00 21.00 L14.00 3.00 L10.00 3.00Z"; +const LEGS_RIGHT = "M14.90 5.03 L22.00 21.00 L18.00 21.00 L12.90 9.53Z"; +const BAR = "M10.47 15.00 L13.53 15.00 L14.64 17.50 L9.36 17.50Z"; + +/** Suffixes the open mark cycles through, with their accessible names. */ +const NAMES = ["rchie", "rchitect", "rchimedes", "rchipelago"]; +const LABELS = ["Archie", "Architect", "Archimedes", "archipelago"]; + +const EASE = "cubic-bezier(0.2, 0.7, 0.2, 1)"; +const BOOT_OPEN_MS = 700; +const HOLD_MS = 2400; +const CYCLE_MS = 1800; +const SWAP_MS = 200; + +function MarkArt({booted}: {booted: boolean}): React.JSX.Element { + return ( + + ); +} + +/** The static A mark, for shells and topbars. */ +export function ArchieMark({size = 16}: {size?: number}): React.JSX.Element { + return ( + + + + ); +} + +/** + * The full logo: the A opens out to the name on mount, holds, folds back, + * and reopens on hover or focus, cycling the name while open. Reduced motion + * gets no transitions and the name on hover only. + */ +export default function ArchieLogo({ + size = 32, +}: { + size?: number; +}): React.JSX.Element { + const [booted, setBooted] = useState(false); + const [open, setOpen] = useState(false); + const [nameIndex, setNameIndex] = useState(0); + const [swapping, setSwapping] = useState(false); + const [hovering, setHovering] = useState(false); + const [reduced] = useState( + () => + typeof window !== "undefined" && + window.matchMedia("(prefers-reduced-motion: reduce)").matches, + ); + const suffixRef = useRef(null); + const textRef = useRef(null); + const foldTimer = useRef(0); + + const fit = useCallback(() => { + const suffix = suffixRef.current; + const text = textRef.current; + if (suffix && text) { + suffix.style.maxWidth = `${Math.ceil(text.getBoundingClientRect().width)}px`; + } + }, []); + + const close = useCallback(() => { + setOpen(false); + window.setTimeout(() => setNameIndex(0), reduced ? 0 : 460); + }, [reduced]); + + // Boot once on mount: bar rises, name opens, holds, folds back. + useEffect(() => { + if (reduced) { + setBooted(true); + return; + } + const rise = window.setTimeout(() => setBooted(true), 150); + const show = window.setTimeout(() => setOpen(true), BOOT_OPEN_MS); + foldTimer.current = window.setTimeout(() => { + setHovering(current => { + if (!current) { + setOpen(false); + } + return current; + }); + }, BOOT_OPEN_MS + 460 + HOLD_MS); + return () => { + window.clearTimeout(rise); + window.clearTimeout(show); + window.clearTimeout(foldTimer.current); + }; + }, [reduced]); + + // Fit the suffix to the name whenever it opens or the name changes. + useLayoutEffect(() => { + if (open) { + fit(); + } else if (suffixRef.current) { + suffixRef.current.style.maxWidth = "0px"; + } + }, [open, nameIndex, fit]); + + // Cycle the name while open. + useEffect(() => { + if (!open || reduced) { + return; + } + const timer = window.setInterval(() => { + setSwapping(true); + window.setTimeout(() => { + setNameIndex(i => (i + 1) % NAMES.length); + setSwapping(false); + }, SWAP_MS); + }, CYCLE_MS); + return () => window.clearInterval(timer); + }, [open, reduced]); + + const show = () => { + window.clearTimeout(foldTimer.current); + setHovering(true); + setOpen(true); + }; + const hide = () => { + setHovering(false); + close(); + }; + + const logoStyle: CSSProperties = { + display: "inline-flex", + alignItems: "baseline", + fontWeight: 600, + letterSpacing: "-0.01em", + lineHeight: 1, + whiteSpace: "nowrap", + fontSize: size, + borderRadius: 8, + outline: "none", + }; + const suffixStyle: CSSProperties = { + display: "inline-block", + overflow: "hidden", + paddingBottom: "0.25em", + marginBottom: "-0.25em", + maxWidth: 0, + transition: reduced ? "none" : `max-width 460ms ${EASE}`, + }; + const textStyle: CSSProperties = { + display: "inline-block", + width: "max-content", + paddingLeft: "0.02em", + transition: reduced ? "none" : "opacity 200ms ease, transform 200ms ease", + opacity: swapping ? 0 : undefined, + transform: swapping ? "translateY(0.18em)" : undefined, + }; + + return ( + + + + + ); +} diff --git a/dashboard-v2/src/pages/LoginPage.tsx b/dashboard-v2/src/pages/LoginPage.tsx index 2d69abbca..12d7b51bc 100644 --- a/dashboard-v2/src/pages/LoginPage.tsx +++ b/dashboard-v2/src/pages/LoginPage.tsx @@ -4,12 +4,11 @@ import { Banner } from "@astryxdesign/core/Banner"; import { Button } from "@astryxdesign/core/Button"; import { Card } from "@astryxdesign/core/Card"; import { Center } from "@astryxdesign/core/Center"; -import { Icon } from "@astryxdesign/core/Icon"; import { VStack } from "@astryxdesign/core/Layout"; import { Heading, Text } from "@astryxdesign/core/Text"; import { TextInput } from "@astryxdesign/core/TextInput"; -import { CubeIcon } from "@heroicons/react/24/outline"; +import ArchieLogo from "../components/ArchieLogo.tsx"; import { useSession } from "../session.tsx"; // Standalone auth page paints its own body background (no host shell). @@ -50,13 +49,7 @@ export default function LoginPage() { return (
- {/* Logo */} - - - - Archie - - + {/* Card */}