import { useState } from "react"; import { useMe, useSetActiveGroup } from "../hooks/auth"; import { CreateGroupForm } from "./CreateGroupForm"; export function GroupSwitcher() { const { data: me } = useMe(); const setActive = useSetActiveGroup(); const [creating, setCreating] = useState(false); if (!me || me.groups.length === 0) return null; return (

Мои группы

{me.groups.map((g) => { const active = g.id === me.active_group_id; return ( ); })} {/* Плашка создания новой группы — в одном ряду логики с выбором группы. */}
{creating && (
setCreating(false)} />
)}
); }