Группы: плашка + для создания группы в списке Мои группы

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 19:56:54 +03:00
co-authored by Claude Opus 4.8
parent e3a78301c2
commit 66370c7df4
+18
View File
@@ -1,8 +1,12 @@
import { useState } from "react";
import { useMe, useSetActiveGroup } from "../hooks/auth"; import { useMe, useSetActiveGroup } from "../hooks/auth";
import { CreateGroupForm } from "./CreateGroupForm";
export function GroupSwitcher() { export function GroupSwitcher() {
const { data: me } = useMe(); const { data: me } = useMe();
const setActive = useSetActiveGroup(); const setActive = useSetActiveGroup();
const [creating, setCreating] = useState(false);
if (!me || me.groups.length === 0) return null; if (!me || me.groups.length === 0) return null;
return ( return (
@@ -21,7 +25,21 @@ export function GroupSwitcher() {
</button> </button>
); );
})} })}
{/* Плашка создания новой группы — в одном ряду логики с выбором группы. */}
<button
className="btn"
aria-label="Создать группу"
onClick={() => setCreating((v) => !v)}
>
+
</button>
</div> </div>
{creating && (
<div style={{ marginTop: 12 }}>
<CreateGroupForm onCreated={() => setCreating(false)} />
</div>
)}
</div> </div>
); );
} }