Skip to content

Commit

Permalink
Merge pull request #24 from Ferrochrom3/Secondary-Branch
Browse files Browse the repository at this point in the history
Issue 23 solved
  • Loading branch information
invpt authored Mar 31, 2024
2 parents 29dffd2 + 472c38c commit 37c0a71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"uuid": "^9.0.1",
"zod": "^3.22.4"
}
}
}
52 changes: 30 additions & 22 deletions src/pages/project/TourEditorPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ const MainPanel: Component<{ show: boolean, setPanel: Setter<Panel> }> = (props)
<button onClick={() => setCurrentTab("pois")}>POIs</button>
</header>
<Show when={currentTab() === "route"}>
<RouteList
route={() => tour()!.route}
onChange={handleRouteChange}
onEditClick={(id, type) => props.setPanel({ which: type, id })}
/>
<RouteList
route={() => tour()!.route}
onChange={handleRouteChange}
onEditClick={(id, type) => props.setPanel({ which: type, id })}
/>
</Show>
<Show when={currentTab() === "pois"}>
Points of interest are not currently implemented.
Points of interest are not currently implemented.
</Show>
<div style="flex:1"></div>
<button onClick={handleDeleteClick} class="danger" style="margin-top: 32px">Delete Tour</button>
Expand All @@ -254,8 +254,10 @@ const RouteList: Component<{
onEditClick: (id: string, type: "stop" | "control") => void,
}> = (props) => {
const map = useMapController();
const [tour] = useTour();

const addStop = () => {

const newWaypoint: StopModel = {
type: "stop",
id: uuidv4(),
Expand All @@ -271,6 +273,9 @@ const RouteList: Component<{
links: {},
};

if (tour()?.type === "walking") newWaypoint.control = "path"
else newWaypoint.control = "route"

props.onChange([...props.route(), newWaypoint]);
};

Expand All @@ -283,6 +288,9 @@ const RouteList: Component<{
control: "route",
};

if (tour()?.type === "walking") newWaypoint.control = "path"
else newWaypoint.control = "route"

props.onChange([...props.route(), newWaypoint]);
};

Expand Down Expand Up @@ -313,23 +321,23 @@ const RouteList: Component<{
<div class={styles.PointsList}>
<For each={props.route()}>
{(waypoint) => (
<div class={styles.PointCard}>
<div class={styles.PointName}>
{waypoint.type === "stop" ? waypoint.title : "Control Point"}
<div class={styles.PointCard}>
<div class={styles.PointName}>
{waypoint.type === "stop" ? waypoint.title : "Control Point"}
</div>
<button class={styles.PointButton} onClick={() => { handleMove(waypoint.id, "up"); }}>
<FiArrowUp />
</button>
<button class={styles.PointButton} onClick={() => { handleMove(waypoint.id, "down"); }}>
<FiArrowDown />
</button>
<button class={styles.PointButton} onClick={() => { props.onEditClick(waypoint.id, waypoint.type); }}>
<FiEdit />
</button>
<button class={styles.PointButton} onClick={() => { handleDelete(waypoint.id); }}>
<FiTrash />
</button>
</div>
<button class={styles.PointButton} onClick={() => { handleMove(waypoint.id, "up"); }}>
<FiArrowUp />
</button>
<button class={styles.PointButton} onClick={() => { handleMove(waypoint.id, "down"); }}>
<FiArrowDown />
</button>
<button class={styles.PointButton} onClick={() => { props.onEditClick(waypoint.id, waypoint.type); }}>
<FiEdit />
</button>
<button class={styles.PointButton} onClick={() => { handleDelete(waypoint.id); }}>
<FiTrash />
</button>
</div>
)}
</For>
<div class={styles.AddButtons}>
Expand Down

0 comments on commit 37c0a71

Please sign in to comment.