diff --git a/admin/src/pages/gyms/GymDetail.tsx b/admin/src/pages/gyms/GymDetail.tsx index 49cf08b..3ff01bc 100644 --- a/admin/src/pages/gyms/GymDetail.tsx +++ b/admin/src/pages/gyms/GymDetail.tsx @@ -2,12 +2,15 @@ import { useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { + Crown, Dumbbell, Image as ImageIcon, MapPin, Pencil, ShieldCheck, Star, + UserPlus, + UserX, Users, Wrench, X, @@ -17,7 +20,7 @@ import { api } from '../../api/client'; import { AuthImage } from '../../components/AuthImage'; import { UserPicker } from '../../components/UserPicker'; import { useAdminUsers } from '../users/user-queries'; -import type { Equipment, Gym, GymException, GymPhoto } from '../../api/types'; +import type { Equipment, Gym, GymException, GymOwner, GymPhoto } from '../../api/types'; import { formatEquipmentSpec, formatGymEquipment } from '../../lib/equipment'; import { BackButton, @@ -27,10 +30,7 @@ import { ConfirmDialog, ErrorText, Field, - H3, Input, - Label, - ListRow, Loading, Modal, Muted, @@ -415,57 +415,80 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void }) } }; + const initials = (o: GymOwner) => + `${o.firstName?.[0] ?? ''}${o.lastName?.[0] ?? ''}`.toUpperCase() || o.email.slice(0, 2).toUpperCase(); + return ( - <> - -
- {owners.length === 0 && ( - Brak właściciela — wyznacz go, aby użytkownik mógł zarządzać siłownią. - )} - {owners.map((o) => ( - + {owners.length === 0 ? ( +
+
+ +
+

Brak właściciela

+ + Wyznacz osobę, która będzie zarządzać siłownią w aplikacji. + +
+ ) : ( +
+ {owners.map((o) => ( +
+ + {initials(o)} + +
+
+ + {[o.firstName, o.lastName].filter(Boolean).join(' ') || o.email} + + +
+ {o.email} +
+ - } - /> - ))} -
-
-

Nadaj właściciela

-
-
- + + +
+ ))} +
+ )} + +
+
+
-
- -
+
+ + Właściciel zarządza siłownią w aplikacji: urządzeniami, galerią i harmonogramem. + {error && {error}}
- +
); } @@ -711,7 +734,12 @@ export default function GymDetail() { > void invalidate()} /> - setOwnersOpen(false)} title="Zarządzaj właścicielami"> + setOwnersOpen(false)} + title="Zarządzaj właścicielami" + className="sm:max-w-lg" + > void invalidate()} />