From 0e6752e0107e3e3b2482be6429b8381b686feaa4 Mon Sep 17 00:00:00 2001 From: Erol Date: Sun, 12 Apr 2026 14:55:09 +0200 Subject: [PATCH] Siste finjustering frontend --- frontend/src/app/FacilitySearch.tsx | 109 ++++++++++-------- .../app/golfbaner/[slug]/CourseDisplay.tsx | 44 +++---- 2 files changed, 85 insertions(+), 68 deletions(-) diff --git a/frontend/src/app/FacilitySearch.tsx b/frontend/src/app/FacilitySearch.tsx index eff79cc..26e4401 100755 --- a/frontend/src/app/FacilitySearch.tsx +++ b/frontend/src/app/FacilitySearch.tsx @@ -17,6 +17,7 @@ type Facility = { id: number; slug: string; name: string; + description?: string | null; city?: string | null; county?: string | null; banetype?: string | null; @@ -212,6 +213,13 @@ const buildMapUrl = (lat?: number | null, lng?: number | null) => { return `https://www.google.com/maps/search/?api=1&query=${lat},${lng}`; }; +const toPlainText = (value: string | null | undefined) => + String(value || "") + .replace(/<[^>]+>/g, " ") + .replace(/ /gi, " ") + .replace(/\s+/g, " ") + .trim(); + const getAreaLabel = (value: string, countyOptions: Array<{ slug: string; label: string }>) => { if (!value) return "Hele Norge"; const builtIn = HIERARCHICAL_AREA_OPTIONS.find((option) => option.value === value); @@ -256,7 +264,7 @@ const noteClampStyle: CSSProperties = { }; const actionIconClassName = - "flex h-10 w-10 items-center justify-center rounded-[0.95rem] border border-[#D5DDD1] bg-white text-[#112015] transition hover:border-[#FF5722] hover:text-[#FF5722]"; + "flex h-7 w-7 items-center justify-center rounded-[0.8rem] border border-[#D5DDD1] bg-white text-[#112015] transition hover:border-[#FF5722] hover:text-[#FF5722]"; export default function FacilitySearch({ initialFacilities, @@ -580,26 +588,36 @@ export default function FacilitySearch({ />
-
- - {getStatusLabel(facility.primaryStatus)} - - {facility.hasGolfamore && ( - - Golfamore +
+
+ + {getStatusLabel(facility.primaryStatus)} - )} - {facility.hasNSG && ( - - NSG - - )} + {facility.hasGolfamore && ( + + Golfamore + + )} + {facility.hasNSG && ( + + NSG + + )} +
+ {facility.status_updated_at && ( +
+ + {formatUpdatedDate(facility.status_updated_at)} + +
+ )} +

{facility.city} • {facility.county} @@ -611,26 +629,20 @@ export default function FacilitySearch({

-
- - {facility.holeValue || "--"} hull - - - {facility.banetype || "Banetype ukjent"} - -
- -
- - Oppdatert {formatUpdatedDate(facility.status_updated_at)} - - - {sortMethod === "dist" && Number.isFinite(facility.distance) - ? `${Math.round(facility.distance)} km unna` - : sortMethod === "updated" - ? "Nyeste status" - : "Alfabetisk"} - +
+
+ + {facility.holeValue || "--"} hull + + + {facility.banetype || "Banetype ukjent"} + +
+ {Number.isFinite(facility.distance) && ( + + {Math.round(facility.distance)} km unna + + )}
{facility.footnote && ( @@ -644,7 +656,15 @@ export default function FacilitySearch({
)} -
+ {toPlainText(facility.description) && ( +

+ {toPlainText(facility.description)} +

+ )} + +
+ {facility.phone ? facility.phone : facility.city || "Se detaljer"} + - -
- {facility.phone ? facility.phone : facility.city || "Se detaljer"} - - Se anlegg → +
+ + Se anlegg
@@ -690,7 +707,7 @@ export default function FacilitySearch({ function ActionIcon({ type }: { type: "web" | "booking" | "trophy" | "pin" | "weather" }) { return ( +
{/* HEADER / KALKULATOR */} -
-
-

{course.name}

-

- Par {course.par} • {course.length_meters || '--'} meter -

-

- Rating utløper: {slopeExpiry} -

-
+
+
+

{course.name}

+

+ Par {course.par} • {course.length_meters || '--'} meter +

+

+ Rating utløper: {slopeExpiry} +

+
-
-
Kjønn - { setGender(e.target.value as any); setSelectedTeeIndex(0); }} className="w-full min-w-0 truncate border-b-2 border-[#7ca982]/30 bg-transparent pb-1 pr-6 text-[#11280f] font-black outline-none cursor-pointer"> +
-
Utslag - setSelectedTeeIndex(Number(e.target.value))} className="w-full min-w-0 truncate border-b-2 border-[#7ca982]/30 bg-transparent pb-1 pr-6 text-[#11280f] font-black outline-none cursor-pointer"> + {availableTees.map((t: any, i: number) => ())}
-
Ditt HCP - setHcp(e.target.value)} className="w-12 bg-transparent text-[#11280f] font-black text-center border-b-2 border-[#7ca982]/30" /> +
Ditt HCP + setHcp(e.target.value)} className="w-full min-w-0 border-b-2 border-[#7ca982]/30 bg-transparent px-1 text-left font-black text-[#11280f] outline-none md:w-16 md:text-center" />
-
-

SpH

+
+

SpH

{playingHandicap || 0}