Skip to content

Commit

Permalink
Issue emergentworks#35: Refactor data structure of text contact info …
Browse files Browse the repository at this point in the history
…so that texting can be interactive in the future
  • Loading branch information
jaqarrick committed Dec 3, 2020
1 parent 0d1e1b8 commit 5d4f7f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
14 changes: 7 additions & 7 deletions constants/PhoneNumbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {
is24Hr?: true,
tags?: string[],
tel?: string,
text?: string,
text?: { content?: string; number: string; },
website?: string,
voicemail?: true,
}[];
Expand Down Expand Up @@ -50,7 +50,7 @@ export const PhoneNumbers: Props = {
crisis: true,
display: 'National Domestic Violence Hotline',
tel: '1-800-799-7233',
text: 'or text LOVEIS to 1-866-331-9474',
text: { content: 'LOVEIS', number: '1-866-331-9474' },
hours: '24 Hour Access',
}],

Expand All @@ -71,7 +71,7 @@ export const PhoneNumbers: Props = {
'Outpatient Detox',
],
tel: '1-888-692-9355',
text: 'or text WELL to 65173',
text: { content: 'WELL', number: '65173' },
}, {
display: 'NY State Emotional Support Helpline',
tags: ['Anxiety', 'Counseling', 'COVID-19'],
Expand All @@ -81,14 +81,14 @@ export const PhoneNumbers: Props = {
// display: 'NYS/Crisis Text Line Partnership',
// hours: '24 Hour Access',
// tags: ['Crisis', 'Counseling', 'COVID-19'],
// text: 'Text GOT5 to 741741',
// text: { content: 'GOT5', number: '741741' },
// },
{
display: 'SAMHSA Disaster Distress National Helpline',
hours: '24 Hour Access',
tags: ['Post-Disaster', 'Crisis', 'Emotional Distress', 'Trauma', 'COVID-19', 'Unrest', 'Spanish'],
tel: '1-800-985-5990',
text: 'or text TalkWithUs or Hablanos to 66746',
text: {content: 'TalkWithUs or Hablanos', number: '66746'},
website: 'https://www.samhsa.gov/find-help/disaster-distress-helpline',
}],

Expand Down Expand Up @@ -197,7 +197,7 @@ export const PhoneNumbers: Props = {
'Outpatient Detox',
],
tel: '1-888-692-9355',
text: 'or text WELL to 65173',
text: {content: 'WELL', number: '65173'},
}, {
display: 'New York State Office of Addiction Services and Supports HOPEline',
hours: '24 Hour Access',
Expand All @@ -209,6 +209,6 @@ export const PhoneNumbers: Props = {
'Multilingual support',
],
tel: '1-877-846-7369',
text: 'or text HOPENY',
text: {number: 'HOPENY'}, // TODO (JC): Make sure that this letter phone number format works properly
}],
};
18 changes: 17 additions & 1 deletion screens/PhoneNumberListScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ export const PhoneNumberListScreen = (props: Props) => {
return 1;
});

const formatTextInfo = (textInfo: { content?: string; number: string }) => {
if (textInfo === undefined) {
return '';
}

let displayInfo: string = 'or text';

if (textInfo.content) {
displayInfo += ` ${textInfo.content} to`;
}

displayInfo += ` ${textInfo.number}`;

return displayInfo;
}

return (
<View
darkColor={Styles.black}
Expand Down Expand Up @@ -71,7 +87,7 @@ export const PhoneNumberListScreen = (props: Props) => {
<Text
darkColor={Styles.white}
style={[styles.centerTxt, styles.tel]}>
{entry.tel} {entry.text}
{entry.tel} {formatTextInfo(entry.text)}
</Text>
<TouchableOpacity
style={[
Expand Down

0 comments on commit 5d4f7f8

Please sign in to comment.