Skip to content

feat: [UI] Update Timeline icon for "Auto Snapping"#420

Merged
mazeincoding merged 1 commit into
OpenCut-app:mainfrom
chrissshan:feature/update-timeline-snapping-icon
Jul 22, 2025
Merged

feat: [UI] Update Timeline icon for "Auto Snapping"#420
mazeincoding merged 1 commit into
OpenCut-app:mainfrom
chrissshan:feature/update-timeline-snapping-icon

Conversation

@chrissshan
Copy link
Copy Markdown
Contributor

@chrissshan chrissshan commented Jul 22, 2025

Description

Swap the Timeline icon for "Auto Snapping" from Lock to Magnet.
Lock gives the impression that the timeline will be locked from changes. Magnet is a clearer intention of what expected behavior would be.

Type of change

New feature (non-breaking change which adds functionality)

  • Small UI change

How Has This Been Tested?

  • Validated that functionality still works the same as before

Screenshots (if applicable)

Before change:
image

After change:
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have added screenshots if ui has been changed
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional context

none

Summary by CodeRabbit

  • Style
    • Updated the snapping toggle button in the timeline toolbar to use a magnet icon, with color changes indicating enabled or disabled state.
    • Minor formatting improvements for code readability in the timeline ruler and click-to-seek calculation.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 22, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 205ad52

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 22, 2025

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

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 22, 2025

Walkthrough

The snapping toggle button in the timeline toolbar now uses a "Magnet" icon for both enabled and disabled states, with color indicating status. Previous "Lock" and "LockOpen" icons were removed. Minor formatting adjustments were made in marker rendering and click-to-seek calculations without altering any core logic or behavior.

Changes

File(s) Change Summary
apps/web/src/components/editor/timeline.tsx Replaced "Lock" and "LockOpen" icons with "Magnet" for snapping toggle; adjusted icon color for state; made minor formatting tweaks in className expressions and click-to-seek calculation.

Estimated code review effort

1 (~2 minutes)

Possibly related PRs

Suggested reviewers

  • shreyashguptas

Poem

In the timeline, magnets now gleam,
Snapping toggles with a colorful theme.
Locks are gone, replaced with flair,
A magnetic touch is everywhere!
With tidy code and icons bright,
This rabbit hops in pure delight. 🧲🐇

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2a403b and 205ad52.

📒 Files selected for processing (1)
  • apps/web/src/components/editor/timeline.tsx (4 hunks)
🧠 Learnings (2)
📓 Common learnings
Learnt from: simonorzel26
PR: OpenCut-app/OpenCut#324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.929Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded `ml-48` class in addition to the calculated `leftPosition` for proper alignment. This is intentional and needed for the new timeline layout.
apps/web/src/components/editor/timeline.tsx (1)

Learnt from: simonorzel26
PR: #324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.929Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded ml-48 class in addition to the calculated leftPosition for proper alignment. This is intentional and needed for the new timeline layout.

🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: simonorzel26
PR: OpenCut-app/OpenCut#324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.929Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded `ml-48` class in addition to the calculated `leftPosition` for proper alignment. This is intentional and needed for the new timeline layout.
apps/web/src/components/editor/timeline.tsx (1)

Learnt from: simonorzel26
PR: #324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.929Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded ml-48 class in addition to the calculated leftPosition for proper alignment. This is intentional and needed for the new timeline layout.

🔇 Additional comments (1)
apps/web/src/components/editor/timeline.tsx (1)

922-935: LGTM – marker style refactor is functionally equivalent

The refactor to a single-line template literal retains the same conditional logic and should not affect rendering.

Comment on lines 806 to 812
<Button variant="text" size="icon" onClick={toggleSnapping}>
{snappingEnabled ? (
<LockOpen className="h-4 w-4 text-primary" />
<Magnet className="h-4 w-4 text-primary" />
) : (
<Lock className="h-4 w-4" />
<Magnet className="h-4 w-4" />
)}
</Button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider adding a non-color cue for the snapping toggle’s state

Using the exact same Magnet glyph for both enabled and disabled states and relying solely on the primary-color tint to convey “on” violates WCAG 1.4.1 (“Use of Color”).
A simple alternative is to convey state via the tooltip label or by swapping to the Magnet+Slash icon (exists in lucide-react as MagnetOff) when the feature is disabled.

- {snappingEnabled ? (
-   <Magnet className="h-4 w-4 text-primary" />
- ) : (
-   <Magnet className="h-4 w-4" />
- )}
+ {snappingEnabled ? (
+   <Magnet className="h-4 w-4 text-primary" />
+ ) : (
+   <MagnetOff className="h-4 w-4 text-muted-foreground" />
+ )}

If you prefer to keep a single icon, at minimum change the tooltip to “Enable Auto Snapping” / “Disable Auto Snapping” so screen-reader and color-blind users can distinguish the state.


#!/bin/bash

Search for all Magnet icon usage in the timeline component

rg "Magnet" -n apps/web/src/components/editor/timeline.tsx

Locate the toggleSnapping handler to see surrounding JSX (including any Tooltip)

rg "toggleSnapping" -n apps/web/src/components/editor/timeline.tsx

Dump the region around the snapping toggle button to inspect labels/tooltips

sed -n '750,860p' apps/web/src/components/editor/timeline.tsx


🏁 Script executed:

#!/bin/bash
set -e

# Search for Tooltip wrapper around the snapping toggle
rg "<Tooltip" -n apps/web/src/components/editor/timeline.tsx

# Search for any aria-label or title on the snapping toggle button
rg "aria-label" -n apps/web/src/components/editor/timeline.tsx
rg "title=" -n apps/web/src/components/editor/timeline.tsx

# Show context around the toggleSnapping handler to inspect labels and icons
rg "onClick={toggleSnapping}" -n -C 5 apps/web/src/components/editor/timeline.tsx

Length of output: 1710


🏁 Script executed:

#!/bin/bash
# Dump context around the snapping toggle to inspect icon, tooltip, and labels
sed -n '780,840p' apps/web/src/components/editor/timeline.tsx

Length of output: 2179


Add a non-color cue to the Auto Snapping toggle

Relying solely on the text-primary tint to indicate “on” can be inaccessible for color-blind users and violates WCAG 1.4.1. We should either swap to a “disabled” icon when snapping is off or at minimum provide dynamic labels (tooltip/aria-label) that make the state clear without color.

• File: apps/web/src/components/editor/timeline.tsx
• Location: within the <Button onClick={toggleSnapping}>…</Button> block (~lines 809–812)

Suggested diff:

- <Button variant="text" size="icon" onClick={toggleSnapping}>
-   {snappingEnabled ? (
-     <Magnet className="h-4 w-4 text-primary" />
-   ) : (
-     <Magnet className="h-4 w-4" />
-   )}
- </Button>
- <TooltipContent>Auto snapping</TooltipContent>
+ <Button
+   variant="text"
+   size="icon"
+   onClick={toggleSnapping}
+   aria-label={snappingEnabled ? "Disable Auto Snapping" : "Enable Auto Snapping"}
+ >
+   {snappingEnabled ? (
+     <Magnet className="h-4 w-4 text-primary" />
+   ) : (
+     <MagnetOff className="h-4 w-4 text-muted-foreground" />
+   )}
+ </Button>
+ <TooltipContent>
+   {snappingEnabled ? "Disable Auto Snapping" : "Enable Auto Snapping"}
+ </TooltipContent>

This ensures both a distinct icon and clear labels for screen-reader and color-blind users.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/web/src/components/editor/timeline.tsx around lines 806 to 812, the Auto
Snapping toggle button relies only on color to indicate its state, which is
inaccessible for color-blind users. To fix this, add a non-color visual cue by
swapping the icon to a "disabled" or different style when snapping is off, and
include dynamic aria-labels or tooltips that clearly describe the toggle state
for screen readers and all users.

@chrissshan chrissshan changed the title Update Timeline icon for "Auto Snapping" feat: [UI] Update Timeline icon for "Auto Snapping" Jul 22, 2025
@mazeincoding mazeincoding merged commit a5f7b47 into OpenCut-app:main Jul 22, 2025
1 of 2 checks passed
@chrissshan chrissshan deleted the feature/update-timeline-snapping-icon branch July 22, 2025 17:25
zstar1003 pushed a commit to zstar1003/FlashCut that referenced this pull request Jan 28, 2026
…eline-snapping-icon

feat: [UI] Update Timeline icon for "Auto Snapping"
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