merged in map markers in tree and renamed the ScaleUnitToggle to ScaleUnitSelector

This commit is contained in:
Kenneth Brewer 2026-05-06 01:59:34 -04:00
parent 654843f542
commit 3b068eceb0
3 changed files with 15 additions and 34 deletions

View File

@ -19,7 +19,7 @@ import MarkerPanel from './MarkerPanel'
import CoordinateOverlay from './CoordinateOverlay'
import ViewMapMarkerPopup from './ViewMapMarkerPopup'
import MapMarkerFormPopup from './MapMarkerFormPopup'
import ScaleUnitToggle from './ScaleUnitToggle'
import ScaleUnitToggle from './ScaleUnitSelector'
type ScaleUnit = 'imperial' | 'metric'

View File

@ -1,16 +1,22 @@
type ScaleUnit = 'imperial' | 'metric'
type ScaleUnitToggleProps = {
type ScaleUnitSelectorProps = {
scaleUnit: ScaleUnit
onChange: (unit: ScaleUnit) => void
onMouseEnter?: () => void
}
export default function ScaleUnitToggle({
scaleUnit,
onChange,
onMouseEnter,
}: ScaleUnitToggleProps) {
export default function ScaleUnitSelector({
scaleUnit,
onChange,
onMouseEnter,
}: ScaleUnitSelectorProps) {
const getButtonStyle = (unit: ScaleUnit) => ({
background: scaleUnit === unit ? '#424420' : 'white',
color: scaleUnit === unit ? 'white' : '#666',
cursor: 'pointer',
})
return (
<div className="absolute bottom-[30px] left-[10px] z-[2]" onMouseEnter={onMouseEnter}>
<div className="inline-flex overflow-hidden rounded text-[11px] font-semibold leading-none shadow-[0_0_0_2px_rgba(0,0,0,0.1)]">
@ -20,11 +26,7 @@ export default function ScaleUnitToggle({
if (scaleUnit !== 'metric') onChange('metric')
}}
className="border-0 px-2 py-1"
style={{
background: scaleUnit === 'metric' ? '#424420' : 'white',
color: scaleUnit === 'metric' ? 'white' : '#666',
cursor: 'pointer',
}}
style={getButtonStyle('metric')}
>
Metric
</button>
@ -35,11 +37,7 @@ export default function ScaleUnitToggle({
if (scaleUnit !== 'imperial') onChange('imperial')
}}
className="border-0 px-2 py-1"
style={{
background: scaleUnit === 'imperial' ? '#424420' : 'white',
color: scaleUnit === 'imperial' ? 'white' : '#666',
cursor: 'pointer',
}}
style={getButtonStyle('imperial')}
>
Imperial
</button>

View File

@ -19,7 +19,6 @@ export default function Maps(props: {
maps: { baseAssetsExist: boolean; regionFiles: FileEntry[] }
}) {
const [isHoveringUI, setIsHoveringUI] = useState(false)
const [showMapCoordinates, setShowMapCoordinates] = useState(true)
const [coordinateSearch, setCoordinateSearch] = useState('')
const [mapCommand, setMapCommand] = useState<MapCommand | null>(null)
@ -77,22 +76,6 @@ export default function Maps(props: {
<p className="text-lg text-text-secondary">Back to Home</p>
</Link>
<div className="flex items-center gap-3 mr-4">
<button
type="button"
onClick={() => setShowMapCoordinates((prev) => !prev)}
className="rounded px-3 py-2 text-sm bg-surface-primary text-text-secondary hover:opacity-80 transition"
>
{showMapCoordinates ? 'Hide Coordinates' : 'Show Coordinates'}
</button>
<Link href="/settings/maps">
<StyledButton variant="primary" icon="IconSettings">
Manage Map Regions
</StyledButton>
</Link>
</div>
<div className="flex items-center gap-2">
<input
type="text"