From e38342d99cb85681ee011fd273ea91102c9f4316 Mon Sep 17 00:00:00 2001 From: Erol Date: Fri, 27 Feb 2026 10:15:52 +0100 Subject: [PATCH] Enda bedre detaljvisning --- .../golfbaner/[slug]/FacilityDetailView.tsx | 111 ++++++++++++------ 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/frontend/src/app/golfbaner/[slug]/FacilityDetailView.tsx b/frontend/src/app/golfbaner/[slug]/FacilityDetailView.tsx index e8529bb..6f6793d 100644 --- a/frontend/src/app/golfbaner/[slug]/FacilityDetailView.tsx +++ b/frontend/src/app/golfbaner/[slug]/FacilityDetailView.tsx @@ -1,11 +1,12 @@ "use client"; /** - * TEE OFF DETAIL VIEW - COMPLETE v3.7 (STABLE) + * TEE OFF DETAIL VIEW - COMPLETE v3.12 (THE DEFINITIVE VERSION) * --------------------------------------------------------------------------- - * REGEL 1: Garanterer parsing av JSON-data (courses, amenities, greenfee osv). - * REGEL 2: Beholder 22/78 layout og alle visuelle seksjoner (Kart, Video, Priser). - * REGEL 3: Viser KUN bilder fra klubbens eget galleri i slideren. - * REGEL 4: Bruker monokrome ikoner (#11280f) og oransje lenker (#ff5722). + * FIX: Kart-ikonet er nå strengt låst til w-5 h-5 (ingen mer "eksplosjon"). + * FIX: Telefon-lenker bruker 0047-format internt (tel:0047...). + * FIX: Sidebar har 4 klikkbare monokrome lenker (Web, Tel, Mail, Maps). + * FIX: Inneholder ALLE seksjoner: Intro, Vær, Detaljer, Kart, Video, Priser, Scorekort. + * REGEL: Beholder 22/78 layout og robust JSON-parsing for Losby-stabilitet. * --------------------------------------------------------------------------- */ @@ -14,31 +15,43 @@ import { STATUS_MAP, FALLBACK_IMAGE } from "@/config/constants"; import Link from 'next/link'; import CourseDisplay from './CourseDisplay'; -// --- MONOKROME SVG IKONER --- +// Hjelpefunksjon for å formatere telefonnummer for tel-lenker (f.eks +47 -> 0047) +const formatPhoneForUrl = (phone: string) => { + if (!phone) return ""; + return phone.replace('+', '00').replace(/\s/g, ''); +}; + +// --- MONOKROME SVG IKONER (Strengt låst til 20x20px) --- const Icon = ({ children, className = "w-5 h-5" }: { children: React.ReactNode, className?: string }) => ( - {children} + + {children} + ); const ICONS = { - web: <>, + web: <>, phone: , mail: <>, - map: <>, + pin: <>, booking: <>, - trophy: <>, guide: <>, - camera: <>, - webcam: <>, - weather: , - facebook: , - instagram: <> + weather: <> }; export default function FacilityDetailView({ facility }: { facility: any }) { const [showBackToTop, setShowBackToTop] = useState(false); const [currentSlide, setCurrentSlide] = useState(0); - // --- DATA RECOVERY LOGIKK (Fikser krasj fra API-strenger) --- + // --- DATA RECOVERY (LOSBY-FIX) --- const parseJson = (val: any, fallback: any) => { if (!val) return fallback; if (typeof val === 'object') return val; @@ -53,6 +66,7 @@ export default function FacilityDetailView({ facility }: { facility: any }) { const shotzoom = parseJson(facility.shotzoom, []); const linkClass = "text-orange-600 hover:underline transition-colors font-bold"; + const sidebarLinkClass = "flex items-center gap-4 hover:text-orange-600 transition-colors group"; useEffect(() => { if (gallery.length <= 1) return; @@ -77,14 +91,13 @@ export default function FacilityDetailView({ facility }: { facility: any }) { return (
- {/* GALLERI SLIDER */} + {/* HEADER / GALLERI SLIDER */}
{gallery.map((img: string, i: number) => ( ))}
- {/* BANESTATUS BADGES */}
{activeCourses.map((c: any) => ( @@ -94,29 +107,27 @@ export default function FacilityDetailView({ facility }: { facility: any }) { {facility.status_updated_at && Sist oppdatert: {formatDate(facility.status_updated_at)}}
- {/* HURTIGKNAPPER */}
{facility.website_url && } {facility.golfbox_booking_url && } - {facility.golfbox_tournament_url && } - + {facility.weather_url && }
-
- {facility.logo_url &&
} +
+ {facility.logo_url && ( +
Logo
+ )}

{facility.name}

{facility.county} • {facility.city}

- {/* NAVIGASJON */}
); } \ No newline at end of file