Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Sep 18, 2023
1 parent 8df6b8b commit bdf5716
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions web/src/pages/[gameId]/travel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ export default function Travel() {
locationPrices.get(currentLocationId),
);
const targetMarkets = sortDrugMarkets(locationPrices.get(targetId));
return targetMarkets.map((drug, index) => {
return {
id: drug.id,
price: drug.price,
targetDiff: drug.price - currentMarkets[index].price,
};
});

return targetMarkets.map((drug, index) => ({
id: drug.id,
price: drug.price,
targetDiff: drug.price - currentMarkets[index].price,
}));
}

return [];
Expand Down Expand Up @@ -112,18 +111,16 @@ export default function Travel() {
if (targetId) {
setIsSubmitting(true);
const { event, hash } = await travel(gameId, targetId);

if (event) {
router.push(`/${gameId}/event/decision?nextId=${targetId}`);
} else {
toast(
`You've traveled to ${getLocationById(targetId)?.name}`,
Car,
`http://amazing_explorer/${hash}`,
);

router.push(`/${gameId}/turn`);
return router.push(`/${gameId}/event/decision?nextId=${targetId}`);
}

toast(
`You've traveled to ${getLocationById(targetId)?.name}`,
Car,
`http://amazing_explorer/${hash}`,
);
router.push(`/${gameId}/turn`);
}
}, [targetId, router, gameId, travel, toast]);

Expand All @@ -136,7 +133,7 @@ export default function Travel() {
prefixTitle: "Select Your",
map: (
<Map
target={getLocationById(targetId)?.type}
highlight={getLocationById(targetId)?.type}
onSelect={(selected) => {
setTargetId(getLocationByType(selected)!.id);
}}
Expand Down

0 comments on commit bdf5716

Please sign in to comment.