diff --git a/frontend/src/components/CreateGroupForm.tsx b/frontend/src/components/CreateGroupForm.tsx index 9e40252..3c8a524 100644 --- a/frontend/src/components/CreateGroupForm.tsx +++ b/frontend/src/components/CreateGroupForm.tsx @@ -4,6 +4,7 @@ import { ApiError } from "../api/client"; import { useToast } from "../context/ToastContext"; import { useCreateGroup } from "../hooks/groups"; import { useExpansions } from "../hooks/reference"; +import { Switch } from "./Switch"; export function CreateGroupForm({ onCreated }: { onCreated?: () => void }) { const { data: expansions } = useExpansions(); @@ -47,9 +48,7 @@ export function CreateGroupForm({ onCreated }: { onCreated?: () => void }) { {e.name_ru} {e.is_base && (всегда включено)} - toggle(e.id)} diff --git a/frontend/src/components/Switch.tsx b/frontend/src/components/Switch.tsx new file mode 100644 index 0000000..435878c --- /dev/null +++ b/frontend/src/components/Switch.tsx @@ -0,0 +1,27 @@ +/** + * Тумблер вкл/выкл (стили .switch в global.css) — единый контрол для булевых опций + * (дополнения группы, фильтры, флаги). Вместо нативных чекбоксов. + */ +export function Switch({ + checked, + disabled, + onChange, +}: { + checked: boolean; + disabled?: boolean; + onChange?: (checked: boolean) => void; +}) { + return ( + + onChange?.(e.target.checked)} + /> + + + + + ); +} diff --git a/frontend/src/pages/GroupSettingsPage.tsx b/frontend/src/pages/GroupSettingsPage.tsx index 6e82776..c71a0b8 100644 --- a/frontend/src/pages/GroupSettingsPage.tsx +++ b/frontend/src/pages/GroupSettingsPage.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react"; import { ApiError } from "../api/client"; import { PlayerLink } from "../components/PlayerLink"; import { Spinner } from "../components/Spinner"; +import { Switch } from "../components/Switch"; import { MAX_GROUP_SIZE } from "../domain/constants"; import { useToast } from "../context/ToastContext"; import { useMe } from "../hooks/auth"; @@ -73,24 +74,20 @@ export function GroupSettingsPage() {