Fix empty telegram crash

This commit is contained in:
Letícia Camara 2018-11-13 18:11:59 -02:00
parent ad44177e7f
commit bc7467bfa0
2 changed files with 29 additions and 14 deletions

View file

@ -205,6 +205,15 @@ class AmbassadorsPage extends Component {
const infoDescription = <div> const infoDescription = <div>
<div><b>Address</b>: {merchant.address}</div> <div><b>Address</b>: {merchant.address}</div>
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)} {(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
{(merchant.telegram) && (<div><b>Telegram</b>:
<a
href={`https://t.me/${(merchant.telegram.trim().charAt(0) === '@') ? merchant.telegram.trim().slice(1): merchant.telegram.trim()}`}
target="_blank"
rel="noopener noreferrer"
>{merchant.telegram}</a>
</div>)}
{(merchant.website) && (<div><b>Website:</b>: <a target="_blank" rel="noopener noreferrer"
href={merchant.website}>{stripProtocol(merchant.website)}</a></div>)}
</div>; </div>;
const marker = { const marker = {
lat: merchant.lat, lat: merchant.lat,

View file

@ -59,8 +59,8 @@ const columnData = [
{ id: 'country', numeric: false, disablePadding: true, label: 'Country' }, { id: 'country', numeric: false, disablePadding: true, label: 'Country' },
{ id: 'phone', numeric: false, disablePadding: true, label: 'Phone' }, { id: 'phone', numeric: false, disablePadding: true, label: 'Phone' },
{ id: 'link', numeric: false, disablePadding: false, label: 'Website' }, { id: 'link', numeric: false, disablePadding: false, label: 'Website' },
{ id: 'telegram', numeric: false, disablePadding: true, label: 'telegram' }, { id: 'telegram', numeric: false, disablePadding: true, label: 'Telegram' },
{ id: 'website', numeric: false, disablePadding: true, label: 'website' }, { id: 'website', numeric: false, disablePadding: true, label: 'Website' },
{ id: 'map', numeric: false, disablePadding: false, label: 'Maps', disableSearch: true} { id: 'map', numeric: false, disablePadding: false, label: 'Maps', disableSearch: true}
]; ];
@ -208,18 +208,24 @@ class MerchantsPage extends Component {
<div><b>Address</b>: {merchant.address}</div> <div><b>Address</b>: {merchant.address}</div>
{(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)} {(merchant.phone) && (<div><b>Phone</b>: {merchant.phone}</div>)}
</div>; </div>;
merchant.telegram_original = merchant.telegram; if(merchant.telegram){
merchant.telegram = { merchant.telegram_original = merchant.telegram;
searchText: merchant.telegram, merchant.telegram = {
value: ( searchText: merchant.telegram,
<a value: (
href={`https://t.me/${(merchant.telegram.trim().charAt(0) === '@') ? <a
merchant.telegram.trim().slice(1): merchant.telegram.trim()}`} href={`https://t.me/${(merchant.telegram.trim().charAt(0) === '@') ?
target="_blank" merchant.telegram.trim().slice(1): merchant.telegram.trim()}`}
rel="noopener noreferrer" target="_blank"
>{merchant.telegram}</a> rel="noopener noreferrer"
) >{merchant.telegram}</a>
}; )
};
}
else{
}
merchant.link = { merchant.link = {
searchText: stripProtocol(merchant.website), searchText: stripProtocol(merchant.website),
value: ( value: (