Open source CapCut alternative.
TypeScript
refactor(site): one selection ring for every tile and card
David Lef09b2f2eb8f7
diff --git a/site/src/cut/components/ColorPanel.tsx b/site/src/cut/components/ColorPanel.tsxindex fe0bc5f3..9e72078a 100644--- a/site/src/cut/components/ColorPanel.tsx+++ b/site/src/cut/components/ColorPanel.tsx@@ -34,6 +34,7 @@ import { ValueSlider } from "@/cut/components/ValueSlider";import { parseNumberInput } from "@/cut/components/ScrubValue";import { useClipSourceFrame } from "@/cut/components/usePlayheadFrame";import { cn } from "@/lib/utils";+import { PICKED_RING } from "@/cut/lib/assetPick";import { ScrollArea } from "@/components/ui/scroll-area";import { Switch } from "@/components/ui/switch";@@ -313,7 +314,7 @@ function PresetTile({<spanclassName={cn("relative block aspect-square w-full overflow-hidden rounded-md bg-muted",- selected && "ring-2 ring-[#0a84ff] ring-offset-1 ring-offset-card"+ selected && PICKED_RING)}>{src ? (diff --git a/site/src/cut/components/GeneratePanel.tsx b/site/src/cut/components/GeneratePanel.tsxindex cfc5e322..c37496aa 100644--- a/site/src/cut/components/GeneratePanel.tsx+++ b/site/src/cut/components/GeneratePanel.tsx@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";import { DropdownMenuItem } from "@/components/ui/dropdown-menu";import { MEDIA_CORS } from "@/cut/lib/mediaCors";import { clearAssetDrag, setAssetDragData } from "@/cut/lib/assetDrag";-import { PICKED_RING, useAssetPick } from "@/cut/lib/assetPick";+import { FOCUS_RING, PICKED_RING, useAssetPick } from "@/cut/lib/assetPick";import {collectRefs,mentionToken,@@ -401,7 +401,7 @@ function JobRow({ job, handle }: { job: GenerateJob; handle?: string }) {><buttonref={inViewRef}- className="block w-full outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className={cn("block w-full", FOCUS_RING)}draggableonDragStart={(e) => {setAssetDragData(e, asset.id);diff --git a/site/src/cut/components/ImageGenPanel.tsx b/site/src/cut/components/ImageGenPanel.tsxindex 17d07beb..64abf139 100644--- a/site/src/cut/components/ImageGenPanel.tsx+++ b/site/src/cut/components/ImageGenPanel.tsx@@ -7,7 +7,7 @@ import { DropdownMenuItem } from "@/components/ui/dropdown-menu";import { SectionTitle } from "@/cut/components/SectionTitle";import { MEDIA_CORS } from "@/cut/lib/mediaCors";import { clearAssetDrag, setAssetDragData } from "@/cut/lib/assetDrag";-import { PICKED_RING, useAssetPick } from "@/cut/lib/assetPick";+import { FOCUS_RING, PICKED_RING, useAssetPick } from "@/cut/lib/assetPick";import { collectRefs, mentionToken, useRefCandidates, useAssetDrop } from "@/cut/lib/assetRef";import { genPulseOverlay, useGenPulse } from "@/cut/lib/genNotify";import { useElapsed } from "@/cut/hooks/useElapsed";@@ -247,7 +247,7 @@ function GeneratedTile({className={cn("group relative overflow-hidden rounded-lg", picked && PICKED_RING)}><button- className="block w-full outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className={cn("block w-full", FOCUS_RING)}title={asset.name}draggableonDragStart={(e) => {diff --git a/site/src/cut/components/LibraryView.tsx b/site/src/cut/components/LibraryView.tsxindex 50fe9131..694657c0 100644--- a/site/src/cut/components/LibraryView.tsx+++ b/site/src/cut/components/LibraryView.tsx@@ -127,6 +127,7 @@ import { childrenOf, folderTrail, folderWithin, parentOf } from "@/cut/lib/foldeimport { FolderCrumb, FolderShelf, Marquee } from "./desktopFolders";import { formatBytes } from "@/lib/bytes";import { useMediaFileSize } from "@/cut/hooks/useMediaFileSize";+import { PICKED_RING } from "@/cut/lib/assetPick";// A dragged library selection travels as a JSON array of asset ids, so a whole// marquee-selected collection can be dropped onto a folder at once.@@ -1278,7 +1279,7 @@ export function LibraryCard({// scales with the tile, which runs from a panel column to a full row.font && "@container flex flex-col",selected || flash- ? "border-[#0a84ff] ring-2 ring-[#0a84ff]"+ ? PICKED_RING: font? "border-transparent": "border-border",diff --git a/site/src/cut/components/NotesView.tsx b/site/src/cut/components/NotesView.tsxindex 60ccd2be..3616598b 100644--- a/site/src/cut/components/NotesView.tsx+++ b/site/src/cut/components/NotesView.tsx@@ -22,6 +22,7 @@ import { homeHref, useCutBase } from "@/cut/lib/nav";import { notesKey, patchNotes, useNotes } from "@/cut/lib/queries";import { cn } from "@/lib/utils";import { setObjectDragImage } from "@/cut/lib/assetDrag";+import { PICKED_RING } from "@/cut/lib/assetPick";import { FolderCrumb, FolderShelf, Marquee } from "./desktopFolders";import { NoteComposer, noteChanged, type NoteDraft } from "./NoteComposer";@@ -592,7 +593,7 @@ export function NotesView() {onDragStart={(e) => onCardDragStart(e, n.id)}className={cn("flex min-h-40 cursor-pointer flex-col gap-1.5 rounded-2xl p-4 text-left shadow-sm transition-transform hover:-translate-y-0.5",- selected.has(n.id) && "ring-2 ring-[#0a84ff]",+ selected.has(n.id) && PICKED_RING,)}style={{ backgroundColor: noteColor(n.colorIndex).background, color: NOTE_INK }}onClick={() => openNote(n)}diff --git a/site/src/cut/components/PanelTile.tsx b/site/src/cut/components/PanelTile.tsxindex 9f92d795..7d9637e7 100644--- a/site/src/cut/components/PanelTile.tsx+++ b/site/src/cut/components/PanelTile.tsx@@ -1,6 +1,7 @@"use client";import { cn } from "@/lib/utils";+import { PICKED_RING } from "@/cut/lib/assetPick";/*** A pickable square in a panel grid: a preview above, its name below. Clip@@ -55,7 +56,7 @@ export function Tile({onBlur={() => onHover?.(false)}className={cn("flex flex-col items-center gap-1.5 rounded-lg border border-border p-2.5 text-[11px] font-medium text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground",- selected && "bg-primary/10 text-foreground ring-2 ring-[#0a84ff] ring-offset-1 ring-offset-card",+ selected && cn("bg-primary/10 text-foreground", PICKED_RING),className)}onClick={onClick}diff --git a/site/src/cut/components/ProjectsHome.tsx b/site/src/cut/components/ProjectsHome.tsxindex d61bdd31..433e1bf1 100644--- a/site/src/cut/components/ProjectsHome.tsx+++ b/site/src/cut/components/ProjectsHome.tsx@@ -92,6 +92,7 @@ import {import { cn } from "@/lib/utils";import { setObjectDragImage } from "@/cut/lib/assetDrag";import { childrenOf, folderTrail, folderWithin, parentOf } from "@/cut/lib/folderTree";+import { PICKED_RING } from "@/cut/lib/assetPick";import { FolderCrumb, FolderShelf, Marquee } from "./desktopFolders";import { formatBytes } from "@/lib/bytes";@@ -730,7 +731,7 @@ export function ProjectsHome() {<divclassName={cn("relative grid place-items-center overflow-hidden rounded-2xl border bg-muted transition-shadow group-hover:shadow-[0_6px_28px_rgba(0,0,0,0.12)]",- selected.has(p.id) ? "border-[#0a84ff] ring-2 ring-[#0a84ff]" : "border-border"+ selected.has(p.id) ? PICKED_RING : "border-border")}style={{ width: tileW, aspectRatio: `${frame.w} / ${frame.h}` }}>diff --git a/site/src/cut/components/SidePanel.tsx b/site/src/cut/components/SidePanel.tsxindex 29d216f8..d2792407 100644--- a/site/src/cut/components/SidePanel.tsx+++ b/site/src/cut/components/SidePanel.tsx@@ -139,6 +139,7 @@ import { STOCK_VIDEOS } from "@/cut/lib/stockVideoManifest";import { LibraryCard, ShelfBadge } from "./LibraryView";import { MediaCardShell } from "./MediaCardShell";import { lightboxItemFromAsset } from "@/cut/lib/lightbox";+import { PICKED_RING } from "@/cut/lib/assetPick";import { SubTabs } from "./SubTabs";// Drag a library clip onto a folder tile to file it (side panel, single card).@@ -1451,7 +1452,7 @@ function AssetCard({data-drag-objectclassName={cn("relative aspect-square overflow-hidden rounded-lg border border-border bg-muted transition-colors group-hover:border-input",- (flash || selected) && "ring-2 ring-[#0a84ff] ring-offset-1"+ (flash || selected) && PICKED_RING)}>{asset.type === "video" ? (diff --git a/site/src/cut/components/StockImagesPanel.tsx b/site/src/cut/components/StockImagesPanel.tsxindex 814d6dab..dbb275d8 100644--- a/site/src/cut/components/StockImagesPanel.tsx+++ b/site/src/cut/components/StockImagesPanel.tsx@@ -11,6 +11,7 @@ import { useImageGen } from "@/cut/lib/imageGen";import { aspectRatio, STOCK_CATEGORIES, type StockCategory, type StockImage } from "@/cut/lib/stock";import { STOCK_IMAGES } from "@/cut/lib/stockManifest";import { cn } from "@/lib/utils";+import { FOCUS_RING, PICKED_RING } from "@/cut/lib/assetPick";import { CopyRefButton, RefHandlePill } from "./AssetRefs";import { ScrollArea } from "@/components/ui/scroll-area";@@ -163,11 +164,11 @@ function StockTile({ item }: { item: StockImage }) {}}className={cn("group relative overflow-hidden rounded-lg",- flash && "ring-2 ring-[#0a84ff] ring-offset-1"+ flash && PICKED_RING)}><button- className="block w-full outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className={cn("block w-full", FOCUS_RING)}draggableonDragStart={(e) => {setRefDragData(e, refFromStock(item));diff --git a/site/src/cut/components/StockVideosPanel.tsx b/site/src/cut/components/StockVideosPanel.tsxindex 7f0205c9..92b61300 100644--- a/site/src/cut/components/StockVideosPanel.tsx+++ b/site/src/cut/components/StockVideosPanel.tsx@@ -11,6 +11,7 @@ import { useVideoGen } from "@/cut/lib/videoGen";import { aspectRatio, STOCK_CATEGORIES, stockTitle, type StockCategory, type StockVideo } from "@/cut/lib/stock";import { STOCK_VIDEOS } from "@/cut/lib/stockVideoManifest";import { cn } from "@/lib/utils";+import { FOCUS_RING, PICKED_RING } from "@/cut/lib/assetPick";import { CopyRefButton, RefHandlePill } from "./AssetRefs";import { ScrollArea } from "@/components/ui/scroll-area";@@ -221,7 +222,7 @@ function StockTile({ item }: { item: StockVideo }) {}}className={cn("group relative overflow-hidden rounded-lg",- flash && "ring-2 ring-[#0a84ff] ring-offset-1"+ flash && PICKED_RING)}onMouseEnter={() => {const v = videoRef.current;@@ -244,7 +245,7 @@ function StockTile({ item }: { item: StockVideo }) {}}><button- className="block w-full outline-none focus-visible:ring-2 focus-visible:ring-ring"+ className={cn("block w-full", FOCUS_RING)}draggableonDragStart={(e) => {setRefDragData(e, refFromStockVideo(item));diff --git a/site/src/cut/components/TemplateCard.tsx b/site/src/cut/components/TemplateCard.tsxindex 83ec42fe..587c2a50 100644--- a/site/src/cut/components/TemplateCard.tsx+++ b/site/src/cut/components/TemplateCard.tsx@@ -37,6 +37,7 @@ import { EFFECT_LABELS, retimeOf, type SpeedNode } from "@donkeycut/effects-kit"import { SHAPE_LABELS } from "@/cut/lib/types";import type { LibraryTemplate, TemplateMedia } from "@/cut/lib/types";import { cn } from "@/lib/utils";+import { PICKED_RING } from "@/cut/lib/assetPick";/** A template row card: name and parts, a "…" menu (Rename / extras / Delete)* and an optional "+" action, both revealed on hover. Rename swaps the name@@ -157,7 +158,7 @@ export function TemplateCard({data-sel-id={selectId}className={cn("group flex flex-col rounded-lg border bg-background px-2.5 py-1.5",- selected ? "border-[#0a84ff] ring-2 ring-[#0a84ff]" : "border-border",+ selected ? PICKED_RING : "border-border",drag ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",onRefDrop && refDrop.active && "border-primary bg-primary/10",)}diff --git a/site/src/cut/components/VoicePicker.tsx b/site/src/cut/components/VoicePicker.tsxindex c2ed45f3..fc9a6c37 100644--- a/site/src/cut/components/VoicePicker.tsx+++ b/site/src/cut/components/VoicePicker.tsx@@ -22,6 +22,7 @@ import {} from "@/cut/lib/voices";import { generateSubtitlesReadout } from "@/cut/lib/voiceover";import { cn } from "@/lib/utils";+import { PICKED_RING } from "@/cut/lib/assetPick";// Shared speech preferences (speaker voice, spoken language) for every surface// that generates audio (Audio tab, Subtitles tab, clip settings). Module-level@@ -247,7 +248,7 @@ export function VoicePicker({className={cn("block aspect-square overflow-hidden rounded-lg border bg-muted ring-offset-2 ring-offset-popover transition",isSelected- ? "border-transparent ring-2 ring-[#0a84ff]"+ ? cn("border-transparent", PICKED_RING, "ring-offset-2 ring-offset-popover"): "border-input group-hover:border-transparent group-hover:ring-2 group-hover:ring-[#0a84ff]/40")}>