Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add twitter handle scheme back in #752

Merged
merged 2 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/components/flow/actions/addurn/AddURN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import i18n from 'config/i18n';

export const MAX_TO_SHOW = 3;

const AddURNComp: React.SFC<AddURN> = ({ scheme, path }): JSX.Element => (
<>
{i18n.t('add', 'Add')} {getSchemeObject(scheme).name} {path}
</>
);
const AddURNComp: React.SFC<AddURN> = ({ scheme, path }): JSX.Element => {
const schemeObject = getSchemeObject(scheme);
const schemeName = schemeObject ? schemeObject.name : scheme;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a failsafe, fallback to the scheme as the name if we don't recognize it.

return (
<>
{i18n.t('add', 'Add')} {schemeName} {path}
</>
);
};

export default AddURNComp;
3 changes: 2 additions & 1 deletion src/config/i18n/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@
"line": "Line ID",
"phone": "Phone Number",
"telegram": "Telegram ID",
"twitter": "Twitter ID",
"twitter": "Twitter Handle",
"twitterid": "Twitter ID",
"viber": "Viber ID",
"wechat": "Wechat ID",
"whatsapp": "Whatsapp Number"
Expand Down
3 changes: 2 additions & 1 deletion src/config/typeConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export const SCHEMES: Scheme[] = [
{ scheme: 'mailto', name: i18n.t('schemes.email', 'Email Address') },
{ scheme: 'tel', name: i18n.t('schemes.phone', 'Phone Number') },
{ scheme: 'telegram', name: i18n.t('schemes.telegram', 'Telegram ID') },
{ scheme: 'twitterid', name: i18n.t('schemes.twitter', 'Twitter ID') },
{ scheme: 'twitterid', name: i18n.t('schemes.twitterid', 'Twitter ID') },
{ scheme: 'twitter', name: i18n.t('schemes.twitter', 'Twitter Handle') },
{ scheme: 'wechat', name: i18n.t('schemes.wechat', 'Wechat ID') },
{ scheme: 'whatsapp', name: i18n.t('schemes.whatsapp', 'Whatsapp Number') },
{ scheme: 'viber', name: i18n.t('schemes.viber', 'Viber ID') }
Expand Down