Skip to content

Conversation

@ThanhNguyxn
Copy link

@ThanhNguyxn ThanhNguyxn commented Jan 24, 2026

Summary

This PR implements the missing track visibility toggle functionality on the timeline.

Fixes #658 - Non-functional Eye Button on Timeline Track

Problem:

  • The eye icon button on timeline track labels was displayed but non-functional
  • Clicking the icon triggered no action
  • No visual feedback was provided

Solution:

  1. Added hidden property to TimelineTrack interface (types/timeline.ts)

    • New optional hidden?: boolean property
  2. Added toggleTrackVisibility function (stores/timeline-store.ts)

    • Similar pattern to existing toggleTrackMute function
    • Pushes to history for undo/redo support
  3. Updated Eye button in timeline UI (components/editor/timeline/index.tsx)

    • Added EyeOff import from lucide-react
    • Eye button now toggles between Eye/EyeOff icons based on track state
    • Added cursor-pointer class for better UX
    • EyeOff icon shown in red (text-destructive) when track is hidden
  4. Added visual feedback for hidden tracks (components/editor/timeline/timeline-track.tsx)

    • Hidden tracks display at 40% opacity (opacity-40)

Visual Changes

State Icon Track Appearance
Visible Gray Eye Normal opacity
Hidden Red EyeOff Semi-transparent (40% opacity)

Testing

  1. Open a project in the editor
  2. Add any media to the timeline
  3. Click the eye icon on a track
  4. Verify:
    • Icon changes from Eye to EyeOff (red)
    • Track content becomes semi-transparent
  5. Click again to show the track
  6. Verify undo/redo works correctly

Summary by CodeRabbit

  • New Features
    • Toggle track visibility on/off in the timeline editor (per-track buttons and a header toggle)
    • Visual indicators (Eye/EyeOff) show each track’s visibility state
    • Mute/unmute and visibility accessible via dedicated buttons with aria-labels for accessibility
    • Hidden tracks render with reduced opacity for clear visual distinction

✏️ Tip: You can customize this high-level summary in your review settings.

- Fix OpenCut-app#658: Add hidden property to TimelineTrack interface
- Add toggleTrackVisibility function to timeline store
- Update Eye button to toggle between Eye/EyeOff icons
- Add visual feedback (opacity) for hidden tracks
- EyeOff icon shown in red when track is hidden
@vercel
Copy link

vercel bot commented Jan 24, 2026

@ThanhNguyxn is attempting to deploy a commit to the OpenCut OSS Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Jan 24, 2026

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 23ba85c

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Adds per-track visibility: a new optional hidden flag on timeline tracks, a toggleTrackVisibility(trackId) method in the timeline store (with history and persistence), UI wiring for Eye/EyeOff toggle buttons, and reduced-opacity rendering for hidden tracks.

Changes

Cohort / File(s) Summary
Type Definitions
apps/web/src/types/timeline.ts
Added optional hidden?: boolean to TimelineTrack.
Store Logic
apps/web/src/stores/timeline-store.ts
Added public toggleTrackVisibility(trackId: string) which toggles hidden, calls pushHistory, and persists via updateTracksAndSave.
UI — Timeline Header / Controls
apps/web/src/components/editor/timeline/index.tsx
Replaced inline icons with toggle buttons; wired visibility button to call toggleTrackVisibility(track.id) and display Eye/EyeOff based on state.
UI — Track Rendering
apps/web/src/components/editor/timeline/timeline-track.tsx
Applies opacity-40 CSS class to TimelineTrackContent when track.hidden === true.
Meta / Manifest
manifest_file, package.json
Minor manifest/package metadata adjustments.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TimelineUI as Timeline UI
  participant Store as Timeline Store
  participant History as History Manager
  participant Persist as Persist/Save

  User->>TimelineUI: Click visibility button (trackId)
  TimelineUI->>Store: toggleTrackVisibility(trackId)
  Store->>Store: toggle track.hidden
  Store->>History: pushHistory(change)
  Store->>Persist: updateTracksAndSave(tracks)
  Persist-->>Store: save acknowledged
  Store-->>TimelineUI: updated state
  TimelineUI-->>User: re-render showing Eye/EyeOff and opacity
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • shreyashguptas

Poem

🐰 I tapped the eye, the timeline blinked,

Hidden lanes grew soft and linked,
A quiet toggle, a gentle fade,
Edits now dance in shadow's glade,
Hops of joy — a clearer parade! 🥕👁️

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main feature being implemented: track visibility toggle on the timeline.
Description check ✅ Passed The description provides a clear summary of changes and references the fixed issue (#658), but lacks details on testing execution and checklist completion.
Linked Issues check ✅ Passed The PR implementation directly addresses all coding requirements from issue #658: toggleable eye icon, icon state changes (Eye/EyeOff), opacity feedback for hidden tracks, and history support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the track visibility toggle feature; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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: 1

🤖 Fix all issues with AI agents
In `@apps/web/src/components/editor/timeline/index.tsx`:
- Around line 793-803: The visibility toggle uses SVG icons (Eye / EyeOff) which
are not keyboard-focusable; wrap the icons in a focusable button element (or
your Button component) and move the onClick to that button, add an appropriate
aria-label (e.g., `aria-label={track.hidden ? "Show track" : "Hide track"}`) and
preserve the call to toggleTrackVisibility(track.id); ensure the button has no
disruptive styles (use className on the button for cursor/colour) so visual
appearance is unchanged and keyboard users can activate the control.

- Address CodeRabbit feedback for keyboard accessibility
- Wrap mute and visibility toggle icons in button elements
- Add aria-labels for screen readers
- Add focus ring styles for keyboard navigation
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: 1

🤖 Fix all issues with AI agents
In `@apps/web/src/components/editor/timeline/index.tsx`:
- Around line 782-805: Add <title> child elements to each Lucide icon instance
to satisfy SVG accessibility guidelines: for the icons VolumeOff, Volume2, Eye,
and EyeOff used inside the buttons that call toggleTrackMute(track.id) and
toggleTrackVisibility(track.id), render a <title> with a concise label matching
the button aria-label (e.g., "Mute track" / "Unmute track" for Volume icons and
"Hide track" / "Show track" for Eye icons). Ensure each icon receives the
correct title based on the track.muted and track.hidden boolean states so the
SVGs have accessible titles that align with the existing aria-labels.

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.

[BUG] Non-functional Eye Button on Timeline Track

1 participant