This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Place-based exposure screen conditional on severity (#1534)
- Loading branch information
Showing
6 changed files
with
92 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,76 @@ | ||
import React from 'react'; | ||
import {RoundedBox, Text} from 'components'; | ||
import {useI18n} from 'locale'; | ||
import {RoundedBox, Text, TextMultiline} from 'components'; | ||
import {useI18n, I18n} from 'locale'; | ||
import {useOutbreakService} from 'services/OutbreakService'; | ||
import {getCurrentOutbreakHistory, OutbreakSeverity} from 'shared/qr'; | ||
|
||
import {BaseHomeView} from '../components/BaseHomeView'; | ||
import {HomeScreenTitle} from '../components/HomeScreenTitle'; | ||
|
||
import {NegativeOutbreakTestButton} from './ClearOutbreakExposureView'; | ||
|
||
const ExposureText = () => { | ||
export const OutbreakExposedView = () => { | ||
const i18n = useI18n(); | ||
const {outbreakHistory} = useOutbreakService(); | ||
const currentOutbreakHistory = getCurrentOutbreakHistory(outbreakHistory); | ||
const mostRecentHistoryItem = currentOutbreakHistory[0]; | ||
const severity = mostRecentHistoryItem.severity; | ||
|
||
return ( | ||
<> | ||
<BaseHomeView iconName="hand-caution-yellow" testID="outbreakExposure"> | ||
<RoundedBox isFirstBox> | ||
<HomeScreenTitle>{i18n.translate(`QRCode.OutbreakExposed.Title`)}</HomeScreenTitle> | ||
<Text marginBottom="m">{i18n.translate(`QRCode.OutbreakExposed.Body`)}</Text> | ||
</RoundedBox> | ||
|
||
<RoundedBox isFirstBox={false}> | ||
<Text variant="bodyTitle" marginBottom="m" accessibilityRole="header"> | ||
{i18n.translate('QRCode.OutbreakExposed.NextSteps.Title')} | ||
</Text> | ||
<Text marginBottom="m">{i18n.translate('QRCode.OutbreakExposed.NextSteps.Body')}</Text> | ||
<NegativeOutbreakTestButton /> | ||
<ConditionalText severity={severity} i18n={i18n} /> | ||
</RoundedBox> | ||
</BaseHomeView> | ||
); | ||
}; | ||
|
||
const ConditionalText = ({severity, i18n}: {severity: OutbreakSeverity; i18n: I18n}) => { | ||
switch (severity) { | ||
case OutbreakSeverity.GetTested: | ||
return <GetTestedText i18n={i18n} />; | ||
case OutbreakSeverity.SelfIsolate: | ||
return <IsolateText i18n={i18n} />; | ||
case OutbreakSeverity.SelfMonitor: | ||
return <MonitorText i18n={i18n} />; | ||
} | ||
}; | ||
|
||
const IsolateText = ({i18n}: {i18n: I18n}) => { | ||
return ( | ||
<> | ||
<Text variant="bodyTitle" marginBottom="m" accessibilityRole="header"> | ||
{i18n.translate('QRCode.OutbreakExposed.SelfIsolate.Title')} | ||
</Text> | ||
<TextMultiline marginBottom="m" text={i18n.translate('QRCode.OutbreakExposed.SelfIsolate.Body')} /> | ||
<NegativeOutbreakTestButton /> | ||
</> | ||
); | ||
}; | ||
|
||
export const OutbreakExposedView = () => { | ||
const MonitorText = ({i18n}: {i18n: I18n}) => { | ||
return ( | ||
<BaseHomeView iconName="hand-caution-yellow" testID="outbreakExposure"> | ||
<ExposureText /> | ||
</BaseHomeView> | ||
<> | ||
<Text variant="bodyTitle" marginBottom="m" accessibilityRole="header"> | ||
{i18n.translate('QRCode.OutbreakExposed.SelfMonitor.Title')} | ||
</Text> | ||
<TextMultiline marginBottom="m" text={i18n.translate('QRCode.OutbreakExposed.SelfMonitor.Body')} /> | ||
</> | ||
); | ||
}; | ||
|
||
const GetTestedText = ({i18n}: {i18n: I18n}) => { | ||
return ( | ||
<> | ||
<Text variant="bodyTitle" marginBottom="m" accessibilityRole="header"> | ||
{i18n.translate('QRCode.OutbreakExposed.GetTested.Title')} | ||
</Text> | ||
<TextMultiline marginBottom="m" text={i18n.translate('QRCode.OutbreakExposed.GetTested.Body')} /> | ||
<NegativeOutbreakTestButton /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters