Admin: UserDetail menu kontekstowe tylko z akcjami (Edytuj, Usun); AGENTS.md koryguje zasade (nawigacja w głąb = treść)
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
import { useState } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||
import {
|
||||
Activity,
|
||||
Building2,
|
||||
ChevronRight,
|
||||
Dumbbell,
|
||||
FileText,
|
||||
Flame,
|
||||
History,
|
||||
ShieldCheck,
|
||||
Pencil,
|
||||
Scale,
|
||||
TrendingUp,
|
||||
User,
|
||||
UserCog,
|
||||
type LucideIcon,
|
||||
} from 'lucide-react';
|
||||
import { useTopbar, type TopbarCustomGroup } from '../../topbar';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { api } from '../../api/client';
|
||||
import { Badge, Card, ConfirmDialog, ErrorText, Loading } from '../../components/ui';
|
||||
import { Avatar } from '../../components/Avatar';
|
||||
@@ -122,46 +120,15 @@ export default function UserDetail() {
|
||||
const [confirmOpen, setConfirmOpen] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
// Operacje admina w menu kontekstowym (topbar) zamiast przycisków w treści.
|
||||
const groups: TopbarCustomGroup[] | undefined = user
|
||||
? [
|
||||
{
|
||||
id: 'data',
|
||||
label: 'Dane',
|
||||
icon: UserCog,
|
||||
actions: [
|
||||
{ label: 'Edytuj', to: `/users/${user.id}/edit` },
|
||||
{ label: 'Dane osobowe', to: `/users/${user.id}/info` },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'training',
|
||||
label: 'Trening',
|
||||
icon: Activity,
|
||||
actions: [
|
||||
{ label: 'Parametry ciała', to: `/users/${user.id}/body-parameters` },
|
||||
{ label: 'Historia treningów', to: `/users/${user.id}/history` },
|
||||
{ label: 'Postępy', to: `/users/${user.id}/progress` },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'access',
|
||||
label: 'Dostęp',
|
||||
icon: ShieldCheck,
|
||||
actions: [
|
||||
{ label: 'Członkostwa', to: `/users/${user.id}/memberships` },
|
||||
{ label: 'Wnioski', to: `/users/${user.id}/claims` },
|
||||
],
|
||||
},
|
||||
]
|
||||
: undefined;
|
||||
|
||||
// Menu trzyma tylko akcje (edycja/usunięcie); nawigacja do podstron = wiersze w treści.
|
||||
useTopbar({
|
||||
title: user ? userDisplayName(user) : 'Użytkownik',
|
||||
back: '/users',
|
||||
groups,
|
||||
actions: user
|
||||
? [{ label: 'Usuń', variant: 'danger', onClick: () => setConfirmOpen(true) }]
|
||||
? [
|
||||
{ label: 'Edytuj', icon: Pencil, to: `/users/${user.id}/edit` },
|
||||
{ label: 'Usuń', variant: 'danger', onClick: () => setConfirmOpen(true) },
|
||||
]
|
||||
: [],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user