diff --git a/app/listings/page.tsx b/app/listings/page.tsx index 8f11a07..c556ed2 100644 --- a/app/listings/page.tsx +++ b/app/listings/page.tsx @@ -1,7 +1,6 @@ 'use client'; import Link from 'next/link'; -import dynamic from 'next/dynamic'; import { useEffect, useMemo, useRef, useState } from 'react'; import { useI18n } from '../components/I18nProvider'; @@ -48,10 +47,23 @@ function haversineKm(a: LatLng, b: LatLng) { return 2 * R * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h)); } -const LeafletWrapper = dynamic(async () => { - const L = await import('leaflet'); - return L; -}, { ssr: false }); +type LeafletLib = typeof import('leaflet'); + +async function loadLeaflet(): Promise { + if (typeof window === 'undefined') return Promise.reject(new Error('No window')); + if ((window as any).L) return (window as any).L as LeafletLib; + const linkId = 'leaflet-css'; + if (!document.getElementById(linkId)) { + const link = document.createElement('link'); + link.id = linkId; + link.rel = 'stylesheet'; + link.href = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css'; + document.head.appendChild(link); + } + const mod: LeafletLib = await import('leaflet'); + (window as any).L = mod; + return mod; +} function ListingsMap({ listings, @@ -74,7 +86,7 @@ function ListingsMap({ useEffect(() => { let cancelled = false; - LeafletWrapper + loadLeaflet() .then((L) => { if (cancelled) return; setReady(true); diff --git a/app/page.tsx b/app/page.tsx index 6b78bd6..7b8e950 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -37,6 +37,7 @@ export default function HomePage() { const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'; const apiBase = process.env.NEXT_PUBLIC_API_BASE || 'http://localhost:3000/api'; const appEnv = process.env.APP_ENV || 'local'; + const appVersion = process.env.NEXT_PUBLIC_VERSION || 'dev'; const [latest, setLatest] = useState([]); const [activeIndex, setActiveIndex] = useState(0); const [loadingLatest, setLoadingLatest] = useState(false); @@ -108,6 +109,9 @@ export default function HomePage() { {t('runtimeApiBase')} {apiBase} + + Version {appVersion} + diff --git a/k8s/app.yaml b/k8s/app.yaml index c967cf0..b1cec7f 100644 --- a/k8s/app.yaml +++ b/k8s/app.yaml @@ -7,6 +7,7 @@ data: NEXT_PUBLIC_SITE_URL: ${NEXT_PUBLIC_SITE_URL} NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE} APP_ENV: ${APP_ENV} + NEXT_PUBLIC_VERSION: ${APP_VERSION} --- apiVersion: apps/v1 kind: Deployment