Files
CC-Switch/src/components/ui/toggle-row.tsx
T
Jason eab1d08527 feat(settings): add app visibility settings
Allow users to choose which apps (Claude, Codex, Gemini, OpenCode) to display on the homepage.

- Add VisibleApps type and settings field in both frontend and backend
- Refactor AppSwitcher to render apps dynamically based on visibility
- Extract ToggleRow component for reuse
- Add i18n support for app visibility settings
2026-01-20 21:05:06 +08:00

42 lines
1.1 KiB
TypeScript

import { Switch } from "@/components/ui/switch";
export interface ToggleRowProps {
icon: React.ReactNode;
title: string;
description?: string;
checked: boolean;
onCheckedChange: (value: boolean) => void;
disabled?: boolean;
}
export function ToggleRow({
icon,
title,
description,
checked,
onCheckedChange,
disabled,
}: ToggleRowProps) {
return (
<div className="flex items-center justify-between gap-4 rounded-xl border border-border bg-card/50 p-4 transition-colors hover:bg-muted/50">
<div className="flex items-center gap-3">
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-background ring-1 ring-border">
{icon}
</div>
<div className="space-y-1">
<p className="text-sm font-medium leading-none">{title}</p>
{description ? (
<p className="text-xs text-muted-foreground">{description}</p>
) : null}
</div>
</div>
<Switch
checked={checked}
onCheckedChange={onCheckedChange}
disabled={disabled}
aria-label={title}
/>
</div>
);
}