Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
changed back -> close on the visit history screen (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
smcmurtry authored May 4, 2021
1 parent dc97dd1 commit 20827a2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/locale/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@
"DeleteIcon": "Delete",
"NoVisit": "No visits yet",
"Back": "Back",
"Close": "Close",
"Alert": {
"Title": "Are you sure you want to delete this visit?",
"TitleDeleteAll": "Are you sure you want to delete all visits?",
Expand Down
1 change: 1 addition & 0 deletions src/locale/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
"DeleteIcon": "Supprimer",
"NoVisit": "Aucune visite",
"Back": "Précédent",
"Close": "Fermer",
"Alert": {
"Title": "Voulez-vous vraiment supprimer cette visite?",
"TitleDeleteAll": "Voulez-vous vraiment supprimer toutes les visites?",
Expand Down
2 changes: 1 addition & 1 deletion src/locale/translations/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/navigation/MainNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface MainStackParamList extends Record<string, object | undefined> {
QROnboard: undefined;
RegionSelectExposedNoPT: {drawerMenu: boolean} | undefined;
RecentExposureScreen: {timestamp: number; exposureType: ExposureType};
CheckInHistoryScreen: {closeRoute: string};
}
const LandingScreenWithNavBar = withDarkNav(LandingScreen);
const HomeScreenWithNavBar = withDarkNav(HomeScreen);
Expand Down
13 changes: 9 additions & 4 deletions src/screens/qr/CheckInHistoryScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, {useCallback} from 'react';
import {StyleSheet, TouchableOpacity, Alert} from 'react-native';
import {useI18n} from 'locale';
import {useNavigation} from '@react-navigation/native';
import {Box, Text, Icon, Button, Toolbar} from 'components';
import {RouteProp, useNavigation, useRoute} from '@react-navigation/native';
import {Box, Text, Icon, Button, ToolbarWithClose} from 'components';
import {CheckInData} from 'shared/qr';
import {formatExposedDate, formateScannedDate, accessibilityReadableDate} from 'shared/date-fns';
import {useOutbreakService} from 'services/OutbreakService/OutbreakProvider';
import {SafeAreaView} from 'react-native-safe-area-context';
import {ScrollView} from 'react-native-gesture-handler';
import {MainStackParamList} from 'navigation/MainNavigator';

import {sortedCheckInArray} from './utils';

Expand Down Expand Up @@ -99,11 +100,15 @@ const NoVisitsScreen = () => {
);
};

type CheckInHistoryScreenProps = RouteProp<MainStackParamList, 'CheckInHistoryScreen'>;

export const CheckInHistoryScreen = () => {
const route = useRoute<CheckInHistoryScreenProps>();
const i18n = useI18n();
const {checkInHistory, deleteAllScannedPlaces} = useOutbreakService();
const navigation = useNavigation();
const back = useCallback(() => navigation.goBack(), [navigation]);
const closeRoute = route.params?.closeRoute ? route.params.closeRoute : 'Menu';
const close = useCallback(() => navigation.navigate(closeRoute), [closeRoute, navigation]);

const deleteAllPlaces = () => {
Alert.alert(i18n.translate('PlacesLog.Alert.TitleDeleteAll'), i18n.translate('PlacesLog.Alert.Subtitle'), [
Expand All @@ -124,7 +129,7 @@ export const CheckInHistoryScreen = () => {
return (
<Box flex={1} backgroundColor="overlayBackground">
<SafeAreaView style={styles.flex}>
<Toolbar title="" navIcon="icon-back-arrow" navText={i18n.translate('PlacesLog.Back')} onIconClicked={back} />
<ToolbarWithClose closeText={i18n.translate('PlacesLog.Close')} onClose={close} showBackButton={false} />
<ScrollView style={styles.flex}>
<Box paddingHorizontal="m">
<Text variant="bodyTitle" marginBottom="l" accessibilityRole="header" accessibilityAutoFocus>
Expand Down
4 changes: 3 additions & 1 deletion src/screens/qr/CheckInSuccessfulScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const CheckInSuccessfulScreen = ({route}: CheckInSuccessfulRoute) => {
const i18n = useI18n();
const navigation = useNavigation();
const navigateHome = useCallback(() => navigation.navigate('Home'), [navigation]);
const navigateYourVisits = useCallback(() => navigation.navigate('CheckInHistoryScreen'), [navigation]);
const navigateYourVisits = useCallback(() => navigation.navigate('CheckInHistoryScreen', {closeRoute: 'Home'}), [
navigation,
]);
const dateLocale = i18n.locale === 'fr' ? 'fr-CA' : 'en-CA';
const readableDate = accessibilityReadableDate(new Date(timestamp));
const scannedTime = getScannedTime(new Date(timestamp), dateLocale);
Expand Down

0 comments on commit 20827a2

Please sign in to comment.