website refactor

This commit is contained in:
2026-01-14 02:02:24 +01:00
parent 8d7c709e0c
commit 4522d41aef
291 changed files with 12763 additions and 9309 deletions

View File

@@ -5,8 +5,8 @@ import type { MembershipRole } from '@/lib/types/MembershipRole';
import { useParams } from 'next/navigation';
import { useMemo } from 'react';
import {
useLeagueRosterJoinRequests,
useLeagueRosterMembers,
useLeagueJoinRequests,
useLeagueRosterAdmin,
useApproveJoinRequest,
useRejectJoinRequest,
useUpdateMemberRole,
@@ -24,13 +24,13 @@ export function RosterAdminPage() {
data: joinRequests = [],
isLoading: loadingJoinRequests,
refetch: refetchJoinRequests,
} = useLeagueRosterJoinRequests(leagueId);
} = useLeagueJoinRequests(leagueId);
const {
data: members = [],
isLoading: loadingMembers,
refetch: refetchMembers,
} = useLeagueRosterMembers(leagueId);
} = useLeagueRosterAdmin(leagueId);
const loading = loadingJoinRequests || loadingMembers;
@@ -55,16 +55,16 @@ export function RosterAdminPage() {
return joinRequests.length === 1 ? '1 request' : `${joinRequests.length} requests`;
}, [joinRequests.length]);
const handleApprove = async (joinRequestId: string) => {
await approveMutation.mutateAsync({ leagueId, joinRequestId });
const handleApprove = async (requestId: string) => {
await approveMutation.mutateAsync({ leagueId, requestId });
};
const handleReject = async (joinRequestId: string) => {
await rejectMutation.mutateAsync({ leagueId, joinRequestId });
const handleReject = async (requestId: string) => {
await rejectMutation.mutateAsync({ leagueId, requestId });
};
const handleRoleChange = async (driverId: string, newRole: MembershipRole) => {
await updateRoleMutation.mutateAsync({ leagueId, driverId, role: newRole });
await updateRoleMutation.mutateAsync({ leagueId, driverId, newRole });
};
const handleRemove = async (driverId: string) => {
@@ -96,8 +96,8 @@ export function RosterAdminPage() {
className="flex items-center justify-between gap-3 bg-deep-graphite border border-charcoal-outline rounded p-3"
>
<div className="min-w-0">
<p className="text-white font-medium truncate">{req.driverName}</p>
<p className="text-xs text-gray-400 truncate">{req.requestedAtIso}</p>
<p className="text-white font-medium truncate">{(req.driver as any)?.name || 'Unknown'}</p>
<p className="text-xs text-gray-400 truncate">{req.requestedAt}</p>
{req.message ? <p className="text-xs text-gray-500 truncate">{req.message}</p> : null}
</div>
@@ -140,17 +140,17 @@ export function RosterAdminPage() {
className="flex flex-col md:flex-row md:items-center md:justify-between gap-3 bg-deep-graphite border border-charcoal-outline rounded p-3"
>
<div className="min-w-0">
<p className="text-white font-medium truncate">{member.driverName}</p>
<p className="text-xs text-gray-400 truncate">{member.joinedAtIso}</p>
<p className="text-white font-medium truncate">{member.driver.name}</p>
<p className="text-xs text-gray-400 truncate">{member.joinedAt}</p>
</div>
<div className="flex flex-col md:flex-row md:items-center gap-2">
<label className="text-xs text-gray-400" htmlFor={`role-${member.driverId}`}>
Role for {member.driverName}
Role for {member.driver.name}
</label>
<select
id={`role-${member.driverId}`}
aria-label={`Role for ${member.driverName}`}
aria-label={`Role for ${member.driver.name}`}
value={member.role}
onChange={(e) => handleRoleChange(member.driverId, e.target.value as MembershipRole)}
className="bg-iron-gray text-white px-3 py-2 rounded"