File Dropzone
Files drop into a knowledge base list and an upload toast confirms.
Source
components/kuchi/file-dropzone.tsx
1"use client";23import { loadFont as loadGeist } from "@remotion/google-fonts/Geist";4import { loadFont as loadGeistMono } from "@remotion/google-fonts/GeistMono";5import type React from "react";6import {7 AbsoluteFill,8 Easing,9 Img,10 interpolate,11 spring,12 useCurrentFrame,13 useVideoConfig,14} from "remotion";15import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";16import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";17import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1819const geist = loadGeist("normal", {20 weights: ["300", "400"],21 subsets: ["latin"],22});23const geistMono = loadGeistMono("normal", {24 weights: ["400"],25 subsets: ["latin"],26});2728export type DropFileType = "pdf" | "png" | "csv" | "doc" | "zip";2930export interface DropFile {31 name: string;32 /** Size in bytes. */33 size: number;34 /** Inferred from the extension when omitted. */35 type?: DropFileType;36}3738export interface FileDropzoneProps {39 files?: DropFile[];40 title?: string;41 /** Where the files go; shown in the window, the rows and the toast. */42 destination?: string;43 /** Preview used for image files. */44 image?: string;45 /** Line in the empty drop zone, before the "browse" link. */46 prompt?: string;47 /** Line in the drop zone while files hover over it. */48 releaseLabel?: string;49 /** Accepted types and size limit under the prompt. */50 hint?: string;51 accent?: string;52 /** Text color; overrides the theme ink. */53 ink?: string;54 /** Solid fill in place of the gradient ground; "transparent" drops it. */55 background?: string;56 /** Typeface for the copy. Load it yourself; Geist by default. */57 fontFamily?: string;58 /** Size of the window, around the frame's center. */59 scale?: number;60 /** Frames to hold the first frame before anything moves. */61 delay?: number;62 speed?: number;63 theme?: "light" | "dark";64 ground?: GshPresetId;65 groundParams?: Partial<GradientParams>;66}6768const DEFAULT_FILES: DropFile[] = [69 { name: "Q3-board-deck.pdf", size: 4_200_000 },70 { name: "hero-shot@2x.png", size: 1_800_000 },71 { name: "customers-export.csv", size: 640_000 },72];7374const BG_ROWS = [75 ["Brand guidelines 2026.pdf", "PDF", "2.1 MB", "Oct 21"],76 ["Interview notes, Leo Park.docx", "DOC", "184 KB", "Oct 20"],77 ["Pricing research.csv", "CSV", "96 KB", "Oct 18"],78 ["Onboarding flow v3.png", "PNG", "3.4 MB", "Oct 17"],79 ["Competitive landscape.pdf", "PDF", "1.2 MB", "Oct 14"],80 ["Support tickets Q3.csv", "CSV", "712 KB", "Oct 12"],81 ["Roadmap review.pdf", "PDF", "880 KB", "Oct 9"],82];8384const SPR = {85 heavy: { mass: 1, damping: 26, stiffness: 120 },86 card: { mass: 0.8, damping: 18, stiffness: 160 },87 chip: { mass: 0.5, damping: 12, stiffness: 200 },88 morph: { damping: 200 },89};90const EASE = {91 enter: Easing.bezier(0.32, 0.72, 0, 1),92 soft: Easing.bezier(0.22, 1, 0.36, 1),93 move: Easing.bezier(0.65, 0, 0.35, 1),94 exit: Easing.bezier(0.55, 0, 1, 0.45),95 camera: Easing.bezier(0.87, 0, 0.13, 1),96};97const CL = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;98const clamp01 = (v: number) => Math.min(1, Math.max(0, v));99const tween = (100 f: number,101 from: number,102 len: number,103 easing: (t: number) => number,104) => interpolate(f, [from, from + len], [0, 1], { ...CL, easing });105106const BEAT = {107 window: 0,108 modal: 6,109 cursor: 10,110 hover: 32,111 drop: 46,112};113114const HEADER_H = 76;115const DZ_OPEN = 176;116const DZ_SHUT = 108;117const ROW_H = 68;118const FOOTER_H = 76;119const PAD = 24;120const THUMB = { w: 36, h: 44 };121const CARD = { w: 112, h: 140 };122const ARROW =123 "M1 1 L1 18.5 L5.6 14.4 L8.7 21.6 L11.6 20.4 L8.5 13.2 L14.5 13.2 Z";124125function withAlpha(color: string, alpha: number) {126 const hex = color.replace("#", "");127 const full = hex.length === 3 ? hex.replace(/(.)/g, "$1$1") : hex;128 if (!/^[0-9a-fA-F]{6}$/.test(full)) return color;129 const n = Number.parseInt(full, 16);130 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;131}132133function fileType(f: DropFile): DropFileType {134 if (f.type) return f.type;135 const ext = f.name.split(".").pop()?.toLowerCase() ?? "";136 if (ext === "png" || ext === "jpg" || ext === "jpeg") return "png";137 if (ext === "csv" || ext === "xlsx") return "csv";138 if (ext === "zip") return "zip";139 if (ext === "pdf") return "pdf";140 return "doc";141}142143function formatSize(b: number) {144 if (b >= 1_000_000) return `${(b / 1_000_000).toFixed(1)} MB`;145 return `${Math.round(b / 1000)} KB`;146}147148const LIGHT = {149 win: "#FCFCFB",150 modal: "#FFFFFF",151 text: "#18181B",152 muted: "#71717A",153 faint: "#A1A1AA",154 line: "rgba(24,24,27,0.08)",155 dash: "rgba(24,24,27,0.2)",156 zone: "#FAFAF9",157 track: "rgba(24,24,27,0.08)",158 ghost: "rgba(24,24,27,0.05)",159 disabledBg: "rgba(24,24,27,0.06)",160 disabledText: "#A1A1AA",161 overlay: "rgba(24,24,27,0.16)",162 toastBg: "#18181B",163 toastText: "#FAFAFA",164 toastMuted: "#A1A1AA",165 winShadow:166 "0 0 0 1px rgba(24,24,27,0.06), 0 2px 6px rgba(24,24,27,0.04), 0 40px 90px -30px rgba(24,24,40,0.35)",167 modalShadow:168 "0 0 0 1px rgba(24,24,27,0.06), 0 2px 4px rgba(24,24,27,0.04), 0 28px 64px -16px rgba(24,24,40,0.3)",169 btnShadow: "0 0 0 1px rgba(24,24,27,0.1), 0 1px 2px rgba(24,24,27,0.06)",170};171const DARK: typeof LIGHT = {172 win: "#0E0F11",173 modal: "#17181B",174 text: "#EDEDEF",175 muted: "#8B8D94",176 faint: "#5A5C63",177 line: "rgba(255,255,255,0.07)",178 dash: "rgba(255,255,255,0.18)",179 zone: "rgba(255,255,255,0.02)",180 track: "rgba(255,255,255,0.08)",181 ghost: "rgba(255,255,255,0.05)",182 disabledBg: "rgba(255,255,255,0.06)",183 disabledText: "#5A5C63",184 overlay: "rgba(0,0,0,0.42)",185 toastBg: "#EDEDEF",186 toastText: "#141517",187 toastMuted: "#6B6D74",188 winShadow:189 "0 0 0 1px rgba(255,255,255,0.08), inset 0 1px 0 rgba(255,255,255,0.05), 0 40px 90px -30px rgba(0,0,0,0.7)",190 modalShadow:191 "0 0 0 1px rgba(255,255,255,0.09), inset 0 1px 0 rgba(255,255,255,0.06), 0 28px 64px -16px rgba(0,0,0,0.7)",192 btnShadow: "0 0 0 1px rgba(255,255,255,0.1)",193};194195const LIGHT_GROUND: Partial<GradientParams> = {196 colors: ["#7f9cff", "#b9c6ff", "#e2e6fb", "#3b5bfd"],197 background: "#efeeea",198};199200function FilePreview({201 type,202 w,203 h,204 r,205 image,206}: {207 type: DropFileType;208 w: number;209 h: number;210 r: number;211 image: string;212}) {213 const box: React.CSSProperties = {214 position: "relative",215 width: w,216 height: h,217 borderRadius: r,218 overflow: "hidden",219 background: "#FFFFFF",220 flexShrink: 0,221 };222 const edge = (223 <div224 style={{225 position: "absolute",226 inset: 0,227 borderRadius: r,228 boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.1)",229 }}230 />231 );232 if (type === "png") {233 return (234 <div style={box}>235 <Img236 src={image}237 style={{ width: "100%", height: "100%", objectFit: "cover" }}238 />239 {edge}240 </div>241 );242 }243 const pad = w * 0.13;244 if (type === "csv") {245 const rows = 9;246 return (247 <div style={box}>248 <div249 style={{250 position: "absolute",251 left: 0,252 right: 0,253 top: 0,254 height: h / (rows + 1),255 background: "#EEF1F0",256 }}257 />258 {Array.from({ length: rows }, (_, i) => (259 <div260 key={`r${i}`}261 style={{262 position: "absolute",263 left: 0,264 right: 0,265 top: ((i + 1) * h) / (rows + 1),266 height: 1,267 background: "rgba(0,0,0,0.07)",268 }}269 />270 ))}271 {[0.38, 0.7].map((x) => (272 <div273 key={`c${x}`}274 style={{275 position: "absolute",276 top: 0,277 bottom: 0,278 left: w * x,279 width: 1,280 background: "rgba(0,0,0,0.07)",281 }}282 />283 ))}284 {Array.from({ length: rows }, (_, i) => (285 <div286 key={`v${i}`}287 style={{288 position: "absolute",289 left: w * 0.06,290 top: ((i + 1.38) * h) / (rows + 1),291 width: w * (0.18 + ((i * 7) % 5) * 0.025),292 height: Math.max(1.5, h * 0.022),293 borderRadius: 2,294 background: "rgba(0,0,0,0.22)",295 }}296 />297 ))}298 {edge}299 </div>300 );301 }302 const lines = [0.92, 0.86, 0.9, 0.62, 0, 0.88, 0.94, 0.7];303 return (304 <div style={box}>305 <div306 style={{307 position: "absolute",308 left: pad,309 top: pad,310 width: w * 0.5,311 height: Math.max(2, h * 0.045),312 borderRadius: 2,313 background: "#1C1C1F",314 }}315 />316 {lines.map((l, i) =>317 l === 0 ? null : (318 <div319 key={`l${i}`}320 style={{321 position: "absolute",322 left: pad,323 top: pad + h * 0.12 + i * h * 0.055,324 width: (w - pad * 2) * l,325 height: Math.max(1.5, h * 0.022),326 borderRadius: 2,327 background: "rgba(0,0,0,0.16)",328 }}329 />330 ),331 )}332 <div333 style={{334 position: "absolute",335 left: pad,336 right: pad,337 bottom: pad,338 height: h * 0.2,339 borderRadius: 2,340 background: "#E8ECFF",341 }}342 />343 {edge}344 </div>345 );346}347348function Icon({349 d,350 size = 20,351 color,352 width = 1.5,353}: {354 d: string;355 size?: number;356 color: string;357 width?: number;358}) {359 return (360 <svg361 width={size}362 height={size}363 viewBox="0 0 24 24"364 fill="none"365 stroke={color}366 strokeWidth={width}367 strokeLinecap="round"368 strokeLinejoin="round"369 style={{ display: "block", flexShrink: 0 }}370 >371 <path d={d} />372 </svg>373 );374}375376const ICONS = {377 upload:378 "M12 15V4.5M7.5 9L12 4.5 16.5 9M4.5 14.5V18a1.5 1.5 0 001.5 1.5h12a1.5 1.5 0 001.5-1.5v-3.5",379 close: "M6.5 6.5l11 11M17.5 6.5l-11 11",380 check: "M5.5 12.5l4 4 9-9.5",381};382383/** The foreground at `scale`, around the frame's center; nothing extra at 1. */384function ScaleLayer({385 scale,386 children,387}: {388 scale: number;389 children: React.ReactNode;390}) {391 if (scale === 1) return children;392 return (393 <AbsoluteFill style={{ transform: `scale(${scale})` }}>394 {children}395 </AbsoluteFill>396 );397}398399export function FileDropzone({400 files = DEFAULT_FILES,401 title = "Upload files",402 destination = "Research",403 image = "https://kuchi-media.kalarislabs.com/components/art/art-02.svg",404 prompt = "Drop files here or",405 releaseLabel = "Release to upload",406 hint = "PDF, PNG or CSV, up to 50 MB",407 accent = "#3B5BFD",408 ink,409 background,410 fontFamily = geist.fontFamily,411 scale = 1,412 delay = 0,413 speed = 1,414 theme = "light",415 ground,416 groundParams,417}: FileDropzoneProps) {418 const frame = Math.max(0, useCurrentFrame() - delay) * speed;419 const { width, height, fps } = useVideoConfig();420 const tall = height > width;421 const SW = tall ? 600 : 1280;422 const SH = tall ? (600 * height) / width : 720;423 const k = width / SW;424 const dark = theme === "dark";425 const c = dark ? DARK : LIGHT;426 const fg = ink ?? c.text;427 const list = files.slice(0, 3);428 const n = list.length;429 const sp = (at: number, config: Record<string, number>) =>430 spring({ frame: frame - at, fps, config });431432 const WIN = tall433 ? { x: 20, y: 96, w: SW - 40, h: SH }434 : { x: 120, y: 48, w: SW - 240, h: 616 };435 const MODAL_W = tall ? SW - 40 : 600;436 const modalLeft = (SW - MODAL_W) / 2;437 const centerY = tall ? 480 : SH / 2 - 4;438439 const rowAt = list.map((_, i) => BEAT.drop + 4 + i * 4);440 const rowIn = rowAt.map((at) => sp(at, SPR.card));441 const dur = list.map((f) =>442 Math.round(Math.min(50, Math.max(24, 20 + (f.size / 1_000_000) * 7))),443 );444 const startAt = rowAt.map((at) => at + 4);445 const doneAt = list.map((_, i) => startAt[i] + dur[i]);446 const progress = list.map((_, i) =>447 interpolate(448 frame,449 [450 startAt[i],451 startAt[i] + dur[i] * 0.42,452 startAt[i] + dur[i] * 0.62,453 doneAt[i],454 ],455 [0, 0.47, 0.58, 1],456 { ...CL, easing: EASE.move },457 ),458 );459 const allDone = Math.max(...doneAt, BEAT.drop + 10);460 const ENABLE = allDone + 2;461 const TO_BTN = allDone - 12;462 const CLICK = ENABLE + 10;463 const CLOSE = CLICK + 4;464 const TABLE = CLOSE + 4;465 const TOAST = CLOSE + 12;466467 const shut = sp(BEAT.drop + 2, SPR.morph);468 const dzH = DZ_OPEN + (DZ_SHUT - DZ_OPEN) * shut;469 const listH = rowIn.reduce((a, b) => a + Math.min(1, b), 0) * ROW_H;470 const modalH = HEADER_H + dzH + 12 + listH + 8 + FOOTER_H;471 const modalTop = centerY - modalH / 2;472 const finalH = HEADER_H + DZ_SHUT + 12 + n * ROW_H + 8 + FOOTER_H;473 const finalTop = centerY - finalH / 2;474 const dzTop = modalTop + HEADER_H;475 const rowsTop = dzTop + dzH + 12;476 const btnW = 168;477 const btn = {478 x: modalLeft + MODAL_W - PAD - btnW / 2,479 y: finalTop + finalH - FOOTER_H / 2,480 };481482 const start = tall ? { x: 660, y: 1130 } : { x: 1340, y: 800 };483 const zone = { x: SW / 2 + (tall ? 70 : 120), y: centerY - 76 };484 const aside = { x: zone.x + (tall ? 110 : 190), y: zone.y + 150 };485 const legs = [486 { at: BEAT.cursor, from: start, to: zone, arc: -1 },487 { at: BEAT.drop + 6, from: zone, to: aside, arc: 1 },488 { at: TO_BTN, from: aside, to: btn, arc: -1 },489 { at: CLICK + 12, from: btn, to: { x: btn.x + 46, y: btn.y + 64 }, arc: 1 },490 ];491 const cursorAt = (f: number) => {492 let x = start.x;493 let y = start.y;494 for (const leg of legs) {495 const p = spring({ frame: f - leg.at, fps, config: SPR.heavy });496 const dx = leg.to.x - leg.from.x;497 const dy = leg.to.y - leg.from.y;498 const len = Math.hypot(dx, dy) || 1;499 const bend = Math.sin(clamp01(p) * Math.PI) * Math.min(70, len * 0.16);500 x += dx * p + (-dy / len) * bend * leg.arc;501 y += dy * p + (dx / len) * bend * leg.arc;502 }503 return { x, y };504 };505 const cur = cursorAt(frame);506 const held = cursorAt(Math.min(frame, BEAT.drop) - 2);507 const press = clamp01(sp(CLICK - 2, SPR.chip) - sp(CLICK + 3, SPR.chip));508509 const hot = clamp01(sp(BEAT.hover, SPR.card) - sp(BEAT.drop + 2, SPR.card));510 const winIn = sp(BEAT.window, SPR.heavy);511 const winOp = tween(frame, BEAT.window, 10, EASE.enter);512 const modalIn = sp(BEAT.modal, SPR.card);513 const modalOp = tween(frame, BEAT.modal, 8, EASE.enter);514 const close = tween(frame, CLOSE, 8, EASE.exit);515 const dim =516 tween(frame, BEAT.modal, 12, EASE.soft) *517 (1 - tween(frame, CLOSE, 12, EASE.soft));518 const enabled = tween(frame, ENABLE, 6, EASE.enter);519 const toastIn = sp(TOAST, SPR.card);520 const toastOp = tween(frame, TOAST, 6, EASE.enter);521 const cam =522 1 +523 0.035 * tween(frame, 8, 54, EASE.camera) -524 0.035 * tween(frame, CLOSE - 2, 26, EASE.camera);525 const cursorOp = tween(frame, BEAT.cursor, 4, EASE.enter);526 const badge =527 sp(BEAT.cursor + 4, SPR.chip) * (1 - tween(frame, BEAT.drop, 5, EASE.exit));528 const total = list.reduce((a, f) => a + f.size, 0);529 const dzLive = hot > 0.5;530531 const table = [532 ...list.map((f, i) => ({533 cells: [534 f.name,535 fileType(f).toUpperCase(),536 formatSize(f.size),537 "Just now",538 ],539 fresh: i,540 })),541 ...BG_ROWS.map((cells) => ({ cells, fresh: -1 })),542 ];543 const cols = tall544 ? [545 { i: 0, w: 0 },546 { i: 2, w: 110 },547 ]548 : [549 { i: 0, w: 0 },550 { i: 1, w: 120 },551 { i: 2, w: 120 },552 { i: 3, w: 130 },553 ];554 const tint = 1 - tween(frame, TABLE + 24, 40, EASE.soft);555556 return (557 <AbsoluteFill558 style={{559 fontFamily,560 WebkitFontSmoothing: "antialiased",561 overflow: "hidden",562 }}563 >564 {background === undefined ? (565 <GshGround566 preset={ground ?? (dark ? "earthshine" : "paper-crease")}567 params={groundParams ?? (dark ? undefined : LIGHT_GROUND)}568 timeOffset={3}569 timeScale={0.5}570 />571 ) : (572 <AbsoluteFill573 style={{574 background: background === "transparent" ? undefined : background,575 }}576 />577 )}578 <ScaleLayer scale={scale}>579 <div580 style={{581 position: "absolute",582 left: 0,583 top: 0,584 width: SW,585 height: SH,586 transform: `scale(${k})`,587 transformOrigin: "0 0",588 }}589 >590 <div591 style={{592 position: "absolute",593 inset: 0,594 transform: `scale(${cam})`,595 transformOrigin: `${SW / 2}px ${centerY}px`,596 }}597 >598 <div599 style={{600 position: "absolute",601 left: WIN.x,602 top: WIN.y,603 width: WIN.w,604 height: WIN.h,605 borderRadius: 18,606 overflow: "hidden",607 background: c.win,608 boxShadow: c.winShadow,609 opacity: winOp,610 transform: `translateY(${(1 - winIn) * 40}px)`,611 }}612 >613 <div614 style={{615 position: "absolute",616 inset: 0,617 padding: tall ? "32px 28px" : "36px 40px",618 filter: `blur(${dim * 2}px)`,619 }}620 >621 <div style={{ display: "flex", alignItems: "flex-end" }}>622 <div>623 <div style={{ fontSize: 16, color: c.muted }}>Library</div>624 <div625 style={{626 fontSize: 30,627 fontWeight: 400,628 letterSpacing: "-0.025em",629 color: fg,630 marginTop: 6,631 }}632 >633 {destination}634 </div>635 </div>636 <div637 style={{638 marginLeft: "auto",639 height: 40,640 padding: "0 16px",641 borderRadius: 10,642 display: "flex",643 alignItems: "center",644 gap: 8,645 fontSize: 16,646 color: fg,647 boxShadow: c.btnShadow,648 }}649 >650 <Icon d={ICONS.upload} size={18} color={fg} />651 Upload652 </div>653 </div>654 <div style={{ marginTop: 30 }}>655 <div656 style={{657 display: "flex",658 height: 40,659 alignItems: "center",660 fontSize: 16,661 color: c.muted,662 borderBottom: `1px solid ${c.line}`,663 }}664 >665 {cols.map((col) => (666 <span667 key={col.i}668 style={col.w ? { width: col.w } : { flex: 1 }}669 >670 {["Name", "Kind", "Size", "Added"][col.i]}671 </span>672 ))}673 </div>674 {table.map((r) => {675 const fresh = r.fresh >= 0;676 const p = fresh ? sp(TABLE + r.fresh * 4, SPR.card) : 1;677 const hgt = 54 * Math.min(1, p);678 if (fresh && hgt <= 0.01) return null;679 return (680 <div681 key={r.cells[0]}682 style={{683 height: hgt,684 overflow: "hidden",685 borderBottom: `1px solid ${c.line}`,686 background: fresh687 ? withAlpha(accent, (dark ? 0.12 : 0.07) * tint)688 : "transparent",689 margin: "0 -12px",690 padding: "0 12px",691 borderRadius: 8,692 }}693 >694 <div695 style={{696 display: "flex",697 alignItems: "center",698 height: 54,699 fontSize: 17,700 color: fg,701 opacity: fresh ? clamp01(p * 1.4 - 0.3) : 1,702 transform: `translateY(${(1 - p) * -10}px)`,703 }}704 >705 {cols.map((col) => (706 <span707 key={col.i}708 style={{709 ...(col.w ? { width: col.w } : { flex: 1 }),710 color: col.i === 0 ? fg : c.muted,711 fontFamily:712 col.i === 2713 ? geistMono.fontFamily714 : undefined,715 fontSize: col.i === 2 ? 15.5 : 17,716 fontVariantNumeric: "tabular-nums",717 whiteSpace: "nowrap",718 overflow: "hidden",719 textOverflow: "ellipsis",720 paddingRight: col.i === 0 ? 16 : 0,721 }}722 >723 {col.i === 3 && fresh ? (724 <span style={{ color: accent }}>725 {r.cells[3]}726 </span>727 ) : (728 r.cells[col.i]729 )}730 </span>731 ))}732 </div>733 </div>734 );735 })}736 </div>737 </div>738 <div739 style={{740 position: "absolute",741 inset: 0,742 background: c.overlay,743 opacity: dim,744 }}745 />746 </div>747748 <div749 style={{750 position: "absolute",751 left: modalLeft,752 top: modalTop,753 width: MODAL_W,754 height: modalH,755 borderRadius: 20,756 background: c.modal,757 boxShadow: c.modalShadow,758 overflow: "hidden",759 opacity: modalOp * (1 - close),760 transform: `translateY(${(1 - modalIn) * 18 + close * 10}px) scale(${(0.97 + 0.03 * modalIn) * (1 - 0.03 * close)})`,761 }}762 >763 <div764 style={{765 height: HEADER_H,766 display: "flex",767 alignItems: "center",768 padding: `0 ${PAD}px`,769 }}770 >771 <div772 style={{773 fontSize: 21,774 letterSpacing: "-0.015em",775 color: fg,776 }}777 >778 {title}779 </div>780 <div style={{ marginLeft: "auto" }}>781 <Icon d={ICONS.close} size={20} color={c.muted} />782 </div>783 </div>784 <div785 style={{786 position: "relative",787 margin: `0 ${PAD}px`,788 height: dzH,789 borderRadius: 12,790 background: dzLive ? withAlpha(accent, 0.06) : c.zone,791 display: "flex",792 flexDirection: "column",793 alignItems: "center",794 justifyContent: "center",795 gap: 10,796 }}797 >798 <svg799 width="100%"800 height="100%"801 style={{ position: "absolute", inset: 0 }}802 aria-hidden803 >804 <rect805 x={0.5}806 y={0.5}807 width={MODAL_W - PAD * 2 - 1}808 height={dzH - 1}809 rx={11.5}810 fill="none"811 stroke={812 hot > 0.02 ? withAlpha(accent, 0.3 + 0.7 * hot) : c.dash813 }814 strokeWidth={1}815 strokeDasharray={dzLive ? undefined : "5 5"}816 />817 </svg>818 <div819 style={{820 transform: `translateY(${-hot * 4}px)`,821 }}822 >823 <Icon824 d={ICONS.upload}825 size={26}826 color={hot > 0.5 ? accent : c.muted}827 />828 </div>829 <div style={{ fontSize: 17, color: fg }}>830 {dzLive ? (831 <span style={{ color: accent }}>{releaseLabel}</span>832 ) : (833 <>834 {prompt} <span style={{ color: accent }}>browse</span>835 </>836 )}837 </div>838 <div839 style={{840 fontSize: 16,841 color: c.muted,842 opacity: 1 - shut,843 height: 22 * (1 - shut),844 overflow: "hidden",845 }}846 >847 {hint}848 </div>849 </div>850 <div851 style={{852 position: "relative",853 margin: `12px ${PAD}px 0`,854 height: listH,855 }}856 >857 {list.map((f, i) => {858 const p = progress[i];859 const done = frame >= doneAt[i];860 const tick = tween(frame, doneAt[i], 8, EASE.enter);861 const before = rowIn862 .slice(0, i)863 .reduce((a, b) => a + Math.min(1, b), 0);864 const fly = sp(BEAT.drop + i * 3, SPR.card);865 return (866 <div867 key={f.name}868 style={{869 position: "absolute",870 left: 0,871 right: 0,872 top: before * ROW_H,873 height: ROW_H,874 display: "flex",875 alignItems: "center",876 gap: 14,877 borderTop: i > 0 ? `1px solid ${c.line}` : "none",878 opacity: clamp01(rowIn[i] * 1.6),879 }}880 >881 <div style={{ opacity: clamp01((fly - 0.82) / 0.18) }}>882 <FilePreview883 type={fileType(f)}884 w={THUMB.w}885 h={THUMB.h}886 r={6}887 image={image}888 />889 </div>890 <div style={{ flex: 1, minWidth: 0 }}>891 <div892 style={{893 display: "flex",894 alignItems: "baseline",895 fontSize: 17,896 color: fg,897 }}898 >899 <span900 style={{901 whiteSpace: "nowrap",902 overflow: "hidden",903 textOverflow: "ellipsis",904 }}905 >906 {f.name}907 </span>908 <span909 style={{910 marginLeft: "auto",911 paddingLeft: 12,912 fontFamily: geistMono.fontFamily,913 fontSize: 15.5,914 color: c.muted,915 fontVariantNumeric: "tabular-nums",916 whiteSpace: "nowrap",917 }}918 >919 {done920 ? formatSize(f.size)921 : `${Math.round(p * 100)}%`}922 </span>923 </div>924 <div925 style={{926 height: 2,927 borderRadius: 1,928 background: c.track,929 marginTop: 10,930 overflow: "hidden",931 opacity: 1 - tick,932 }}933 >934 <div935 style={{936 width: `${p * 100}%`,937 height: "100%",938 background: accent,939 }}940 />941 </div>942 </div>943 <div944 style={{945 width: 22,946 display: "flex",947 justifyContent: "flex-end",948 }}949 >950 <svg951 width={22}952 height={22}953 viewBox="0 0 24 24"954 style={{ opacity: done ? 1 : 0 }}955 aria-hidden956 >957 <path958 d={ICONS.check}959 fill="none"960 stroke={accent}961 strokeWidth={1.75}962 strokeLinecap="round"963 strokeLinejoin="round"964 strokeDasharray={20}965 strokeDashoffset={20 * (1 - tick)}966 />967 </svg>968 </div>969 </div>970 );971 })}972 </div>973 <div974 style={{975 position: "absolute",976 left: 0,977 right: 0,978 bottom: 0,979 height: FOOTER_H,980 borderTop: `1px solid ${c.line}`,981 display: "flex",982 alignItems: "center",983 gap: 10,984 padding: `0 ${PAD}px`,985 }}986 >987 <span988 style={{989 fontFamily: geistMono.fontFamily,990 fontSize: 15.5,991 color: c.muted,992 fontVariantNumeric: "tabular-nums",993 opacity: clamp01(rowIn[0] ?? 0),994 }}995 >996 {n} files · {formatSize(total)}997 </span>998 <div999 style={{1000 marginLeft: "auto",1001 height: 42,1002 padding: "0 18px",1003 borderRadius: 10,1004 display: "flex",1005 alignItems: "center",1006 fontSize: 16,1007 color: fg,1008 boxShadow: c.btnShadow,1009 }}1010 >1011 Cancel1012 </div>1013 <div1014 style={{1015 position: "relative",1016 width: btnW,1017 height: 42,1018 borderRadius: 10,1019 overflow: "hidden",1020 background: c.disabledBg,1021 transform: `scale(${1 - 0.04 * press})`,1022 }}1023 >1024 <div1025 style={{1026 position: "absolute",1027 inset: 0,1028 background: accent,1029 opacity: enabled,1030 boxShadow: "inset 0 1px 0 rgba(255,255,255,0.16)",1031 }}1032 />1033 <div1034 style={{1035 position: "absolute",1036 inset: 0,1037 display: "flex",1038 alignItems: "center",1039 justifyContent: "center",1040 fontSize: 16,1041 color: enabled > 0.5 ? "#FFFFFF" : c.disabledText,1042 }}1043 >1044 Upload {n} files1045 </div>1046 </div>1047 </div>1048 </div>10491050 <div1051 style={{1052 position: "absolute",1053 left: SW / 2 - (tall ? 250 : 230),1054 top: tall ? SH - 150 : WIN.y + WIN.h - 92,1055 width: tall ? 500 : 460,1056 height: 60,1057 borderRadius: 14,1058 background: c.toastBg,1059 boxShadow: dark1060 ? "0 18px 40px -12px rgba(0,0,0,0.6)"1061 : "0 2px 6px rgba(24,24,27,0.1), 0 18px 40px -12px rgba(24,24,40,0.45)",1062 display: "flex",1063 alignItems: "center",1064 gap: 12,1065 padding: "0 18px",1066 boxSizing: "border-box",1067 opacity: toastOp,1068 transform: `translateY(${(1 - toastIn) * 28}px) scale(${0.97 + 0.03 * toastIn})`,1069 }}1070 >1071 <Icon1072 d={ICONS.check}1073 size={20}1074 color={c.toastText}1075 width={1.75}1076 />1077 <span style={{ fontSize: 17, color: c.toastText }}>1078 {n} files added to {destination}1079 </span>1080 <span1081 style={{1082 marginLeft: "auto",1083 fontSize: 16,1084 color: c.toastMuted,1085 }}1086 >1087 View1088 </span>1089 </div>10901091 {list.map((f, i) => {1092 const kk = i - (n - 1) / 2;1093 const appear = sp(BEAT.cursor + i * 2, SPR.card);1094 const rest = {1095 x: held.x + 44 + kk * 20,1096 y: held.y + 62 + Math.abs(kk) * 6,1097 };1098 const target = {1099 x: modalLeft + PAD + THUMB.w / 2,1100 y: rowsTop + i * ROW_H + ROW_H / 2,1101 };1102 const fly = sp(BEAT.drop + i * 3, SPR.card);1103 const x = rest.x + (target.x - rest.x) * fly;1104 const y = rest.y + (target.y - rest.y) * fly;1105 const s =1106 (1 - fly * (1 - THUMB.w / CARD.w)) * (0.9 + 0.1 * appear);1107 const rot = kk * 8 * (1 - fly);1108 const o =1109 clamp01(appear * 2) * (1 - clamp01((fly - 0.82) / 0.18));1110 if (o <= 0.001) return null;1111 return (1112 <div1113 key={f.name}1114 style={{1115 position: "absolute",1116 left: x - CARD.w / 2,1117 top: y - CARD.h / 2,1118 opacity: o,1119 transform: `rotate(${rot}deg) scale(${s})`,1120 borderRadius: 10,1121 boxShadow: `0 1px 2px rgba(0,0,0,0.12), 0 ${16 * (1 - fly) + 4}px ${30 * (1 - fly) + 8}px -6px rgba(10,12,30,${0.4 * (1 - fly) + 0.1})`,1122 zIndex: i === 1 ? 3 : 2,1123 }}1124 >1125 <FilePreview1126 type={fileType(f)}1127 w={CARD.w}1128 h={CARD.h}1129 r={10}1130 image={image}1131 />1132 </div>1133 );1134 })}1135 {badge > 0.01 ? (1136 <div1137 style={{1138 position: "absolute",1139 left: cur.x + 92,1140 top: cur.y + 4,1141 width: 28,1142 height: 28,1143 borderRadius: 14,1144 background: accent,1145 color: "#FFFFFF",1146 fontSize: 16,1147 fontFamily: geistMono.fontFamily,1148 display: "flex",1149 alignItems: "center",1150 justifyContent: "center",1151 boxShadow: "0 4px 10px -2px rgba(10,12,30,0.35)",1152 transform: `scale(${badge})`,1153 zIndex: 4,1154 }}1155 >1156 {n}1157 </div>1158 ) : null}1159 <svg1160 width={26}1161 height={26}1162 viewBox="0 0 24 24"1163 style={{1164 position: "absolute",1165 left: cur.x,1166 top: cur.y,1167 overflow: "visible",1168 opacity: cursorOp,1169 transform: `scale(${1 - 0.04 * press})`,1170 transformOrigin: "2px 2px",1171 filter: "drop-shadow(0 2px 3px rgba(0,0,0,0.3))",1172 zIndex: 5,1173 }}1174 aria-hidden1175 >1176 <path1177 d={ARROW}1178 fill="#FFFFFF"1179 stroke="#111111"1180 strokeWidth={1.1}1181 strokeLinejoin="round"1182 />1183 </svg>1184 </div>1185 </div>1186 </ScaleLayer>1187 </AbsoluteFill>1188 );1189}









