Skip to content

Commit

Permalink
fix: revert url fallback in navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Aug 30, 2024
1 parent f919f87 commit eddf8bd
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/popups/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,15 @@ export function Navigation({ lat, lon, size = 'large' }) {
const nav = useStorage((s) => s.settings.navigation)
const url = useMemory((s) => s.settings.navigation[nav]?.url)

React.useEffect(() => {
const navOptions = useMemory.getState().settings.navigation
if (!url || !(nav in navOptions)) {
useStorage.setState((prev) => ({
settings: {
...prev.settings,
navigation: Object.keys(navOptions)[0],
},
}))
}
}, [url])

return (
<IconButton
href={url
.replace(/\{x\}/g, lat.toString())
?.replace(/\{x\}/g, lat.toString())
.replace(/\{y\}/g, lon.toString())}
target="_blank"
rel="noreferrer"
size={size}
disabled={!url}
style={{ color: 'inherit' }}
>
<Map />
Expand Down

0 comments on commit eddf8bd

Please sign in to comment.