From 78fa6adfea5ccf97138aed55fb33288bce7412ec Mon Sep 17 00:00:00 2001 From: Tilumca Date: Wed, 14 Oct 2026 04:23:23 +0200 Subject: [PATCH] =?UTF-8?q?Admin:=20detal=20si=C5=82owni=20przebudowany=20?= =?UTF-8?q?na=20wzor=20aplikacji=20(hero=20z=20okladka=20i=20chipami,=20dw?= =?UTF-8?q?ie=20kolumny,=20godziny=20+=20wyjatek)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/gyms/GymDetail.tsx | 405 ++++++++++++++++++----------- admin/test/GymDetail.test.tsx | 12 +- admin/test/e2e/admin.spec.ts | 4 +- 3 files changed, 259 insertions(+), 162 deletions(-) diff --git a/admin/src/pages/gyms/GymDetail.tsx b/admin/src/pages/gyms/GymDetail.tsx index 0d64ac9..faf0ce8 100644 --- a/admin/src/pages/gyms/GymDetail.tsx +++ b/admin/src/pages/gyms/GymDetail.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { useQuery, useQueryClient } from '@tanstack/react-query'; -import { ImagePlus, Star, X } from 'lucide-react'; +import { Dumbbell, ImagePlus, MapPin, Star, Users, X } from 'lucide-react'; import { useTopbar } from '../../topbar'; import { api } from '../../api/client'; import { AuthImage } from '../../components/AuthImage'; @@ -9,28 +9,49 @@ import type { Equipment, Gym, GymException, GymPhoto } from '../../api/types'; import { formatEquipmentSpec, formatGymEquipment } from '../../lib/equipment'; import { BackButton, - Badge, Button, Card, Chip, ErrorText, Field, Input, - ListRow, Loading, - PageHeader, SectionHeader, Select, SuccessText, } from '../../components/ui'; import { AvailabilityEditor } from '../../components/AvailabilityEditor'; -import { formatAvailability, normalizeAvailability, TIME_SLOTS } from '../../lib/availability'; +import { normalizeAvailability, TIME_SLOTS } from '../../lib/availability'; -function InfoItem({ label, children }: { label: string; children: React.ReactNode }) { +/* Lista godzin otwarcia: wiersz na dzień (czytelna w wąskiej kolumnie), „dziś” wyróżnione. */ +function HoursList({ gym }: { gym: Gym }) { + const availability = normalizeAvailability(gym.availability); + const todayIdx = (new Date().getDay() + 6) % 7; + const DOWS = ['Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota', 'Niedziela']; + const fmt = (r: { start: string; end: string } | null) => + r ? `${r.start}–${r.end}` : 'zamknięte'; return ( -
-
{label}
-
{children}
+
+ {availability.map((day, i) => ( +
+ + {DOWS[i]} + {i === todayIdx && ( + + dziś + + )} + + + {fmt(day)} + +
+ ))}
); } @@ -165,77 +186,119 @@ export default function GymDetail() { return ( <> - - - {gym.kind === 'VIRTUAL' ? 'Wirtualna' : 'Realna'} - - {gym.isPrivate && Prywatna} - {gym._count?.memberships ?? 0} członk. - - } - actions={} - /> - - {gym.coverPhoto && ( -
+ {/* HERO: okładka (zdjęcie lub placeholder) + nazwa + chipy metadanych */} +
+ {gym.coverPhoto ? ( - - )} - - {gym.kind === 'REAL' && ( - - {}} /> - - )} - - - -
- {gym.name} - {gym.location || '—'} - {formatAvailability(gym.availability) || '—'} - {gym.capacity ?? '—'} -
-
- - - - { - void queryClient.invalidateQueries({ queryKey: ['gyms'] }); - void queryClient.invalidateQueries({ queryKey: ['gym', gym.id] }); - }} + ) : ( + <> +