- {(Object.keys(MUSCLE_TONES) as MuscleTone[]).map((tone) => {
- const entries = chain[tone] ?? [];
- return (
-
-
{MUSCLE_TONES[tone].label}
- {entries.length === 0 ? (
-
—
- ) : (
-
- {entries.map((en) => (
-
-
{en.name}
-
- {(en.exercises ?? []).length > 0
- ? `${MUSCLE_TONES[tone].chainPrefix}${(en.exercises ?? [])
- .map((x) => x.name)
- .join(', ')}`
- : 'brak w aktywnym planie'}
-
-
- ))}
-
- )}
-
- );
- })}
+ {(user.socialMedia ?? []).length > 0 ? (
+
+ {(user.socialMedia ?? []).map((s, i) => (
+
+ ))}
) : (
-
+
+
+ Brak dodanych profili.
+
)}
+
+
>
);
}
diff --git a/admin/src/pages/users/UserProgress.tsx b/admin/src/pages/users/UserProgress.tsx
index 2b4b921..0c9b7e7 100644
--- a/admin/src/pages/users/UserProgress.tsx
+++ b/admin/src/pages/users/UserProgress.tsx
@@ -1,21 +1,13 @@
import { useParams } from 'react-router-dom';
import { TrendingUp } from 'lucide-react';
import { useTopbar } from '../../topbar';
-import {
- BackButton,
- Card,
- EmptyState,
- ErrorText,
- Muted,
- PageHeader,
- Skeleton,
-} from '../../components/ui';
+import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
import ExerciseProgressCards from '../../components/ExerciseProgressCards';
import { useUserExerciseProgress } from './user-queries';
/**
- * Postępy per ćwiczenie (1RM Epley + objętość) użytkownika — widok admina,
- * wzorowany na `/profile/progress` z aplikacji.
+ * Postępy per ćwiczenie użytkownika — widok admina 1:1 z `/profile/progress`
+ * z aplikacji (czyt. opis wzoru 1RM usunięty z obu stron).
*/
export default function UserProgress() {
const { id } = useParams();
@@ -38,10 +30,6 @@ export default function UserProgress() {
} />
-
- 1RM Epley: zaplanowane obciążenie × (1 + powtórzenia/30), maks. per sesja; objętość = Σ
- obciążenie × powtórzenia.
-
{error && Błąd: {(error as Error).message}}
{!error && exercises.length === 0 && (
{
});
describe('admin UserBodyParameters page', () => {
- it('pokazuje ostatnie pomiary wagi i obwodów', async () => {
+ it('zakładki z pełną historią: waga + obwody grupowane po części (pełne nazwy)', async () => {
mockFetchRoutes([['/body-parameters', () => BP]]);
renderPage();
expect(
await screen.findByRole('heading', { name: 'Parametry ciała', level: 2 }),
).toBeInTheDocument();
- // karta Waga: najnowszy pomiar + wiersz listy
+
+ // zakładki części z pełnymi nazwami (bez skrótu „Przedr.”)
+ expect(await screen.findByRole('button', { name: 'Waga' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Klatka piersiowa' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Biceps' })).toBeInTheDocument();
+
+ // panel Wagi (pierwsza zakładka): najnowszy pomiar + postęp + pełna historia
+ expect(screen.getByRole('heading', { name: 'Waga', level: 3 })).toBeInTheDocument();
expect(screen.getAllByText('81.5 kg').length).toBeGreaterThan(0);
- expect(screen.getByText('Za mało danych na wykres (min. 2 pomiary).')).toBeInTheDocument();
- // karta obwodu grupowana po części ciała (Biceps lewy → karta „Biceps”)
- expect(screen.getByRole('heading', { name: 'Biceps' })).toBeInTheDocument();
- expect(screen.getAllByText('35 cm').length).toBeGreaterThan(0);
- expect(screen.getAllByText(/lewy/i).length).toBeGreaterThan(0);
+ expect(screen.getByRole('heading', { name: 'Postęp' })).toBeInTheDocument();
+ // separator dziesiętny bywa kropką lub przecinkiem zależnie od implementacji Intl
+ expect(screen.getByText(/−0[.,]5 kg od pierwszego/)).toBeInTheDocument();
+ // lista z pełnej historii (oba pomiary, nawet sprzed „bieżącego miesiąca”);
+ // wartość i jednostka to osobne węzły tekstowe w kafelku listy
+ const tiles = () =>
+ Array.from(document.querySelectorAll('li')).map(
+ (li) => (li.textContent ?? '').replace(/\s+/g, ' ').trim(),
+ );
+ expect(tiles().some((t) => t.startsWith('82 kg'))).toBe(true);
+ });
+
+ it('strony mierzone jako dwa niezależne panele z własnym postępem', async () => {
+ mockFetchRoutes([['/body-parameters', () => BP]]);
+ renderPage();
+
+ const bicepsTab = await screen.findByRole('button', { name: 'Biceps' });
+ fireEvent.click(bicepsTab);
+
+ // lewy zawsze pierwszy, potem prawy — każdy jako osobna karta
+ expect(await screen.findByRole('heading', { name: 'Biceps — lewy' })).toBeInTheDocument();
+ expect(screen.getByRole('heading', { name: 'Biceps — prawy' })).toBeInTheDocument();
+ expect(screen.getAllByRole('heading', { name: 'Postęp' }).length).toBe(2);
+ expect(screen.getAllByText('Za mało danych na wykres (min. 2 pomiary).').length).toBe(1);
+ });
+
+ it('pokaż więcej odkrywa kolejne pomiary z historii', async () => {
+ const many = {
+ weight: Array.from({ length: 5 }, (_, i) => ({
+ id: `w${i}`,
+ value: 80 + i / 10,
+ date: `2026-08-0${i + 1}T10:00:00.000Z`,
+ })),
+ circumferences: [],
+ };
+ mockFetchRoutes([['/body-parameters', () => many]]);
+ renderPage();
+ await screen.findByRole('heading', { name: 'Waga', level: 3 });
+
+ // domyślnie 3 najnowsze, gwóźdź programu: 4. pomiar ukryty do kliknięcia
+ const tiles = () =>
+ Array.from(document.querySelectorAll('li')).map(
+ (li) => (li.textContent ?? '').replace(/\s+/g, ' ').trim(),
+ );
+ expect(tiles().some((t) => /^80[.,]1 kg/.test(t))).toBe(false);
+ fireEvent.click(screen.getByRole('button', { name: 'Pokaż więcej' }));
+ expect(tiles().some((t) => /^80[.,]1 kg/.test(t))).toBe(true);
+ });
+
+ it('pokazuje stan pusty, gdy użytkownik nie ma pomiarów', async () => {
+ mockFetchRoutes([
+ ['/body-parameters', () => ({ weight: [], circumferences: [] })],
+ ]);
+ renderPage();
+
+ expect(await screen.findByText('Brak pomiarów')).toBeInTheDocument();
+ expect(
+ screen.getByText('Pomiary pojawią się tutaj, gdy użytkownik doda wagę lub obwód w aplikacji.'),
+ ).toBeInTheDocument();
});
it('jest tylko do odczytu — brak kontrolek dodawania i usuwania pomiarów', async () => {
@@ -78,6 +153,7 @@ describe('admin UserBodyParameters page', () => {
expect(screen.queryByRole('button', { name: '+ Waga' })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Dodaj wagę' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Dodaj pomiar' })).not.toBeInTheDocument();
expect(screen.queryAllByRole('button', { name: /Usuń pomiar/ })).toHaveLength(0);
});
});
diff --git a/admin/test/UserDetail.test.tsx b/admin/test/UserDetail.test.tsx
index 53e3a6d..a63fd37 100644
--- a/admin/test/UserDetail.test.tsx
+++ b/admin/test/UserDetail.test.tsx
@@ -97,6 +97,7 @@ describe('admin UserDetail (przegląd profilu)', () => {
['/body-parameters', () => ({ weight: [], circumferences: [] })],
['/history', () => ({ sessions: [] })],
['/claims', () => ({ claims: [] })],
+ ['/exercise-progress', () => ({ exercises: [] })],
]);
renderUserDetail();
expect(await screen.findByText('Zablokowane')).toBeInTheDocument();
@@ -121,6 +122,7 @@ describe('admin UserDetail (przegląd profilu)', () => {
['/body-parameters', () => ({ weight: [], circumferences: [] })],
['/history', () => ({ sessions: [] })],
['/claims', () => ({ claims: [] })],
+ ['/exercise-progress', () => ({ exercises: [] })],
]);
renderUserDetail();
expect(await screen.findByText(/Zawieszone do/)).toBeInTheDocument();
@@ -139,6 +141,7 @@ describe('admin UserDetail (przegląd profilu)', () => {
],
['/history', () => ({ sessions: [] })],
['/claims', () => ({ claims: [] })],
+ ['/exercise-progress', () => ({ exercises: [{ id: 'e1' }] })],
]);
renderUserDetail();
@@ -148,10 +151,16 @@ describe('admin UserDetail (przegląd profilu)', () => {
expect(screen.getByText('@jano')).toBeInTheDocument();
expect(screen.getByText('Admin')).toBeInTheDocument();
- // mini-statystyki z endpointów
+ // mini-statystyki z endpointów (pasek 3-kaflowy jak w aplikacji — bez „Ostatnia waga")
expect(screen.getByText('Killstreak')).toBeInTheDocument();
expect(screen.getByText('7')).toBeInTheDocument();
- expect(screen.getByText('81.5 kg')).toBeInTheDocument();
+ expect(screen.getByText('Objętość 7 dni')).toBeInTheDocument();
+ expect(screen.getByText('Sesje')).toBeInTheDocument();
+ expect(screen.queryByText('Ostatnia waga')).not.toBeInTheDocument();
+ // waga pozostaje w podsumowaniu wiersza „Parametry ciała”
+ expect(screen.getByText('81.5 kg · 10.09.2026')).toBeInTheDocument();
+ // podsumowanie Postępów = liczba ćwiczeń z endpointu
+ expect(screen.getByRole('link', { name: /Postępy/ })).toHaveTextContent('1 ćwiczenie');
// wiersze sekcji prowadzące na podstrony
for (const title of [
@@ -176,6 +185,7 @@ describe('admin UserDetail (przegląd profilu)', () => {
['/body-parameters', () => ({ weight: [], circumferences: [] })],
['/history', () => ({ sessions: [] })],
['/claims', () => ({ claims: [] })],
+ ['/exercise-progress', () => ({ exercises: [] })],
]);
renderUserDetail();
const row = await screen.findByRole('link', { name: /Członkostwa w siłowniach/ });
diff --git a/admin/test/UserInfo.test.tsx b/admin/test/UserInfo.test.tsx
index 5dfb832..399289e 100644
--- a/admin/test/UserInfo.test.tsx
+++ b/admin/test/UserInfo.test.tsx
@@ -47,7 +47,15 @@ const U1: User = {
heightCm: 180,
phone: '+48 500 100 200',
isAdmin: true,
- availability: null,
+ availability: [
+ { start: '18:00', end: '20:00' },
+ { start: '18:00', end: '20:00' },
+ { start: '18:00', end: '20:00' },
+ null,
+ null,
+ null,
+ null,
+ ] as User['availability'],
priorities: null,
exclusions: null,
developMuscles: ['chest'],
@@ -120,6 +128,9 @@ describe('admin UserInfo page', () => {
expect(screen.getByText('180 cm')).toBeInTheDocument();
expect(screen.getByText('+48 500 100 200')).toBeInTheDocument();
+ // dostępność jako chipy z pogrupowanymi dniami (jak w aplikacji)
+ expect(screen.getByText('Pon–Śr 18:00–20:00')).toBeInTheDocument();
+
// priorytety: nazwy mięśni rozwinięte z listy obszarów
expect(screen.getAllByText('Co rozwija').length).toBeGreaterThan(0);
expect(screen.getAllByText('Klatka piersiowa').length).toBeGreaterThan(0);
diff --git a/admin/test/e2e/admin.spec.ts b/admin/test/e2e/admin.spec.ts
index ff07620..151ebb5 100644
--- a/admin/test/e2e/admin.spec.ts
+++ b/admin/test/e2e/admin.spec.ts
@@ -111,10 +111,14 @@ test('kliknięcie w użytkownika otwiera przegląd profilu (wzór z apki)', asyn
await page.getByRole('link', { name: 'Użytkownicy' }).click();
await page.getByRole('link', { name: 'Jan Kowalski' }).click();
await expect(page).toHaveURL(/\/users\/user-1$/);
- // hero: e-mail + mini-statystyki + wiersze sekcji
+ // hero: e-mail + mini-statystyki (pasek 3-kaflowy jak w apce) + wiersze sekcji
await expect(page.getByText('jan@fitos.pl')).toBeVisible();
await expect(page.getByText('Killstreak')).toBeVisible();
- await expect(page.getByText('81.5 kg', { exact: true })).toBeVisible();
+ await expect(page.getByText('Objętość 7 dni')).toBeVisible();
+ await expect(page.getByText('Sesje')).toBeVisible();
+ await expect(page.getByText('Ostatnia waga')).toHaveCount(0);
+ // waga pozostaje w podsumowaniu wiersza „Parametry ciała”
+ await expect(page.getByText('81.5 kg ·')).toBeVisible();
await expect(page.getByRole('link', { name: /Dane osobowe/ })).toBeVisible();
await expect(page.getByRole('link', { name: /Parametry ciała/ })).toBeVisible();
await expect(page.getByRole('link', { name: /Historia treningów/ })).toBeVisible();
diff --git a/admin/test/setup.ts b/admin/test/setup.ts
index 116a56c..50fdf04 100644
--- a/admin/test/setup.ts
+++ b/admin/test/setup.ts
@@ -2,6 +2,27 @@ import '@testing-library/jest-dom/vitest';
import { afterEach } from 'vitest';
import { cleanup } from '@testing-library/react';
+// recharts (ResponsiveContainer) wymaga ResizeObserver, którego jsdom nie dostarcza.
+// Stub wywołuje callback z fikcyjnym rozmiarem — wykresy renderują się w stałym 800×600.
+class ResizeObserverStub {
+ private cb: (entries: { contentRect: { width: number; height: number } }[]) => void;
+ constructor(cb: (entries: { contentRect: { width: number; height: number } }[]) => void) {
+ this.cb = cb;
+ }
+ observe() {
+ this.cb([{ contentRect: { width: 800, height: 600 } }]);
+ }
+ unobserve() {}
+ disconnect() {}
+}
+if (typeof globalThis.ResizeObserver === 'undefined') {
+ Object.defineProperty(globalThis, 'ResizeObserver', {
+ value: ResizeObserverStub,
+ configurable: true,
+ writable: true,
+ });
+}
+
// vitest runs with globals:false, so RTL auto-cleanup is not registered
// automatically; clean the DOM after every test.
afterEach(() => {