diff --git a/src/App.tsx b/src/App.tsx index 846eb20..3d94d1f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -39,6 +39,8 @@ const App: React.FC = () => { setLanes, surface, setSurface, + smoothness, + setSmoothness, laneMarkings, setLaneMarkings, lanesForward, @@ -86,6 +88,7 @@ const App: React.FC = () => { const addDetailTags = useCallback(() => { return { surface: surface, + ...(smoothness ? { smoothness } : {}), ...(lanes ? { lanes: lanes } : {}), ...(!laneMarkings ? { lane_markings: "no" } : {}), ...(lanesForward ? { "lanes:forward": lanesForward.toString() } : {}), @@ -103,6 +106,7 @@ const App: React.FC = () => { lanesBackward, lanesForward, surface, + smoothness, ]); // Get search parameters from URL @@ -261,6 +265,12 @@ const App: React.FC = () => { setSurface(""); } + if (currentWayTags.smoothness) { + setSmoothness(currentWayTags.smoothness); + } else { + setSmoothness(""); + } + // Set lanes if it exists if (currentWayTags.lanes) { setLanes(currentWayTags.lanes); @@ -296,6 +306,7 @@ const App: React.FC = () => { setLanesBackward, setLanesForward, setLaneMarkings, + setSmoothness, ]); const handleEnd = useCallback(() => { @@ -332,6 +343,7 @@ const App: React.FC = () => { console.log("Skipped way", overpassWays[currentWay].id); setLanes(""); setSurface(""); + setSmoothness(""); handleEnd(); }, fix: (message: string) => { @@ -374,6 +386,7 @@ const App: React.FC = () => { [ setLanes, setSurface, + setSmoothness, handleEnd, overpassWays, currentWay, diff --git a/src/components/LeftPane.tsx b/src/components/LeftPane.tsx index 86c92d6..c630332 100644 --- a/src/components/LeftPane.tsx +++ b/src/components/LeftPane.tsx @@ -12,6 +12,7 @@ import { Spinner } from "@heroui/spinner"; import RelationHeading from "./RelationHeading"; import WayHeading from "./WayHeading"; import SurfaceButtons from "./SurfaceButtons"; +import SmoothnessButtons from "./SmoothnessButtons"; import LanesButtons from "./LanesButtons"; import QuickTags from "./QuickTags"; import NoRelationPlaceholder from "./NoRelationPlaceholder"; @@ -179,6 +180,7 @@ const LeftPane: React.FC = ({
+ { + const { smoothness, setSmoothness } = useWayTagsStore(); + + return ( +
+ + + {SMOOTHNESS_OPTIONS.map((smoothnessKey) => + toggleButton(smoothnessKey === smoothness, smoothnessKey, () => + setSmoothness(smoothnessKey), + ), + )} + +
+ ); +}; + +export default SmoothnessButtons; diff --git a/src/objects.ts b/src/objects.ts index ddd971c..dbc84bc 100644 --- a/src/objects.ts +++ b/src/objects.ts @@ -18,6 +18,7 @@ export interface Tags { ref?: string; lanes?: string; surface?: string; + smoothness?: string; oneway?: string; "lanes:forward"?: string; "lanes:backward"?: string; diff --git a/src/stores/useWayTagsStore.ts b/src/stores/useWayTagsStore.ts index 7cd9bb9..7cbefb1 100644 --- a/src/stores/useWayTagsStore.ts +++ b/src/stores/useWayTagsStore.ts @@ -5,6 +5,10 @@ interface WayTagsState { surface: string; setSurface: (surface: string) => void; + // Smoothness state + smoothness: string; + setSmoothness: (smoothness: string) => void; + // Lanes state lanes: string; setLanes: (lanes: string) => void; @@ -31,6 +35,8 @@ export const useWayTagsStore = create((set) => ({ // Surface surface: "", setSurface: (surface) => set({ surface }), + smoothness: "", + setSmoothness: (smoothness) => set({ smoothness }), laneMarkings: true, setLaneMarkings: (hasMarkings) => set({ laneMarkings: hasMarkings }), @@ -54,6 +60,7 @@ export const useWayTagsStore = create((set) => ({ resetTags: () => set({ surface: "", + smoothness: "", lanes: "", laneMarkings: true, showLaneDirection: false,