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

Commit

Permalink
Merge pull request #808 from cds-snc/issue/802/0-days-left
Browse files Browse the repository at this point in the history
Remove the "0 days left" text that is shown after the 14 day upload cycle is finished
  • Loading branch information
smcmurtry authored Jul 21, 2020
2 parents 79c3ec3 + 7d63910 commit 35b4954
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
24 changes: 14 additions & 10 deletions src/screens/home/views/DiagnosedView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ export const DiagnosedView = ({isBottomSheetExpanded}: {isBottomSheetExpanded: b
{i18n.translate('Home.DiagnosedView.Title')}
{/* No exposure detected */}
</Text>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate(pluralizeKey('Home.DiagnosedView.Body1', daysLeft), {number: daysLeft})}
</Text>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate('Home.DiagnosedView.Body2')}
</Text>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate('Home.DiagnosedView.Body3')}
</Text>
{region === 'ON' ? <Tip /> : null}
{daysLeft < 1 ? null : (
<>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate(pluralizeKey('Home.DiagnosedView.Body1', daysLeft), {number: daysLeft})}
</Text>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate('Home.DiagnosedView.Body2')}
</Text>
<Text variant="bodyText" color="bodyText" marginBottom="l">
{i18n.translate('Home.DiagnosedView.Body3')}
</Text>
{region === 'ON' ? <Tip /> : null}
</>
)}
</BaseHomeView>
);
};
14 changes: 9 additions & 5 deletions src/screens/home/views/OverlayView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useStartExposureNotificationService,
} from 'services/ExposureNotificationService';
import {useNavigation} from '@react-navigation/native';
import {daysBetween} from 'shared/date-fns';
import {daysBetween, getCurrentDate} from 'shared/date-fns';
import {pluralizeKey} from 'shared/pluralization';
import {ScrollView} from 'react-native-gesture-handler';
import {useAccessibilityService} from 'services/AccessibilityService';
Expand Down Expand Up @@ -91,10 +91,14 @@ const ShareDiagnosisCode = ({i18n, isBottomSheetExpanded}: {i18n: I18n; isBottom
const [exposureStatus] = useExposureStatus();

if (exposureStatus.type === 'diagnosed') {
const daysLeft = daysBetween(new Date(), new Date(exposureStatus.cycleEndsAt)) - 1;
const bodyText =
i18n.translate('OverlayOpen.EnterCodeCardBodyDiagnosed') +
i18n.translate(pluralizeKey('OverlayOpen.EnterCodeCardDiagnosedCountdown', daysLeft), {number: daysLeft});
const daysLeft = daysBetween(getCurrentDate(), new Date(exposureStatus.cycleEndsAt)) - 1;
let bodyText = i18n.translate('OverlayOpen.EnterCodeCardBodyDiagnosed');
if (daysLeft > 0) {
bodyText += i18n.translate(pluralizeKey('OverlayOpen.EnterCodeCardDiagnosedCountdown', daysLeft), {
number: daysLeft,
});
}

return (
<InfoBlock
focusOnTitle={isBottomSheetExpanded}
Expand Down

0 comments on commit 35b4954

Please sign in to comment.