Skip to content

Commit

Permalink
Wire toggles to redux.
Browse files Browse the repository at this point in the history
  • Loading branch information
chmac committed Nov 21, 2024
1 parent d51f169 commit 2fc2c03
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions nr-app/src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { setVisiblePlusCodes } from "@/redux/actions/map.actions";
import React, { useState } from "react";
import { Button, Modal, TextInput } from "react-native";
import { getFirstTagValueFromEvent } from "@/common/utils";
import { toggleLayer } from "@/redux/slices/map.slice";

const NoteMarker = ({ event }: { event: EventWithMetadata }) => {
const plusCode = getFirstTagValueFromEvent(event.event, "open-location-code");
Expand Down Expand Up @@ -66,7 +67,6 @@ export default function Map() {
const [modalVisible, setModalVisible] = useState(false);
const [note, setNote] = useState("");
const [selectedCoordinate, setSelectedCoordinate] = useState<LatLng>();
const [isHitchmapEnabled, setIsHitchmapEnabled] = useState(true);

return (
<View style={styles.mapContainer}>
Expand All @@ -90,12 +90,28 @@ export default function Map() {
<NoteMarker event={event} key={event.event.sig} />
))}
</MapView>
<View style={styles.toggleContainer}>
<Text>Hitchmap</Text>
<Switch
value={isHitchmapEnabled}
onValueChange={setIsHitchmapEnabled}
/>
<View>
<View style={styles.toggleContainer}>
<Text>Hitchmap</Text>
<Switch
value={true}
onValueChange={() => void dispatch(toggleLayer("hitchmap"))}
/>
</View>
<View style={styles.toggleContainer}>
<Text>TimeSafari</Text>
<Switch
value={true}
onValueChange={() => void dispatch(toggleLayer("timesafari"))}
/>
</View>
<View style={styles.toggleContainer}>
<Text>TripHopping</Text>
<Switch
value={true}
onValueChange={() => void dispatch(toggleLayer("triphopping"))}
/>
</View>
</View>

<Modal
Expand Down

0 comments on commit 2fc2c03

Please sign in to comment.