diff --git a/src/components/RemoteSportInfo.tsx b/src/components/RemoteSportInfo.tsx index b09ad9a..4f34382 100644 --- a/src/components/RemoteSportInfo.tsx +++ b/src/components/RemoteSportInfo.tsx @@ -5,7 +5,7 @@ import useTranslation from '@/src/hooks/useTranslation'; import apiFetch from '@/src/utils/apiFetch'; interface RemoteInfo { - origin_name: string; + facility_name: string; logo_url?: string; sport_name: string; sport_logo_url?: string; @@ -28,12 +28,14 @@ export default function RemoteInfo({ remoteSlug, sportSlug, remotesData, isLoadi // If remotesData is provided, use it instead of fetching if (remotesData) { - const remote = (remotesData.remotes || []).find((r: any) => r.origin_slug === remoteSlug); - const sport = remote?.sports?.find((s: any) => s.sport_slug === sportSlug); - if (remote && sport) { + const facility = (remotesData.facilities || remotesData.remotes || []).find((f: any) => + f.facility_slug === remoteSlug || f.origin_slug === remoteSlug + ); + const sport = facility?.sports?.find((s: any) => s.sport_slug === sportSlug); + if (facility && sport) { setRemoteInfo({ - origin_name: remote.origin_name, - logo_url: remote.origin_logo_url || remote.logo_url, + facility_name: facility.facility_name || facility.origin_name, + logo_url: facility.facility_logo_url || facility.origin_logo_url || facility.logo_url, sport_name: sport.sport_name, sport_logo_url: sport.sport_logo_url || sport.logo_url || `/images/${sportSlug}-logo.png`, }); @@ -49,14 +51,14 @@ export default function RemoteInfo({ remoteSlug, sportSlug, remotesData, isLoadi apiFetch(`/facilities`) .then(res => res.json()) .then(data => { - const remote = (data.remotes || []).find((r: any) => r.origin_slug === remoteSlug); - const sport = remote?.sports?.find((s: any) => s.sport_slug === sportSlug); - if (remote && sport) { + const facility = (data.facilities || []).find((f: any) => f.facility_slug === remoteSlug); + const sport = facility?.sports?.find((s: any) => s.sport_slug === sportSlug); + if (facility && sport) { setRemoteInfo({ - origin_name: remote.origin_name, - logo_url: remote.origin_logo_url || remote.logo_url, + facility_name: facility.facility_name, + logo_url: facility.facility_logo_url, sport_name: sport.sport_name, - sport_logo_url: sport.sport_logo_url || sport.logo_url || `/images/${sportSlug}-logo.png`, + sport_logo_url: sport.sport_logo_url || `/images/${sportSlug}-logo.png`, }); } }) @@ -83,7 +85,7 @@ export default function RemoteInfo({ remoteSlug, sportSlug, remotesData, isLoadi