Skip to content

fix: use shared Switch component for System settings toggles (#1668) - #1670

Open
RounakKumarAgarwal wants to merge 2 commits into
AOSSIE-Org:devfrom
RounakKumarAgarwal:fix/toggle-switch-v2
Open

RounakKumarAgarwal wants to merge 2 commits into
AOSSIE-Org:devfrom
RounakKumarAgarwal:fix/toggle-switch-v2

Conversation

@RounakKumarAgarwal

@RounakKumarAgarwal RounakKumarAgarwal commented Oct 28, 2026 •

Copy link
Copy Markdown

What this does

Fixes #1668.

The two toggles in the System settings card ("Launch at startup" and "Close to tray") were hand-built with <button role="switch"> and custom Tailwind classes, instead of the shared Switch component (components/ui/switch) that every other toggle in the app uses. This made them look visually different (larger, different styling) from the toggles in Albums, Metadata Export, User Preferences, and Folder Management.

This swaps them to the shared <Switch> so all toggles are consistent.

Changes

  • SystemSettingsCard.tsx: replaced the two custom <button role="switch"> toggles with the shared <Switch> component.
  • Preserved all existing behavior — the autostart/close-to-tray state logic, Tauri invoke calls, loading/pending/disabled handling, and accessibility attributes (aria-labelledby / aria-describedby) are unchanged. Only the visual element was swapped; onClick maps to onCheckedChange, which the existing handlers support.

Testing

  • Verified in the running desktop app: both toggles now match the other toggles visually, flip correctly, and the underlying settings (autostart, close-to-tray) still take effect.
  • ruff / black pass.

Before

image

After

Screenshot 2026-10-29 010446

Summary by CodeRabbit

  • Style
    • Updated the startup and close-to-tray controls to use the app’s shared switch design. Their behavior and accessibility labels remain unchanged.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 6a901d2 and c26dc29.

Files selected for processing: 1
  • frontend/src/pages/SettingsPage/components/SystemSettingsCard.tsx
Files skipped from review as they are similar to previous changes: 1
  • frontend/src/pages/SettingsPage/components/SystemSettingsCard.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The System settings card now uses the shared Switch component for its startup and close-to-tray controls. Both controls retain their existing state, handlers, disabled conditions, and accessibility references.

Changes

System settings toggles

Layer / File(s) Summary
Replace custom system toggles
frontend/src/pages/SettingsPage/components/SystemSettingsCard.tsx
The startup and close-to-tray controls now use the shared Switch component. Their state, handlers, disabled conditions, and accessibility references remain in place.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor · Severity of issue fixed: Low

Possibly related PRs

  • AOSSIE-Org/PictoPy#1669: Its stated objective also replaces the System settings toggles with the shared Switch component.

Suggested labels: TypeScript/JavaScript

Suggested reviewers: g-k-s-03

Merge Risk: Minimal · up to c26dc

The replacement preserves the identified setting behavior, with no actionable merge risk remaining after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replacing the System settings toggles with the shared Switch component.
Linked Issues check Passed Issue #1668 requires both System settings toggles to use the shared Switch component and preserve their setting logic and accessibility attributes. SystemSettingsCard.tsx imports Switch and uses…
Out of Scope Changes check Passed The reviewed change is limited to SystemSettingsCard.tsx. It replaces the two custom controls with the shared Switch component and does not show unrelated implementation changes.
Full details: Linked Issues check

Explanation

Issue #1668 requires both System settings toggles to use the shared Switch component and preserve their setting logic and accessibility attributes. SystemSettingsCard.tsx imports Switch and uses it for both controls. The file retains the checked state, handlers, disabled conditions, Tauri invoke calls, aria-labelledby, and aria-describedby values.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the toggles bright,
Shared switches now sit just right.
Startup waits at a gentle tap,
Close-to-tray follows the same map.
Two controls keep their state in view,
And access labels stay there too.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request possible-duplicate Potential semantic duplicate (upstream comparison) labels Oct 28, 2026
@rohan-pandeyy rohan-pandeyy added cleanup and removed bug Something isn't working enhancement New feature or request possible-duplicate Potential semantic duplicate (upstream comparison) labels Nov 1, 2026

@rohan-pandeyy rohan-pandeyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG:PROD:System settings toggles use a custom switch instead of the shared Switch component

2 participants