Admin: topbar podstron usera = 'Profil [nazwa]' jak w apce (tytul sekcji tylko w h2 w tresci, koniec dublowania naglowka)

This commit is contained in:
tisachi
2026-10-17 09:25:27 +02:00
parent b2978151c4
commit 702943fdc6
8 changed files with 56 additions and 13 deletions

View File

@@ -33,7 +33,8 @@ import {
} from '../../lib/body-measurements';
import { fmtDate } from '../../lib/format';
import type { CircumferenceSeries } from '../../api/types';
import { useUserBodyParameters } from './user-queries';
import { useAdminUser, useUserBodyParameters } from './user-queries';
import { userDisplayName } from './UserDetail';
const TOOLTIP_STYLE = {
background: 'var(--bg-card)',
@@ -446,13 +447,15 @@ function PartSection({
*/
export default function UserBodyParameters() {
const { id } = useParams();
const { user } = useAdminUser(id);
const { data: bp, isLoading: bpLoading, error: bpError } = useUserBodyParameters(id);
const [visible, setVisible] = useState<Record<string, number>>({});
const [selected, setSelected] = useState<string | null>(null);
useTopbar({
title: 'Parametry ciała',
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
});

View File

@@ -12,7 +12,8 @@ import {
Skeleton,
} from '../../components/ui';
import { fmtDate } from '../../lib/format';
import { useUserClaims } from './user-queries';
import { useAdminUser, useUserClaims } from './user-queries';
import { userDisplayName } from './UserDetail';
const STATUS_BADGE: Record<string, { label: string; color: 'green' | 'yellow' | 'red' }> = {
PENDING: { label: 'Oczekuje', color: 'yellow' },
@@ -26,7 +27,12 @@ const STATUS_BADGE: Record<string, { label: string; color: 'green' | 'yellow' |
*/
export default function UserClaims() {
const { id } = useParams();
useTopbar({ title: 'Wnioski', back: id ? `/users/${id}` : '/users' });
const { user } = useAdminUser(id);
useTopbar({
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
});
const { data, isLoading, error } = useUserClaims(id);
if (isLoading) {

View File

@@ -4,7 +4,8 @@ import { History } from 'lucide-react';
import { useTopbar } from '../../topbar';
import { MonthPickerCore } from '../../topbar/MonthPicker';
import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
import { useUserHistory } from './user-queries';
import { useAdminUser, useUserHistory } from './user-queries';
import { userDisplayName } from './UserDetail';
import HistoryTable from '../../components/HistoryTable';
/**
@@ -13,6 +14,7 @@ import HistoryTable from '../../components/HistoryTable';
*/
export default function UserHistory() {
const { id } = useParams();
const { user } = useAdminUser(id);
const [params] = useSearchParams();
const initialOpenSessionId = params.get('session') ?? undefined;
const [month, setMonth] = useState('');
@@ -28,7 +30,8 @@ export default function UserHistory() {
.reverse();
useTopbar({
title: 'Historia treningów',
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
dateFilter: (
<MonthPickerCore

View File

@@ -264,7 +264,8 @@ export default function UserInfo() {
const areaName = (muscle: string) => areas.find((a) => a.muscle === muscle)?.name ?? muscle;
useTopbar({
title: 'Dane osobowe',
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
});
@@ -284,7 +285,7 @@ export default function UserInfo() {
return (
<>
<PageHeader
title={`Dane osobowe — ${name}`}
title="Dane osobowe"
leading={<Avatar name={name} size={40} />}
actions={<BackButton to={`/users/${user.id}`} />}
/>

View File

@@ -13,6 +13,7 @@ import {
Skeleton,
} from '../../components/ui';
import { useAdminUser } from './user-queries';
import { userDisplayName } from './UserDetail';
/**
* Członkostwa użytkownika w siłowniach (admin): tylko do odczytu.
@@ -24,7 +25,11 @@ export default function UserMemberships() {
const { id } = useParams();
const { user, isLoading, error } = useAdminUser(id);
useTopbar({ title: 'Członkostwa w siłowniach', back: id ? `/users/${id}` : '/users' });
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
useTopbar({
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
});
if (isLoading) {
return (

View File

@@ -3,7 +3,8 @@ import { TrendingUp } from 'lucide-react';
import { useTopbar } from '../../topbar';
import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
import ExerciseProgressCards from '../../components/ExerciseProgressCards';
import { useUserExerciseProgress } from './user-queries';
import { useAdminUser, useUserExerciseProgress } from './user-queries';
import { userDisplayName } from './UserDetail';
/**
* Postępy per ćwiczenie użytkownika — widok admina 1:1 z `/profile/progress`
@@ -11,7 +12,12 @@ import { useUserExerciseProgress } from './user-queries';
*/
export default function UserProgress() {
const { id } = useParams();
useTopbar({ title: 'Postępy', back: id ? `/users/${id}` : '/users' });
const { user } = useAdminUser(id);
useTopbar({
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
back: id ? `/users/${id}` : '/users',
});
const { data, isLoading, error } = useUserExerciseProgress(id);
if (isLoading) {