From 72194b27a638d04cafca9dc0571e5873126bb3f4 Mon Sep 17 00:00:00 2001 From: Biswa Kalyan Bhuyan Date: Sat, 26 Apr 2025 17:33:41 +0530 Subject: fix: updated the sharing errors --- app/src/app/map/page.tsx | 10 ++++++++-- app/src/app/share/page.tsx | 15 +++++++++++++-- app/src/app/track/page.tsx | 16 ++++++++++++++-- app/src/app/view/page.tsx | 15 +++++++++++++-- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/app/src/app/map/page.tsx b/app/src/app/map/page.tsx index c0f23ac..3ca8a7e 100644 --- a/app/src/app/map/page.tsx +++ b/app/src/app/map/page.tsx @@ -7,11 +7,17 @@ import { Card, CardContent } from "@/components/ui/card"; import { toast } from "sonner"; import Link from "next/link"; import ShareLocationForm from "@/components/ShareLocationForm"; +import { Loader2 } from "lucide-react"; -// Dynamically import the Map component to avoid SSR issues with Leaflet +// Dynamically import the Map component with SSR disabled const MapWithNoSSR = dynamic(() => import("@/components/Map"), { ssr: false, - loading: () =>
Loading map...
, + loading: () => ( +
+ + Loading map... +
+ ), }); interface Location { diff --git a/app/src/app/share/page.tsx b/app/src/app/share/page.tsx index 60cac27..7776ed2 100644 --- a/app/src/app/share/page.tsx +++ b/app/src/app/share/page.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react"; import { useRouter, useSearchParams } from "next/navigation"; -import Map from "@/components/Map"; +import dynamic from "next/dynamic"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Loader2, Copy, Mail, Share2 } from "lucide-react"; @@ -18,6 +18,17 @@ interface LocationType { timestamp: Date; } +// Dynamically import the Map component with SSR disabled +const MapWithNoSSR = dynamic(() => import("@/components/Map"), { + ssr: false, + loading: () => ( +
+ + Loading map... +
+ ), +}); + export default function ShareLocation() { const [location, setLocation] = useState(null); const [email, setEmail] = useState(""); @@ -140,7 +151,7 @@ export default function ShareLocation() { - diff --git a/app/src/app/track/page.tsx b/app/src/app/track/page.tsx index 060d391..c8045d2 100644 --- a/app/src/app/track/page.tsx +++ b/app/src/app/track/page.tsx @@ -2,10 +2,22 @@ import { useState, useEffect } from "react"; import { useSocket } from "@/hooks/useSocket"; -import Map from "@/components/Map"; +import dynamic from "next/dynamic"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { toast } from "sonner"; +import { Loader2 } from "lucide-react"; + +// Dynamically import the Map component with SSR disabled +const MapWithNoSSR = dynamic(() => import("@/components/Map"), { + ssr: false, + loading: () => ( +
+ + Loading map... +
+ ), +}); export default function TrackPage() { const [userId, setUserId] = useState(""); @@ -73,7 +85,7 @@ export default function TrackPage() {
- diff --git a/app/src/app/view/page.tsx b/app/src/app/view/page.tsx index 9786e4a..f75333b 100644 --- a/app/src/app/view/page.tsx +++ b/app/src/app/view/page.tsx @@ -2,12 +2,23 @@ import { useState, useEffect } from "react"; import { useSearchParams } from "next/navigation"; -import Map from "@/components/Map"; +import dynamic from "next/dynamic"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Loader2, AlertTriangle, MapPin } from "lucide-react"; import { useSocket } from "@/hooks/useSocket"; +// Dynamically import the Map component with SSR disabled +const MapWithNoSSR = dynamic(() => import("@/components/Map"), { + ssr: false, + loading: () => ( +
+ + Loading map... +
+ ), +}); + export default function ViewLocation() { const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); @@ -77,7 +88,7 @@ export default function ViewLocation() {
- +
-- cgit v1.2.3-59-g8ed1b