|
3 | 3 | import { MapIcon } from 'lucide-react' |
4 | 4 | import dynamic from 'next/dynamic' |
5 | 5 | import Link from 'next/link' |
| 6 | +import { toast } from 'sonner' |
6 | 7 | import { Area } from '@/lib/const' |
7 | 8 | import { useMapDashboard } from './hooks/useDashboard' |
8 | 9 | import { useIslands } from './hooks/useIslands' |
@@ -33,38 +34,57 @@ export default function IslandMarkers() { |
33 | 34 | position={[island.latitude, island.longitude]} |
34 | 35 | title={island.name} |
35 | 36 | > |
36 | | - <div className="flex flex-col gap-2"> |
37 | | - <b className="font-bold block">{island.name}</b> |
| 37 | + <div className="flex flex-col"> |
| 38 | + <span className="font-bold block text-sm">{island.name}</span> |
| 39 | + <span className="text-sm">{island.code}</span> |
38 | 40 |
|
39 | | - <span className="text-xs text-gray-500 block"> |
40 | | - {island.coordinate} |
41 | | - </span> |
42 | | - |
43 | | - <Link |
44 | | - href={`https://www.google.com/maps/search/${island.coordinate}`} |
45 | | - passHref |
46 | | - target="_blank" |
47 | | - rel="noopener noreferrer" |
48 | | - className="text-xs inline-flex items-center gap-2" |
| 41 | + <button |
| 42 | + type="button" |
| 43 | + onClick={() => { |
| 44 | + try { |
| 45 | + navigator.clipboard.writeText(island.coordinate) |
| 46 | + toast.success('Coordinate copied to clipboard', { |
| 47 | + duration: 3_000, // 3 seconds |
| 48 | + }) |
| 49 | + } catch (_error) { |
| 50 | + toast.error('Failed to copy coordinate to clipboard', { |
| 51 | + closeButton: true, |
| 52 | + }) |
| 53 | + } |
| 54 | + }} |
| 55 | + className="mt-1 flex flex-col items-start gap-0" |
| 56 | + title="Copy Coordinate" |
49 | 57 | > |
50 | | - <MapIcon className="size-4" /> |
51 | | - See on Google Maps |
52 | | - </Link> |
| 58 | + <span className="text-xs text-gray-500 block">Coordinate :</span> |
| 59 | + <br /> |
| 60 | + <span className="text-xs">{island.coordinate}</span> |
| 61 | + </button> |
53 | 62 |
|
54 | 63 | {(island.isPopulated || island.isOutermostSmall) && ( |
55 | | - <div className="flex gap-1 mt-1"> |
| 64 | + <div className="flex gap-1 mt-2"> |
56 | 65 | {island.isPopulated && ( |
57 | | - <span className="bg-green-500 text-popover font-semibold rounded-full px-2 py-1"> |
| 66 | + <span className="bg-green-500 text-xs text-popover font-semibold rounded px-2 py-0.5"> |
58 | 67 | Populated |
59 | 68 | </span> |
60 | 69 | )} |
61 | 70 | {island.isOutermostSmall && ( |
62 | | - <span className="bg-red-500 text-popover font-semibold rounded-full px-2 py-1"> |
| 71 | + <span className="bg-red-500 text-xs text-popover font-semibold rounded px-2 py-0.5"> |
63 | 72 | Outermost Small Island |
64 | 73 | </span> |
65 | 74 | )} |
66 | 75 | </div> |
67 | 76 | )} |
| 77 | + |
| 78 | + <Link |
| 79 | + href={`https://www.google.com/maps/search/${island.coordinate}`} |
| 80 | + passHref |
| 81 | + target="_blank" |
| 82 | + rel="noopener noreferrer" |
| 83 | + className="text-xs inline-flex items-center gap-2 mt-4" |
| 84 | + > |
| 85 | + <MapIcon className="size-4" /> |
| 86 | + See on Google Maps |
| 87 | + </Link> |
68 | 88 | </div> |
69 | 89 | </MapMarker> |
70 | 90 | ))} |
|
0 commit comments