diff --git a/app/src/pages/trainees/Trainees.tsx b/app/src/pages/trainees/Trainees.tsx index a61900a..ae8c73e 100644 --- a/app/src/pages/trainees/Trainees.tsx +++ b/app/src/pages/trainees/Trainees.tsx @@ -260,6 +260,11 @@ export default function Trainees() { }, [filtered, trainerGymIds]); // aktywna zakładka siłowni (domyślnie pierwsza grupa; fallback gdy grupa zniknie np. po wyszukiwarce) const activeGroup = gymGroups.find((g) => g.id === activeGymTab) ?? gymGroups[0]; + // lokalizacja aktywnej siłowni (z członkostw trenera) — pod nagłówkiem grupy + const activeGym = + activeGroup && activeGroup.id !== 'other' + ? trainerGyms.find((m) => m.gymId === activeGroup.id)?.gym + : undefined; const invite = async (candidate: UserSearchResult) => { try { @@ -393,9 +398,14 @@ export default function Trainees() { />
-
-

{activeGroup.name}

- {activeGroup.trainees.length} +
+
+

{activeGroup.name}

+ {activeGroup.trainees.length} +
+ {activeGym?.location && ( +

{activeGym.location}

+ )}
diff --git a/app/test/e2e/trainees.spec.ts b/app/test/e2e/trainees.spec.ts index e0116c7..763c4f0 100644 --- a/app/test/e2e/trainees.spec.ts +++ b/app/test/e2e/trainees.spec.ts @@ -30,6 +30,8 @@ test('trener widzi listę podopiecznych z metrykami i flagami', async ({ page }) // grupowanie wg siłowni — opcja z filtra (domyślnie lista płaska) await page.getByRole('button', { name: 'Grupuj wg siłowni' }).click(); await expect(page.getByRole('heading', { name: 'Żelazna Świątynia' })).toBeVisible(); + // lokalizacja siłowni pod nagłówkiem grupy + await expect(page.getByText('Warszawa')).toBeVisible(); }); test('wyszukiwarka w menu kontekstowym filtruje listę podopiecznych', async ({ page }) => { diff --git a/app/test/trainees.test.tsx b/app/test/trainees.test.tsx index fe306b5..b7cb0c7 100644 --- a/app/test/trainees.test.tsx +++ b/app/test/trainees.test.tsx @@ -441,11 +441,18 @@ describe('Trainees — lista i szczegóły', () => { // przełączenie na siłownię — Anna + Tomek (Tomek trenowany w obu siłowniach) await user.click(screen.getByRole('button', { name: 'Żelazna Świątynia' })); expect(screen.getByRole('heading', { name: 'Żelazna Świątynia' })).toBeInTheDocument(); + // lokalizacja siłowni pod nagłówkiem grupy + expect(screen.getByText('Warszawa')).toBeInTheDocument(); expect(screen.getByText('Anna Nowak')).toBeInTheDocument(); expect(screen.getAllByText('Tomek Kowalczyk')).toHaveLength(1); - // „Inne” — Piotr i Zofia + // Mega Gym — lokalizacja Kraków + await user.click(screen.getByRole('button', { name: 'Mega Gym' })); + expect(screen.getByText('Kraków')).toBeInTheDocument(); + + // „Inne” — Piotr i Zofia (bez lokalizacji) await user.click(screen.getByRole('button', { name: 'Inne' })); + expect(screen.queryByText('Warszawa')).not.toBeInTheDocument(); expect(screen.getByRole('heading', { name: 'Inne' })).toBeInTheDocument(); expect(screen.getByText('Piotr Kowal')).toBeInTheDocument(); expect(screen.queryByText('Anna Nowak')).not.toBeInTheDocument();