= ({ sheetRef }) => {
+ const snapPoints = ['25%', '45%', '85%'];
+ const [snap, _] = useState(1);
- const snapPoints = ['25%', '45%', '85%'];
- const [snap, _] = useState(1)
+ const theme = useAppStore((state) => state.theme);
+ const selectedRoutePlan = useAppStore((state) => state.selectedRoutePlan);
+ const setSelectedRoutePlan = useAppStore(
+ (state) => state.setSelectedRoutePlan,
+ );
+ const setSheetCloseCallback = useAppStore(
+ (state) => state.setSheetCloseCallback,
+ );
+ const setSelectedRoutePlanPathPart = useAppStore(
+ (state) => state.setSelectedRoutePlanPathPart,
+ );
+ const selectedRoutePlanPathPart = useAppStore(
+ (state) => state.selectedRoutePlanPathPart,
+ );
+ const dismissSheet = useAppStore((state) => state.dismissSheet);
- const theme = useAppStore((state) => state.theme);
- const selectedRoutePlan = useAppStore((state) => state.selectedRoutePlan);
- const setSelectedRoutePlan = useAppStore((state) => state.setSelectedRoutePlan);
- const setSheetCloseCallback = useAppStore((state) => state.setSheetCloseCallback);
- const setSelectedRoutePlanPathPart = useAppStore((state) => state.setSelectedRoutePlanPathPart);
- const selectedRoutePlanPathPart = useAppStore((state) => state.selectedRoutePlanPathPart);
- const dismissSheet = useAppStore((state) => state.dismissSheet);
+ const htmlStyles = {
+ titleBase: {
+ color: theme.text,
+ fontSize: 16,
+ paddingLeft: 6,
+ paddingTop: 2,
+ },
+ titleClassStyle: {
+ location_label: { fontSize: 16, fontWeight: 'bold' },
+ 'stop-code': { fontSize: 16, color: theme.subtitle },
+ },
+ titleTagStyles: {
+ div: { fontSize: 16 },
+ },
+ descriptionBase: {
+ color: theme.text,
+ fontSize: 14,
+ },
+ descriptionTagStyles: {
+ p: { marginTop: 0 },
+ },
+ };
- const htmlStyles = {
- titleBase: {
- color: theme.text,
- fontSize: 16,
- paddingLeft: 6,
- paddingTop: 2
- },
- titleClassStyle: {
- "location_label": { fontSize: 16, fontWeight: "bold" },
- "stop-code": { fontSize: 16, color: theme.subtitle },
- },
- titleTagStyles: {
- div: {fontSize: 16}
- },
- descriptionBase: {
- color: theme.text,
- fontSize: 14,
- },
- descriptionTagStyles: {
- p: { marginTop: 0}
- }
-
- }
+ useEffect(() => {
+ setSelectedRoutePlanPathPart(-1);
- useEffect(() => {
- setSelectedRoutePlanPathPart(-1)
+ setSheetCloseCallback(() => {
+ setSelectedRoutePlanPathPart(-1);
+ setSelectedRoutePlan(null);
+ }, 'tripPlanDetail');
+ }, []);
- setSheetCloseCallback(() => {
- setSelectedRoutePlanPathPart(-1)
- setSelectedRoutePlan(null)
- }, "tripPlanDetail")
- }, [])
+ function processRoutePlan(plan: IOptionDetail) {
+ if (!plan) return [];
- function processRoutePlan(plan: IOptionDetail) {
- if (!plan) return []
-
- return plan.instructions?.map((instruction, index) => {
- var icon;
- switch (instruction.className) {
- case "bus":
- icon = }/>
- break;
- case "walking":
- icon = }/>
- break;
- case "end":
- icon = }/>
- break;
- case "waiting":
- icon = }/>
- break;
- default:
- icon = }/>
- }
+ return plan.instructions?.map((instruction, index) => {
+ let icon;
+ switch (instruction.className) {
+ case 'bus':
+ icon = (
+ }
+ />
+ );
+ break;
+ case 'walking':
+ icon = (
+
+ }
+ />
+ );
+ break;
+ case 'end':
+ icon = (
+
+ }
+ />
+ );
+ break;
+ case 'waiting':
+ icon = (
+
+ }
+ />
+ );
+ break;
+ default:
+ icon = (
+
+ }
+ />
+ );
+ }
- return {
- time: instruction.startTime,
- title: instruction.instruction?.replace("(ID:", " (ID:"),
- description: instruction.walkingInstructions.map((step: IWalkingInstruction) => {
- return `${step.index}. ${step.instruction}
`
- }).join(''),
- icon: icon,
- index: index
- }
- })
- }
+ return {
+ time: instruction.startTime,
+ title: instruction.instruction?.replace('(ID:', ' (ID:'),
+ description: instruction.walkingInstructions
+ .map((step: IWalkingInstruction) => {
+ return `${step.index}. ${step.instruction}
`;
+ })
+ .join(''),
+ icon: icon,
+ index: index,
+ };
+ });
+ }
- useEffect(() => {
- if (selectedRoutePlanPathPart === -1) return;
- sheetRef.current?.snapToIndex(1)
- }, [selectedRoutePlanPathPart])
+ useEffect(() => {
+ if (selectedRoutePlanPathPart === -1) return;
+ sheetRef.current?.snapToIndex(1);
+ }, [selectedRoutePlanPathPart]);
+ return (
+
+
+ {/* header */}
+ setSelectedRoutePlanPathPart(-1)}
+ icon={
+ dismissSheet('tripPlanDetail')}
+ >
+
+
+ }
+ />
- return (
-
+
+
+ {
+ // @ts-ignore: e is not actually an Event,
+ if (e.index === selectedRoutePlanPathPart) {
+ setSelectedRoutePlanPathPart(-1);
+ } else {
+ // @ts-ignore: e is not actually an Event,
+ setSelectedRoutePlanPathPart(e.index);
+ }
+ }}
+ renderDetail={(data) => (
+
+ )}
+ innerCircle={'icon'}
+ data={processRoutePlan(selectedRoutePlan!)}
+ />
+
-
- {/* header */}
- setSelectedRoutePlanPathPart(-1)}
- icon={
- dismissSheet("tripPlanDetail")}>
-
-
- }
- />
-
-
-
-
- {
- // @ts-ignore: e is not actually an Event,
- if (e.index === selectedRoutePlanPathPart) {
- setSelectedRoutePlanPathPart(-1)
- } else {
- // @ts-ignore: e is not actually an Event,
- setSelectedRoutePlanPathPart(e.index)
- }
- }}
- renderDetail={(data) => ()}
- innerCircle={'icon'}
- data={processRoutePlan(selectedRoutePlan!)}
- />
- Route Directions Provided by Google
-
-
- )
-}
+ Route Directions Provided by Google
+
+
+