Skip to content

Open source CapCut alternative.

TypeScript

fix(site): hover reveals the card under the pointer

David Le81f04a5a2717
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 9e460484..c1efc512 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -1442,7 +1442,7 @@ function MessageAssetCard({ asset }: { asset: AssetRef }) {
return (
<div
className={cn(
- "ai-msg-asset group relative",
+ "ai-msg-asset group/chip relative",
// Audio gets the wide timeline-pill treatment; the row still wraps
// inside the message's max width.
asset.kind === "audio" ? "w-44 max-w-full" : "w-16",
@@ -1472,7 +1472,7 @@ function MessageAssetCard({ asset }: { asset: AssetRef }) {
item={asset}
className={cn(
asset.kind === "audio" ? "h-12 w-full" : "size-16",
- "transition-colors group-hover:border-input",
+ "transition-colors group-hover/chip:border-input",
)}
/>
<span className="w-full truncate text-[10px] text-muted-foreground">
@@ -1484,7 +1484,7 @@ function MessageAssetCard({ asset }: { asset: AssetRef }) {
render={
<button
aria-label="Asset options"
- className="absolute top-1 right-1 grid size-5 place-items-center rounded-md bg-black/55 text-white opacity-0 transition-opacity group-hover:opacity-100 hover:bg-black/75"
+ className="absolute top-1 right-1 grid size-5 place-items-center rounded-md bg-black/55 text-white opacity-0 transition-opacity group-hover/chip:opacity-100 hover:bg-black/75"
/>
}
>
diff --git a/site/src/cut/components/AudioPanel.tsx b/site/src/cut/components/AudioPanel.tsx
index 1dcea9dc..0a9069e7 100644
--- a/site/src/cut/components/AudioPanel.tsx
+++ b/site/src/cut/components/AudioPanel.tsx
@@ -766,7 +766,7 @@ export function AudioRow({
return (
<AudioPillSurface
peaks={peaks}
- className="audio-row group h-10 shrink-0 cursor-grab"
+ className="audio-row group/row h-10 shrink-0 cursor-grab"
draggable={!!onDragStart}
onDragStart={
onDragStart &&
@@ -808,10 +808,10 @@ export function AudioRow({
</button>
{/* Steps aside when the hover controls take the right edge — the pill is
too short to stack both without them colliding. */}
- <span className="pointer-events-none absolute right-1.5 bottom-1 rounded-[5px] bg-black/40 px-1 py-px font-mono text-[9px] text-white tabular-nums transition-opacity group-hover:opacity-0 has-data-popup-open:opacity-0">
+ <span className="pointer-events-none absolute right-1.5 bottom-1 rounded-[5px] bg-black/40 px-1 py-px font-mono text-[9px] text-white tabular-nums transition-opacity group-hover/row:opacity-0 has-data-popup-open:opacity-0">
{formatTime(duration)}
</span>
- <div className="absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100 has-data-popup-open:opacity-100">
+ <div className="absolute top-1/2 right-1.5 flex -translate-y-1/2 items-center gap-1.5 opacity-0 transition-opacity group-hover/row:opacity-100 has-data-popup-open:opacity-100">
{menu}
<button
type="button"
diff --git a/site/src/cut/components/ChatAssets.tsx b/site/src/cut/components/ChatAssets.tsx
index 5ba0e8a6..fd7d74a0 100644
--- a/site/src/cut/components/ChatAssets.tsx
+++ b/site/src/cut/components/ChatAssets.tsx
@@ -261,7 +261,7 @@ function MediaCard({ item, asset }: ChatCardProps) {
return (
<div
ref={tileRef}
- className="ai-chat-asset group relative shrink-0 cursor-grab overflow-hidden rounded-xl border border-border bg-muted transition-colors hover:border-input"
+ className="ai-chat-asset group/card relative shrink-0 cursor-grab overflow-hidden rounded-xl border border-border bg-muted transition-colors hover:border-input"
style={{ width, aspectRatio: ratio }}
title={`${ref.name} — double-click to expand · drag to the timeline`}
{...dragProps(item, asset)}
@@ -288,10 +288,10 @@ function MediaCard({ item, asset }: ChatCardProps) {
{formatTime(ref.duration)}
</span>
)}
- <div className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent px-2 pt-4 pb-1.5 opacity-0 transition-opacity group-hover:opacity-100">
+ <div className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent px-2 pt-4 pb-1.5 opacity-0 transition-opacity group-hover/card:opacity-100">
<span className="block truncate text-[10.5px] font-medium text-white">{ref.name}</span>
</div>
- <div className="absolute top-1 right-1 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100 has-data-popup-open:opacity-100">
+ <div className="absolute top-1 right-1 flex gap-1 opacity-0 transition-opacity group-hover/card:opacity-100 has-data-popup-open:opacity-100">
<button title="Expand" className={scrimButton} onClick={() => expandRef(item, asset)}>
<Maximize2 className="size-3" />
</button>
@@ -342,7 +342,7 @@ function DocCard({ item, asset }: ChatCardProps) {
const clipped = text !== null && text.length > DOC_PREVIEW_CHARS;
return (
<div
- className="ai-chat-asset group relative w-full max-w-[280px] cursor-default overflow-hidden rounded-xl border border-border bg-background transition-colors hover:border-input"
+ className="ai-chat-asset group/card relative w-full max-w-[280px] cursor-default overflow-hidden rounded-xl border border-border bg-background transition-colors hover:border-input"
title={`${item.name} — double-click to expand`}
{...dragProps(item, asset)}
onDoubleClick={() => expandRef(item, asset)}
@@ -352,7 +352,7 @@ function DocCard({ item, asset }: ChatCardProps) {
<span className="min-w-0 flex-1 truncate text-[11px] font-medium">{item.name}</span>
<button
title="Expand"
- className={cn(scrimButton, "opacity-0 transition-opacity group-hover:opacity-100")}
+ className={cn(scrimButton, "opacity-0 transition-opacity group-hover/card:opacity-100")}
onClick={() => expandRef(item, asset)}
>
<Maximize2 className="size-3" />
diff --git a/site/src/cut/components/SceneCard.tsx b/site/src/cut/components/SceneCard.tsx
index 2d5614ab..6036be8e 100644
--- a/site/src/cut/components/SceneCard.tsx
+++ b/site/src/cut/components/SceneCard.tsx
@@ -319,7 +319,7 @@ function ShotTile({
onClick={view}
title={`Shot ${n} — ${describe(shot)}`}
className={cn(
- "group relative w-full overflow-hidden rounded-md bg-muted transition-opacity",
+ "group/tile relative w-full overflow-hidden rounded-md bg-muted transition-opacity",
ref ? "cursor-zoom-in hover:opacity-95" : "cursor-default"
)}
// The tile fills its column at the run's aspect; a tall 9:16 shot is
@@ -378,7 +378,7 @@ function ShotTile({
}}
className={cn(
scrimIconButton,
- "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100"
+ "absolute top-1 right-1 opacity-0 transition-opacity group-hover/tile:opacity-100"
)}
>
<RotateCw className="size-3" />
@@ -473,7 +473,7 @@ function FeedEntry({
return (
<div className="flex flex-col items-start gap-1">
<div
- className="group relative cursor-zoom-out overflow-hidden rounded-xl border border-border bg-muted"
+ className="group/tile relative cursor-zoom-out overflow-hidden rounded-xl border border-border bg-muted"
style={{ width, aspectRatio: ratio }}
title={`${item.name} — click to minimize`}
onClick={() => setExpanded(false)}
@@ -502,7 +502,7 @@ function FeedEntry({
title="Expand"
className={cn(
scrimIconButton,
- "absolute top-1 right-1 opacity-0 transition-opacity group-hover:opacity-100"
+ "absolute top-1 right-1 opacity-0 transition-opacity group-hover/tile:opacity-100"
)}
onClick={(e) => {
e.stopPropagation();