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] }); - }} + ) : ( + <> +