-
setMarkerName(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === 'Enter') handleSaveMarker()
- if (e.key === 'Escape') setPlacingMarker(null)
- }}
- className="block w-full rounded border border-gray-300 px-2 py-1 text-sm placeholder:text-gray-400 focus:outline-none focus:border-gray-500"
+ {markers.map((marker) => (
+
{
+ e.originalEvent.stopPropagation()
+ setSelectedMarkerId(marker.id === selectedMarkerId ? null : marker.id)
+ setPlacingMarker(null)
+ }}
+ >
+ c.id === marker.color)?.hex}
+ active={marker.id === selectedMarkerId}
/>
+
+ ))}
-
- {PIN_COLORS.map((c) => (
+ {selectedMarker && (
+
setSelectedMarkerId(null)}
+ closeOnClick={false}
+ >
+ {selectedMarker.name}
+
+ )}
+
+ {placingMarker && (
+
setPlacingMarker(null)}
+ closeOnClick={false}
+ >
+
+
setMarkerName(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') handleSaveMarker()
+ if (e.key === 'Escape') setPlacingMarker(null)
+ }}
+ className="block w-full rounded border border-gray-300 px-2 py-1 text-sm placeholder:text-gray-400 focus:outline-none focus:border-gray-500"
+ />
+
+
+ {PIN_COLORS.map((c) => (
+
+ ))}
+
+
+
- ))}
-
-
-
-
-
+
+
-
-
- )}
-
+
+ )}
+
diff --git a/admin/inertia/components/maps/ScaleUnitToggle.tsx b/admin/inertia/components/maps/ScaleUnitToggle.tsx
new file mode 100644
index 0000000..ba0bceb
--- /dev/null
+++ b/admin/inertia/components/maps/ScaleUnitToggle.tsx
@@ -0,0 +1,46 @@
+type ScaleUnit = 'imperial' | 'metric'
+
+type ScaleUnitToggleProps = {
+ scaleUnit: ScaleUnit
+ onChange: (unit: ScaleUnit) => void
+ onMouseEnter?: () => void
+}
+
+export default function ScaleUnitToggle({
+ scaleUnit,
+ onChange,
+ onMouseEnter,
+}: ScaleUnitToggleProps) {
+ return (
+
+
+
+
+
+
+
+ )
+}
diff --git a/admin/inertia/pages/maps.tsx b/admin/inertia/pages/maps.tsx
index d8585b1..a1d8df1 100644
--- a/admin/inertia/pages/maps.tsx
+++ b/admin/inertia/pages/maps.tsx
@@ -1,29 +1,34 @@
-import MapsLayout from '~/layouts/MapsLayout'
+import { useState } from 'react'
import { Head, Link, router } from '@inertiajs/react'
+import { IconArrowLeft } from '@tabler/icons-react'
+
+import MapsLayout from '~/layouts/MapsLayout'
import MapComponent from '~/components/maps/MapComponent'
import StyledButton from '~/components/StyledButton'
-import { IconArrowLeft } from '@tabler/icons-react'
-import { FileEntry } from '../../types/files'
import Alert from '~/components/Alert'
-import { useState } from 'react'
+
+import { FileEntry } from '../../types/files'
export default function Maps(props: {
maps: { baseAssetsExist: boolean; regionFiles: FileEntry[] }
}) {
const [isHoveringUI, setIsHoveringUI] = useState(false)
const [showMapCoordinates, setShowMapCoordinates] = useState(true)
+
const alertMessage = !props.maps.baseAssetsExist
? 'The base map assets have not been installed. Please download them first to enable map functionality.'
: props.maps.regionFiles.length === 0
- ? 'No map regions have been downloaded yet. Please download some regions to enable map functionality.'
- : null
+ ? 'No map regions have been downloaded yet. Please download some regions to enable map functionality.'
+ : null
return (
+
- {/* Nav and alerts are overlayed */}
-
setIsHoveringUI(true)}
onMouseLeave={() => setIsHoveringUI(false)}
>
@@ -31,24 +36,28 @@ export default function Maps(props: {
Back to Home
-
-
-
-
- Manage Map Regions
-
-
-
+
+
+
+
+
+ Manage Map Regions
+
+
+
+
+ {/* Alert */}
{alertMessage && (
-
setIsHoveringUI(true)}
onMouseLeave={() => setIsHoveringUI(false)}
>
@@ -66,8 +75,13 @@ export default function Maps(props: {
/>
)}
+
+ {/* Map */}
-
+