Skip to content

Commit

Permalink
fix OverallTripDescriptives not showing for multimodal unlabeled trips
Browse files Browse the repository at this point in the history
The initial state of modesShown should be 'labeled' only if the trip has a label; otherwise it should be 'detected' (since there will be no toggling)
With the initial state being 'detected', if there are multiple modes then the OverallTripDescriptives will show
  • Loading branch information
JGreenlee committed Feb 13, 2024
1 parent 8101388 commit 8047221
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion www/js/diary/details/LabelDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const LabelScreenDetails = ({ route, navigation }) => {
const { displayDate, displayStartTime, displayEndTime } = useDerivedProperties(trip);
const [tripStartDisplayName, tripEndDisplayName] = useAddressNames(trip);

const [modesShown, setModesShown] = useState<'labeled' | 'detected'>('labeled');
const [modesShown, setModesShown] = useState<'labeled' | 'detected'>(() =>
// if trip has a labeled mode, initial state shows that; otherwise, show detected modes
trip && labelFor(trip, 'MODE')?.value ? 'labeled' : 'detected',
);
const tripGeojson =
trip &&
labelOptions &&
Expand Down

0 comments on commit 8047221

Please sign in to comment.