World Signups
A dotted world map pings signup locations next to a rolling signup counter and live feed.
Source
components/kuchi/world-signups.tsx
1"use client";23import { loadFont } from "@remotion/google-fonts/HankenGrotesk";4import type React from "react";5import {6 AbsoluteFill,7 Easing,8 interpolate,9 spring,10 useCurrentFrame,11 useVideoConfig,12} from "remotion";13import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";14import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";15import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1617const { fontFamily: hanken } = loadFont("normal", {18 weights: ["300", "400"],19 subsets: ["latin"],20});2122export interface Signup {23 name: string;24 city: string;25 country: string;26 lon: number;27 lat: number;28 plan?: "Free" | "Pro" | "Team";29 at: number;30}3132export interface CountryStat {33 name: string;34 code: string;35 count: number;36}3738export interface WorldSignupsProps {39 signups?: Signup[];40 startCount?: number;41 countries?: CountryStat[];42 title?: string;43 counterLabel?: string;44 delta?: string;45 /** Heading above the live signup feed. */46 feedLabel?: string;47 /** Time range at the right of the window header. */48 rangeLabel?: string;49 theme?: "light" | "dark";50 accent?: string;51 /** Text color of the title, counter and names; overrides the theme. */52 ink?: string;53 /** Solid fill in place of the gradient ground; "transparent" drops it. */54 background?: string;55 /** Typeface for the copy. Load it yourself; Hanken Grotesk by default. */56 fontFamily?: string;57 /** Size of the window, around the frame's center. */58 scale?: number;59 /** Frames to hold the first frame before anything moves. */60 delay?: number;61 speed?: number;62 ground?: GshPresetId;63 groundParams?: Partial<GradientParams>;64}6566const DEFAULT_SIGNUPS: Signup[] = [67 {68 name: "Maya Chen",69 city: "Lisbon",70 country: "PT",71 lon: -9.14,72 lat: 38.72,73 plan: "Pro",74 at: 26,75 },76 {77 name: "Kenji Sato",78 city: "Tokyo",79 country: "JP",80 lon: 139.69,81 lat: 35.69,82 plan: "Free",83 at: 38,84 },85 {86 name: "Ana Souza",87 city: "São Paulo",88 country: "BR",89 lon: -46.63,90 lat: -23.55,91 plan: "Pro",92 at: 49,93 },94 {95 name: "Leo Park",96 city: "Seoul",97 country: "KR",98 lon: 126.98,99 lat: 37.57,100 plan: "Team",101 at: 59,102 },103 {104 name: "Priya Raman",105 city: "Bengaluru",106 country: "IN",107 lon: 77.59,108 lat: 12.97,109 plan: "Free",110 at: 68,111 },112 {113 name: "Jonas Weber",114 city: "Berlin",115 country: "DE",116 lon: 13.4,117 lat: 52.52,118 plan: "Pro",119 at: 77,120 },121 {122 name: "Sam Ortiz",123 city: "Austin",124 country: "US",125 lon: -97.74,126 lat: 30.27,127 plan: "Free",128 at: 85,129 },130 {131 name: "Amara Okafor",132 city: "Lagos",133 country: "NG",134 lon: 3.38,135 lat: 6.52,136 plan: "Free",137 at: 93,138 },139 {140 name: "Chloé Martin",141 city: "Paris",142 country: "FR",143 lon: 2.35,144 lat: 48.86,145 plan: "Pro",146 at: 101,147 },148 {149 name: "Noah Williams",150 city: "Sydney",151 country: "AU",152 lon: 151.21,153 lat: -33.87,154 plan: "Team",155 at: 108,156 },157 {158 name: "Olivia Brown",159 city: "Toronto",160 country: "CA",161 lon: -79.38,162 lat: 43.65,163 plan: "Free",164 at: 115,165 },166 {167 name: "Elena Rossi",168 city: "Milan",169 country: "IT",170 lon: 9.19,171 lat: 45.46,172 plan: "Pro",173 at: 122,174 },175 {176 name: "Diego Ramírez",177 city: "Mexico City",178 country: "MX",179 lon: -99.13,180 lat: 19.43,181 plan: "Free",182 at: 129,183 },184 {185 name: "Aiko Tanaka",186 city: "Osaka",187 country: "JP",188 lon: 135.5,189 lat: 34.69,190 plan: "Pro",191 at: 137,192 },193 {194 name: "Tom Becker",195 city: "Seattle",196 country: "US",197 lon: -122.33,198 lat: 47.61,199 plan: "Team",200 at: 145,201 },202];203204const DEFAULT_COUNTRIES: CountryStat[] = [205 { name: "United States", code: "US", count: 2184 },206 { name: "Germany", code: "DE", count: 1032 },207 { name: "Brazil", code: "BR", count: 902 },208 { name: "India", code: "IN", count: 871 },209 { name: "Japan", code: "JP", count: 655 },210];211212const LAND: string[] = [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];258const CELL = 3;259const LAT_TOP = 78;260261const CL = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;262const enterEase = Easing.bezier(0.32, 0.72, 0, 1);263const moveEase = Easing.bezier(0.65, 0, 0.35, 1);264const exitEase = Easing.bezier(0.55, 0, 1, 0.45);265const camEase = Easing.bezier(0.87, 0, 0.13, 1);266const tween = (f: number, a: number, b: number, easing = enterEase) =>267 interpolate(f, [a, b], [0, 1], { ...CL, easing });268const clamp = (v: number, lo: number, hi: number) =>269 Math.min(hi, Math.max(lo, v));270const fmt = (n: number) =>271 String(Math.round(n)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");272const hash = (n: number) => {273 const s = Math.sin(n * 127.1 + 311.7) * 43758.5453;274 return s - Math.floor(s);275};276277const HEAVY = { mass: 1, damping: 26, stiffness: 120 };278const CARD = { mass: 0.8, damping: 18, stiffness: 160 };279const CHIP = { mass: 0.5, damping: 12, stiffness: 200 };280281function withAlpha(color: string, alpha: number) {282 const hex = color.replace("#", "");283 const full = hex.length === 3 ? hex.replace(/(.)/g, "$1$1") : hex;284 if (!/^[0-9a-fA-F]{6}$/.test(full)) return color;285 const n = Number.parseInt(full, 16);286 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;287}288289interface Pal {290 win: string;291 chip: string;292 line: string;293 text: string;294 muted: string;295 faint: string;296 dot: string;297 green: string;298 scrim: string;299 winShadow: string;300 chipShadow: string;301 stageText: string;302 stageMuted: string;303 dark: boolean;304}305306function palette(theme: "light" | "dark"): Pal {307 return theme === "dark"308 ? {309 win: "#0D0E11",310 chip: "#1A1B1F",311 line: "rgba(255,255,255,0.07)",312 text: "#EEEEF0",313 muted: "rgba(238,238,240,0.58)",314 faint: "rgba(238,238,240,0.38)",315 dot: "rgba(255,255,255,0.3)",316 green: "#62D893",317 scrim: "rgba(3,4,10,0.25)",318 winShadow:319 "0 0 0 1px rgba(255,255,255,0.09), inset 0 1px 0 rgba(255,255,255,0.05), 0 40px 90px -24px rgba(0,0,0,0.75), 0 10px 28px rgba(0,0,0,0.35)",320 chipShadow:321 "0 0 0 1px rgba(255,255,255,0.12), 0 10px 24px -6px rgba(0,0,0,0.6)",322 stageText: "#F2F2F4",323 stageMuted: "rgba(242,242,244,0.62)",324 dark: true,325 }326 : {327 win: "#FCFCFB",328 chip: "#FFFFFF",329 line: "rgba(22,23,26,0.08)",330 text: "#16171A",331 muted: "rgba(22,23,26,0.58)",332 faint: "rgba(22,23,26,0.4)",333 dot: "rgba(22,23,26,0.2)",334 green: "#18794E",335 scrim: "rgba(238,236,232,0.12)",336 winShadow:337 "0 0 0 1px rgba(17,19,24,0.07), 0 1px 2px rgba(17,19,24,0.05), 0 30px 70px -20px rgba(28,38,92,0.28)",338 chipShadow:339 "0 0 0 1px rgba(17,19,24,0.08), 0 10px 24px -8px rgba(28,38,92,0.3)",340 stageText: "#14151A",341 stageMuted: "rgba(20,21,26,0.6)",342 dark: false,343 };344}345346const LIGHT_GROUND: Partial<GradientParams> = {347 colors: ["#6e8dff", "#aebdff", "#dfe4fb", "#f5f3ef"],348};349350function lighten(color: string, t: number) {351 const hex = color.replace("#", "");352 const full = hex.length === 3 ? hex.replace(/(.)/g, "$1$1") : hex;353 if (!/^[0-9a-fA-F]{6}$/.test(full)) return color;354 const n = Number.parseInt(full, 16);355 const ch = (v: number) =>356 Math.round(v + (255 - v) * t)357 .toString(16)358 .padStart(2, "0");359 return `#${ch((n >> 16) & 255)}${ch((n >> 8) & 255)}${ch(n & 255)}`;360}361362const AVATAR_TONES = ["#B9806C", "#6F8DB8", "#8E7DB3", "#6E9C84", "#B59866"];363function Avatar({ name, size }: { name: string; size: number }) {364 const idx =365 [...name].reduce((s, ch) => s + ch.charCodeAt(0), 0) % AVATAR_TONES.length;366 return (367 <div368 style={{369 width: size,370 height: size,371 borderRadius: 999,372 background: AVATAR_TONES[idx],373 color: "rgba(255,255,255,0.95)",374 fontSize: size * 0.4,375 display: "flex",376 alignItems: "center",377 justifyContent: "center",378 flexShrink: 0,379 letterSpacing: "0.02em",380 }}381 >382 {name383 .split(" ")384 .map((s) => s[0])385 .join("")386 .slice(0, 2)}387 </div>388 );389}390391function SnapCounter({392 value,393 changedAt,394 frame,395}: {396 value: string;397 changedAt: number[];398 frame: number;399}) {400 let d = 0;401 const digits = value.replace(/\D/g, "").length;402 return (403 <span404 style={{405 display: "inline-flex",406 fontVariantNumeric: "tabular-nums",407 overflow: "hidden",408 }}409 >410 {value.split("").map((ch, i) => {411 if (!/\d/.test(ch)) {412 return <span key={i}>{ch}</span>;413 }414 const slot = digits - 1 - d++;415 const t = changedAt[slot] ?? -999;416 const p = tween(frame, t, t + 8);417 return (418 <span419 key={i}420 style={{421 display: "inline-block",422 transform: `translateY(${(1 - p) * 60}%)`,423 opacity: 0.2 + 0.8 * p,424 }}425 >426 {ch}427 </span>428 );429 })}430 </span>431 );432}433434/** The foreground at `scale`, around the frame's center; nothing extra at 1. */435function ScaleLayer({436 scale,437 children,438}: {439 scale: number;440 children: React.ReactNode;441}) {442 if (scale === 1) return children;443 return (444 <AbsoluteFill style={{ transform: `scale(${scale})` }}>445 {children}446 </AbsoluteFill>447 );448}449450export function WorldSignups({451 signups = DEFAULT_SIGNUPS,452 startCount = 12847,453 countries = DEFAULT_COUNTRIES,454 title = "Signups around the world",455 counterLabel = "Signups today",456 delta = "+18.2% vs. yesterday",457 feedLabel = "Latest signups",458 rangeLabel = "Today",459 theme = "light",460 accent = "#3B5BFD",461 ink,462 background,463 fontFamily = hanken,464 scale = 1,465 delay = 0,466 speed = 1,467 ground,468 groundParams,469}: WorldSignupsProps) {470 const frame = Math.max(0, useCurrentFrame() - delay) * speed;471 const { width: W, height: H, fps } = useVideoConfig();472 const pal = palette(theme);473 const fg = ink ?? pal.text;474 const tall = H > W * 1.2;475 const D = tall ? { w: 800, h: 1422 } : { w: 1280, h: 720 };476 const s = Math.min(W / D.w, H / D.h);477 const sp = (at: number, config: object) =>478 spring({ frame: frame - at, fps, config });479480 const WIN = tall481 ? { x: 40, y: 340, w: 720, h: 1010 }482 : { x: 140, y: 60, w: 1000, h: 600 };483 const PAD = 28;484 const HEAD_H = 68;485 const MAP_W = tall ? WIN.w - PAD * 2 : 640;486 const PITCH = MAP_W / LAND[0].length;487 const PITCH_Y = PITCH * 1.18;488 const mapH = LAND.length * PITCH_Y;489 const COUNTRY_H = 70;490 const countryY = tall ? HEAD_H + 28 + mapH + 30 : WIN.h - PAD - COUNTRY_H;491 const mapTop = tall492 ? HEAD_H + 28493 : HEAD_H + (countryY - HEAD_H - mapH) / 2 - 6;494 const mapLeft = PAD;495 const SIDE = tall496 ? { x: PAD, y: countryY + COUNTRY_H + 30, w: WIN.w - PAD * 2 }497 : {498 x: PAD + MAP_W + 32,499 y: HEAD_H + 24,500 w: WIN.w - (PAD + MAP_W + 32) - PAD,501 };502 const feedTop = tall ? SIDE.y + 40 : SIDE.y + 180;503 const ROW = tall ? 66 : 62;504505 const project = (lon: number, lat: number) => {506 const c = clamp(Math.floor((lon + 180) / CELL), 0, LAND[0].length - 1);507 const r = clamp(Math.floor((LAT_TOP - lat) / CELL), 0, LAND.length - 1);508 return { x: (c + 0.5) * PITCH, y: (r + 0.5) * PITCH_Y };509 };510511 const events = [...signups].sort((a, b) => a.at - b.at);512 const landed = events.filter((e) => e.at <= frame);513 const inc = (k: number) => 1 + Math.floor(hash(k) * 3);514515 let count = startCount;516 const changedAt: number[] = [];517 events.forEach((e, k) => {518 if (e.at > frame) return;519 const next = count + inc(k);520 const a = String(count);521 const b = String(next);522 for (let i = 0; i < b.length; i++) {523 if (a[a.length - 1 - i] !== b[b.length - 1 - i]) changedAt[i] = e.at;524 }525 count = next;526 });527528 const win = sp(0, HEAVY);529 const winA = tween(frame, 0, 10);530 const lastAt = events.length ? events[events.length - 1].at : 120;531 const cam = tween(frame, 10, lastAt + 30, camEase);532 const blink = 0.4 + 0.6 * (0.5 + 0.5 * Math.cos((frame / 30) * Math.PI * 2));533534 const heatSrc = landed.map((e) => ({535 ...project(e.lon, e.lat),536 w: tween(frame, e.at, e.at + 18),537 }));538 const hot = pal.dark ? lighten(accent, 0.28) : accent;539 const dots: React.ReactNode[] = [];540 LAND.forEach((row, r) => {541 for (let c = 0; c < row.length; c++) {542 if (row[c] !== "#") continue;543 const reveal = tween(frame, 4 + c * 0.12, 14 + c * 0.12);544 const cx = (c + 0.5) * PITCH;545 const cy = (r + 0.5) * PITCH_Y;546 let heat = 0;547 for (const h of heatSrc) {548 const d2 = (cx - h.x) ** 2 + (cy - h.y) ** 2;549 if (d2 < 900) heat += h.w * Math.exp(-d2 / 140);550 }551 heat = Math.min(1, heat);552 dots.push(553 <circle554 key={`${r}-${c}`}555 cx={cx}556 cy={cy}557 r={PITCH * (pal.dark ? 0.33 : 0.3)}558 fill={heat > 0.04 ? withAlpha(hot, 0.3 + 0.7 * heat) : pal.dot}559 opacity={reveal}560 />,561 );562 }563 });564565 const countryTotals = countries.map(566 (c) =>567 c.count +568 events.reduce(569 (sum, e, k) =>570 sum + (e.country === c.code && e.at <= frame ? inc(k) : 0),571 0,572 ),573 );574 const maxCountry = Math.max(...countryTotals);575576 const counter = (size: number, labelSize: number, onStage: boolean) => (577 <div>578 <div579 style={{580 fontSize: labelSize,581 color: onStage ? pal.stageMuted : pal.muted,582 display: "flex",583 alignItems: "center",584 gap: 10,585 }}586 >587 <span588 style={{589 width: labelSize * 0.45,590 height: labelSize * 0.45,591 borderRadius: 99,592 background: pal.green,593 opacity: blink,594 }}595 />596 {counterLabel}597 </div>598 <div599 style={{600 fontSize: size,601 fontWeight: 300,602 letterSpacing: "-0.045em",603 color: onStage ? (ink ?? pal.stageText) : fg,604 lineHeight: 1.08,605 marginTop: 6,606 overflow: "hidden",607 }}608 >609 <div610 style={{611 transform: `translateY(${(1 - tween(frame, 4, 18)) * 100}%)`,612 }}613 >614 <SnapCounter value={fmt(count)} changedAt={changedAt} frame={frame} />615 </div>616 </div>617 <div618 style={{619 fontSize: labelSize,620 color: pal.green,621 marginTop: 6,622 fontVariantNumeric: "tabular-nums",623 opacity: tween(frame, 12, 22),624 }}625 >626 {delta}627 </div>628 </div>629 );630631 return (632 <AbsoluteFill633 style={{634 fontFamily,635 fontWeight: 400,636 overflow: "hidden",637 WebkitFontSmoothing: "antialiased",638 background:639 background === undefined640 ? pal.dark641 ? "#03050C"642 : "#EEECE8"643 : background === "transparent"644 ? undefined645 : background,646 }}647 >648 {background === undefined ? (649 <>650 <GshGround651 preset={ground ?? (pal.dark ? "europa" : "paper-crease")}652 params={groundParams ?? (pal.dark ? undefined : LIGHT_GROUND)}653 timeOffset={pal.dark ? 5 : 2}654 timeScale={0.3}655 />656 <AbsoluteFill style={{ background: pal.scrim }} />657 </>658 ) : null}659 <ScaleLayer scale={scale}>660 <div661 style={{662 position: "absolute",663 left: (W - D.w * s) / 2,664 top: (H - D.h * s) / 2,665 width: D.w,666 height: D.h,667 transformOrigin: "0 0",668 transform: `scale(${s})`,669 }}670 >671 <div672 style={{673 position: "absolute",674 inset: 0,675 transformOrigin: `${WIN.x + mapLeft + MAP_W / 2}px ${WIN.y + mapTop + mapH / 2}px`,676 transform: `scale(${1 + 0.03 * cam})`,677 }}678 >679 {tall ? (680 <div style={{ position: "absolute", left: 48, top: 88 }}>681 {counter(132, 26, true)}682 </div>683 ) : null}684 <div685 style={{686 position: "absolute",687 left: WIN.x,688 top: WIN.y,689 width: WIN.w,690 height: WIN.h,691 opacity: winA,692 transform: `translateY(${(1 - win) * 48}px) scale(${0.97 + 0.03 * win})`,693 transformOrigin: "50% 100%",694 borderRadius: 16,695 background: pal.win,696 boxShadow: pal.winShadow,697 overflow: "hidden",698 }}699 >700 <div701 style={{702 height: HEAD_H,703 display: "flex",704 alignItems: "center",705 gap: 14,706 padding: `0 ${PAD}px`,707 borderBottom: `1px solid ${pal.line}`,708 }}709 >710 <span711 style={{712 fontSize: 20,713 color: fg,714 letterSpacing: "-0.01em",715 }}716 >717 {title}718 </span>719 <div style={{ flex: 1 }} />720 <span style={{ fontSize: 16, color: pal.muted }}>721 {rangeLabel}722 </span>723 </div>724725 <svg726 width={MAP_W}727 height={mapH}728 style={{729 position: "absolute",730 left: mapLeft,731 top: mapTop,732 overflow: "visible",733 }}734 >735 {dots}736 {events.map((e, k) => {737 if (k === 0) return null;738 const a = project(events[k - 1].lon, events[k - 1].lat);739 const b = project(e.lon, e.lat);740 const head = tween(frame, e.at - 12, e.at, moveEase);741 const tail = tween(frame, e.at - 3, e.at + 12, moveEase);742 if (head <= 0 || tail >= 1) return null;743 const mx = (a.x + b.x) / 2;744 const my = (a.y + b.y) / 2;745 const dist = Math.hypot(b.x - a.x, b.y - a.y);746 return (747 <path748 key={`arc-${e.name}`}749 d={`M${a.x} ${a.y} Q${mx} ${my - dist * 0.32} ${b.x} ${b.y}`}750 fill="none"751 stroke={hot}752 strokeWidth={1.75}753 strokeLinecap="round"754 pathLength={1}755 strokeDasharray={`${Math.max(0.0001, head - tail)} 2`}756 strokeDashoffset={-tail}757 />758 );759 })}760 {events.map((e) => {761 if (frame < e.at) return null;762 const p = project(e.lon, e.lat);763 const land = sp(e.at, CHIP);764 const ring = tween(frame, e.at, e.at + 24);765 return (766 <g key={`city-${e.name}`}>767 <circle768 cx={p.x}769 cy={p.y}770 r={4 + 18 * ring}771 fill="none"772 stroke={hot}773 strokeWidth={1.5}774 opacity={0.6 * (1 - ring)}775 />776 <circle777 cx={p.x}778 cy={p.y}779 r={Math.max(0, 4 * land)}780 fill={hot}781 stroke={pal.win}782 strokeWidth={1.5}783 />784 </g>785 );786 })}787 </svg>788 {events.map((e, k) => {789 const nextAt = events[k + 1]?.at ?? e.at + 40;790 const hold = Math.max(14, Math.min(26, nextAt - e.at + 8));791 const a = sp(e.at + 1, CHIP);792 const out = tween(793 frame,794 e.at + hold,795 e.at + hold + 6,796 exitEase,797 );798 if (frame < e.at + 1 || out >= 1) return null;799 const p = project(e.lon, e.lat);800 return (801 <div802 key={`label-${e.name}`}803 style={{804 position: "absolute",805 left: mapLeft + p.x,806 top: mapTop + p.y - 14,807 transform: `translate(-50%, -100%) translateY(${(1 - a) * 8 - out * 6}px) scale(${0.8 + 0.2 * a})`,808 transformOrigin: "50% 100%",809 opacity: clamp(a * 2, 0, 1) * (1 - out),810 display: "flex",811 alignItems: "center",812 gap: 8,813 height: 34,814 padding: "0 12px 0 5px",815 borderRadius: 99,816 background: pal.chip,817 boxShadow: pal.chipShadow,818 fontSize: 16,819 color: fg,820 whiteSpace: "nowrap",821 zIndex: 3,822 }}823 >824 <Avatar name={e.name} size={24} />825 {e.name.split(" ")[0]}826 <span style={{ color: pal.muted }}>{e.city}</span>827 </div>828 );829 })}830831 <div832 style={{833 position: "absolute",834 left: mapLeft,835 top: countryY,836 width: MAP_W,837 height: COUNTRY_H,838 display: "flex",839 gap: 20,840 }}841 >842 {countries.map((c, i) => {843 const a = tween(frame, 10 + i * 3, 22 + i * 3);844 const bumpAt = events845 .filter((e) => e.country === c.code && e.at <= frame)846 .map((e) => e.at)847 .pop();848 const bump =849 bumpAt === undefined850 ? 0851 : 1 - tween(frame, bumpAt, bumpAt + 24);852 const fill = sp(10 + i * 3, CARD);853 return (854 <div855 key={c.code}856 style={{857 flex: 1,858 minWidth: 0,859 opacity: a,860 transform: `translateY(${(1 - a) * 8}px)`,861 }}862 >863 <div864 style={{865 fontSize: 16,866 color: pal.muted,867 whiteSpace: "nowrap",868 }}869 >870 {c.name}871 </div>872 <div873 style={{874 fontSize: 22,875 fontWeight: 300,876 color: bump > 0.35 ? accent : fg,877 marginTop: 2,878 fontVariantNumeric: "tabular-nums",879 letterSpacing: "-0.01em",880 }}881 >882 {fmt(countryTotals[i])}883 </div>884 <div885 style={{886 height: 3,887 borderRadius: 2,888 background: pal.line,889 marginTop: 8,890 }}891 >892 <div893 style={{894 width: `${(countryTotals[i] / maxCountry) * 100 * clamp(fill, 0, 1.03)}%`,895 height: "100%",896 borderRadius: 2,897 background: accent,898 }}899 />900 </div>901 </div>902 );903 })}904 </div>905906 {tall ? (907 <div908 style={{909 position: "absolute",910 left: PAD,911 right: PAD,912 top: SIDE.y - 14,913 height: 1,914 background: pal.line,915 }}916 />917 ) : (918 <div919 style={{920 position: "absolute",921 left: SIDE.x - 16,922 top: HEAD_H,923 bottom: 0,924 width: 1,925 background: pal.line,926 }}927 />928 )}929 {!tall ? (930 <div931 style={{932 position: "absolute",933 left: SIDE.x,934 top: SIDE.y,935 width: SIDE.w,936 }}937 >938 {counter(60, 16, false)}939 </div>940 ) : null}941 <div942 style={{943 position: "absolute",944 left: SIDE.x,945 top: feedTop - 36,946 fontSize: 16,947 color: pal.muted,948 }}949 >950 {feedLabel}951 </div>952 <div953 style={{954 position: "absolute",955 left: SIDE.x,956 top: feedTop,957 width: SIDE.w,958 bottom: 0,959 overflow: "hidden",960 maskImage:961 "linear-gradient(to bottom, black 70%, transparent)",962 }}963 >964 {events.map((e, k) => {965 if (e.at > frame) return null;966 let y = 0;967 for (let j = k + 1; j < events.length; j++) {968 if (events[j].at <= frame)969 y += ROW * sp(events[j].at, CARD);970 }971 if (y > ROW * 8) return null;972 const a = tween(frame, e.at + 1, e.at + 10);973 const hl = 1 - tween(frame, e.at + 6, e.at + 30, moveEase);974 return (975 <div976 key={`row-${e.name}`}977 style={{978 position: "absolute",979 left: -10,980 right: -10,981 top: y,982 height: ROW - 6,983 display: "flex",984 alignItems: "center",985 gap: 14,986 padding: "0 10px",987 borderRadius: 10,988 background: withAlpha(989 accent,990 (pal.dark ? 0.1 : 0.07) * hl,991 ),992 }}993 >994 <div995 style={{996 flex: 1,997 minWidth: 0,998 display: "flex",999 alignItems: "center",1000 gap: 14,1001 opacity: a,1002 transform: `translateY(${(1 - a) * -8}px)`,1003 }}1004 >1005 <Avatar name={e.name} size={34} />1006 <div style={{ flex: 1, minWidth: 0 }}>1007 <div1008 style={{1009 fontSize: 17,1010 color: fg,1011 whiteSpace: "nowrap",1012 }}1013 >1014 {e.name}1015 </div>1016 <div1017 style={{1018 fontSize: 16,1019 color: pal.muted,1020 marginTop: 1,1021 whiteSpace: "nowrap",1022 }}1023 >1024 {e.city}, {e.country}1025 </div>1026 </div>1027 <span1028 style={{1029 fontSize: 16,1030 color:1031 e.plan && e.plan !== "Free" ? accent : pal.faint,1032 }}1033 >1034 {e.plan ?? "Free"}1035 </span>1036 </div>1037 </div>1038 );1039 })}1040 </div>1041 </div>1042 </div>1043 </div>1044 </ScaleLayer>1045 </AbsoluteFill>1046 );1047}









