Skip to content

Open source CapCut alternative.

TypeScript

feat(site): subtle timeline and chat-composer hints replace the full-screen drop veil

David Le89b1bbb3c2db
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 68864e9f..b289c07e 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -338,6 +338,9 @@ function ChatSession({
const [input, setInput] = useState("");
const [attachments, setAttachments] = useState<AssetRef[]>([]);
const candidates = useRefCandidates();
+ // Any OS file drag over the window hints the composer as a drop target;
+ // hovering it (dropActive below) strengthens the ring and shows the label.
+ const fileDropHint = useEditor((s) => s.dropActive !== null);
const { active: dropActive, attachTarget, targetProps } = useAssetDrop(
(ref) => setAttachments((prev) => addRefOnce(prev, ref)),
// OS files dropped on the chat attach as references (media files import
@@ -560,7 +563,9 @@ function ChatSession({
"rounded-xl border bg-background transition-colors",
dropActive
? "border-[#0a84ff] ring-2 ring-[#0a84ff]/30"
- : "border-input focus-within:border-ring"
+ : fileDropHint
+ ? "border-[#0a84ff]/45 ring-2 ring-[#0a84ff]/15"
+ : "border-input focus-within:border-ring"
)}
>
{dropActive && (
diff --git a/site/src/cut/components/Timeline.tsx b/site/src/cut/components/Timeline.tsx
index 2381793d..3d39e7f7 100644
--- a/site/src/cut/components/Timeline.tsx
+++ b/site/src/cut/components/Timeline.tsx
@@ -132,6 +132,8 @@ export function Timeline() {
const timelineH = useEditor((s) => s.timelineH);
const multiSelection = useEditor((s) => s.multiSelection);
const subtitles = useEditor((s) => s.subtitles);
+ // An OS file drag carrying media lights the track area as a drop target.
+ const fileDropHint = useEditor((s) => s.dropActive === "media");
const scrollRef = useRef<HTMLDivElement>(null);
const innerRef = useRef<HTMLDivElement>(null);
// Measured width of the scroll viewport, so the ruler and tracks always draw
@@ -1149,6 +1151,11 @@ export function Timeline() {
</div>
</div>
</div>
+ {/* Subtle valid-target hint while an OS media drag is over the window:
+ a tint and inset ring over the track area, under the toolbar. */}
+ {fileDropHint && (
+ <div className="pointer-events-none absolute inset-x-0 top-11 bottom-0 z-40 bg-[#0a84ff]/5 ring-2 ring-[#0a84ff]/30 ring-inset" />
+ )}
</footer>
);
}
diff --git a/site/src/cut/lib/assetRef.ts b/site/src/cut/lib/assetRef.ts
index 4fa46297..1dc7839a 100644
--- a/site/src/cut/lib/assetRef.ts
+++ b/site/src/cut/lib/assetRef.ts
@@ -175,11 +175,9 @@ interface RefZone {
const zones = new Set<RefZone>();
-/** The file-accepting zone under a window drop, if any. Rect-based, because
- * the editor's import veil overlays the window during OS drags and would
- * swallow an elementFromPoint check. Lets the editor's window-level drop
- * handler hand files to the composer they landed on instead of importing them
- * onto the timeline. */
+/** The file-accepting zone under a window drop, if any. Lets the editor's
+ * window-level drop handler hand files to the composer they landed on instead
+ * of importing them into the project. */
export function fileZoneAt(x: number, y: number): ((files: File[]) => void) | null {
for (const z of zones) {
if (!z.onFiles) continue;