Skip to content

Conversation

Enejivk
Copy link
Contributor

@Enejivk Enejivk commented Oct 17, 2025

Summary by CodeRabbit

  • New Features

    • Timeline editor adds a split mode for inserting precise splits at specific time points.
    • A visual scissors cursor appears when split mode is active to indicate the current tool.
    • Segment interaction adapts to the active editor mode so normal dragging is disabled while using split mode.
  • Bug Fixes

    • Slight playhead positioning adjustment for improved visual alignment.

Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Walkthrough

Adds split-mode handling to clip segments (guards in start/end handle events that call projectActions.splitClipSegment when active), applies a scissors cursor class to segment roots in split mode, adds the cursor SVG CSS, and shifts the playhead render by -0.5px.

Changes

Cohort / File(s) Summary
Clip track split logic
apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
Adds local split() helper that checks editorState.timeline.interactMode === "split"; early-returns in start/end handle mousedown handlers to bypass drag/resize when in split mode and compute split time then call projectActions.splitClipSegment(...).
Segment root cursor toggle
apps/desktop/src/routes/editor/Timeline/Track.tsx
Reads editorState via useEditorContext and conditionally applies timeline-scissors-cursor class to segment root when interactMode is "split".
Scissors cursor styling
apps/desktop/src/routes/editor/Timeline/styles.css
Adds .timeline-scissors-cursor with an inline SVG data-URL cursor and .timeline-scissors-cursor * to inherit the cursor.
Playhead position tweak
apps/desktop/src/routes/editor/Timeline/index.tsx
Adjusts playhead translateX by subtracting 0.5px from the computed position.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant UI as Clip UI (Track/ClipTrack)
  participant S as EditorState
  participant P as ProjectActions

  U->>UI: mousedown on segment start/end handle
  UI->>S: read timeline.interactMode
  alt interactMode == "split"
    UI->>UI: compute split time from cursor/handle pos
    UI->>P: projectActions.splitClipSegment(splitTime, clipId, segmentId)
    P-->>UI: split result (no drag)
  else normal mode
    UI->>UI: begin drag/resize flow (mouse capture)
    UI-->>UI: emit drag updates -> resize/move segment
    UI->>P: commit resize/move on end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

codex

Poem

✂️ I twitch my whiskers, scissors bright,
I hop to clips with keen delight,
No tug or drag — a measured part,
A clean little slice, a silken art,
Hooray, the timeline sings — hop, repeat! 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(editor): show scissors cursor when clip tool is active" is directly related to the primary changes in the pull request. The changeset explicitly adds a new CSS class for the scissors cursor, conditionally applies it when in split mode, and implements the supporting split mode logic. The title accurately describes the main user-facing feature being delivered—displaying a scissors cursor as visual feedback when the clip tool is active. The title is concise, specific, and would allow a teammate reviewing the history to quickly understand the purpose of the change without being vague or misleading.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6051381 and bf521a6.

📒 Files selected for processing (4)
  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx (3 hunks)
  • apps/desktop/src/routes/editor/Timeline/Track.tsx (2 hunks)
  • apps/desktop/src/routes/editor/Timeline/index.tsx (1 hunks)
  • apps/desktop/src/routes/editor/Timeline/styles.css (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/desktop/src/routes/editor/Timeline/styles.css
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Use strict TypeScript and avoid any; leverage shared types

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
  • apps/desktop/src/routes/editor/Timeline/index.tsx
  • apps/desktop/src/routes/editor/Timeline/Track.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
  • apps/desktop/src/routes/editor/Timeline/index.tsx
  • apps/desktop/src/routes/editor/Timeline/Track.tsx
apps/desktop/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/desktop/src/**/*.{ts,tsx}: Desktop icons are auto-imported (unplugin-icons); do not import icons manually
Desktop IPC: Call generated tauri_specta commands/events; listen to generated events and use typed interfaces
Use @tanstack/solid-query for server state in the desktop app

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
  • apps/desktop/src/routes/editor/Timeline/index.tsx
  • apps/desktop/src/routes/editor/Timeline/Track.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
🔇 Additional comments (7)
apps/desktop/src/routes/editor/Timeline/index.tsx (1)

246-246: Visual alignment adjustment looks correct.

The -0.5px offset aligns the preview playhead indicator, likely to center it properly with the scissors cursor or pixel grid in split mode.

apps/desktop/src/routes/editor/Timeline/Track.tsx (2)

58-58: LGTM: Context extraction is correct.

Properly extracts editorState from the editor context for use in the conditional class application below.


68-69: CSS class verified and properly defined.

The timeline-scissors-cursor class exists in styles.css (lines 16 and 23) and the conditional application in Track.tsx is correct.

apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx (4)

198-198: LGTM: Clean helper function.

The split() helper clearly encapsulates the split mode check, improving readability throughout the component.


362-368: LGTM: Split calculation is correct.

The split logic properly:

  • Calculates the click position as a fraction within the segment
  • Computes the split time relative to the segment start
  • Adds the previous duration offset to get the absolute timeline position

411-411: LGTM: Guard check prevents unintended resize.

The early return when in split mode correctly prevents the start handle from initiating a resize operation, ensuring only split behavior occurs.


502-502: LGTM: Guard check prevents unintended resize.

The early return when in split mode correctly prevents the end handle from initiating a resize operation, ensuring only split behavior occurs.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx (1)

198-198: Consider memoizing the helper for Solid.js reactivity.

The split() helper is called multiple times throughout the component (lines 356, 363, 412, 503). Following Solid.js best practices for derived state, consider wrapping it with createMemo:

-const split = () => editorState.timeline.interactMode === "split";
+const split = createMemo(() => editorState.timeline.interactMode === "split");

This ensures the value is only recomputed when editorState.timeline.interactMode changes, rather than on every access.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c9c4aea and d4445e9.

📒 Files selected for processing (2)
  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx (4 hunks)
  • apps/desktop/src/routes/editor/Timeline/styles.css (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Use strict TypeScript and avoid any; leverage shared types

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
apps/desktop/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/desktop/src/**/*.{ts,tsx}: Desktop icons are auto-imported (unplugin-icons); do not import icons manually
Desktop IPC: Call generated tauri_specta commands/events; listen to generated events and use typed interfaces
Use @tanstack/solid-query for server state in the desktop app

Files:

  • apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
🔇 Additional comments (2)
apps/desktop/src/routes/editor/Timeline/styles.css (1)

16-24: LGTM!

The scissors cursor implementation is correct. The data URL SVG is properly encoded, the hotspot (10, 10) is centered for the 20×20 icon, and the descendant selector appropriately ensures all child elements inherit the cursor.

apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx (1)

356-356: LGTM!

The conditional application of the scissors cursor class correctly integrates with the existing class composition logic.

@Enejivk
Copy link
Contributor Author

Enejivk commented Oct 17, 2025

2025-10-17.3.36.45.AM.mp4

@Brendonovich
Copy link
Member

This is great, ty!

@Brendonovich Brendonovich merged commit dc34248 into CapSoftware:main Oct 17, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants