mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 15:40:51 +01:00
add some null checks
This commit is contained in:
parent
fc6852ee2f
commit
d2a01071f3
@ -33,16 +33,16 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
switch(clubStatus)
|
switch(clubStatus)
|
||||||
{
|
{
|
||||||
case ClubStatus.ACTIVE:
|
case ClubStatus.ACTIVE:
|
||||||
return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'timeleft', 'joindate', 'streakduration' ], [ getClubText(), kickbackData.firstSubscriptionDate, FriendlyTime.shortFormat(kickbackData.currentHcStreak * 86400) ]);
|
return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'timeleft', 'joindate', 'streakduration' ], [ getClubText(), kickbackData?.firstSubscriptionDate, FriendlyTime.shortFormat(kickbackData?.currentHcStreak * 86400) ]);
|
||||||
case ClubStatus.EXPIRED:
|
case ClubStatus.EXPIRED:
|
||||||
return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'joindate' ], [ kickbackData.firstSubscriptionDate ]);
|
return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'joindate' ], [ kickbackData?.firstSubscriptionDate ]);
|
||||||
default:
|
default:
|
||||||
return LocalizeText(`hccenter.status.${ clubStatus }.info`);
|
return LocalizeText(`hccenter.status.${ clubStatus }.info`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getHcPaydayTime = () => (kickbackData.timeUntilPayday < 60) ? LocalizeText('hccenter.special.time.soon') : FriendlyTime.shortFormat(kickbackData.timeUntilPayday * 60);
|
const getHcPaydayTime = () => (!kickbackData || kickbackData.timeUntilPayday < 60) ? LocalizeText('hccenter.special.time.soon') : FriendlyTime.shortFormat(kickbackData.timeUntilPayday * 60);
|
||||||
const getHcPaydayAmount = () => LocalizeText('hccenter.special.sum', [ 'credits' ], [ (kickbackData.creditRewardForStreakBonus + kickbackData.creditRewardForMonthlySpent).toString() ]);
|
const getHcPaydayAmount = () => LocalizeText('hccenter.special.sum', [ 'credits' ], [ (kickbackData?.creditRewardForStreakBonus + kickbackData?.creditRewardForMonthlySpent).toString() ]);
|
||||||
|
|
||||||
useMessageEvent<ClubGiftInfoEvent>(ClubGiftInfoEvent, event =>
|
useMessageEvent<ClubGiftInfoEvent>(ClubGiftInfoEvent, event =>
|
||||||
{
|
{
|
||||||
@ -116,11 +116,11 @@ export const HcCenterView: FC<{}> = props =>
|
|||||||
<Popover id="popover-basic">
|
<Popover id="popover-basic">
|
||||||
<Popover.Body className="text-black py-2 px-3">
|
<Popover.Body className="text-black py-2 px-3">
|
||||||
<h5>{ LocalizeText('hccenter.breakdown.title') }</h5>
|
<h5>{ LocalizeText('hccenter.breakdown.title') }</h5>
|
||||||
<div>{ LocalizeText('hccenter.breakdown.creditsspent', [ 'credits' ], [ kickbackData.totalCreditsSpent.toString() ]) }</div>
|
<div>{ LocalizeText('hccenter.breakdown.creditsspent', [ 'credits' ], [ kickbackData?.totalCreditsSpent.toString() ]) }</div>
|
||||||
<div>{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData.kickbackPercentage * 100).toString() ]) }</div>
|
<div>{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData?.kickbackPercentage * 100).toString() ]) }</div>
|
||||||
<div>{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData.creditRewardForStreakBonus.toString() ]) }</div>
|
<div>{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData?.creditRewardForStreakBonus.toString() ]) }</div>
|
||||||
<hr className="w-100 text-black my-1" />
|
<hr className="w-100 text-black my-1" />
|
||||||
<div>{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), ((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ]) }</div>
|
<div>{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), ((((kickbackData?.kickbackPercentage * kickbackData?.totalCreditsSpent) + kickbackData?.creditRewardForStreakBonus) * 100) / 100).toString() ]) }</div>
|
||||||
<div className="btn btn-link text-primary p-0" onClick={ () => CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }>
|
<div className="btn btn-link text-primary p-0" onClick={ () => CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }>
|
||||||
{ LocalizeText('hccenter.special.infolink') }
|
{ LocalizeText('hccenter.special.infolink') }
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,7 @@ export const ChooserWidgetView: FC<ChooserWidgetViewProps> = props =>
|
|||||||
{
|
{
|
||||||
const value = searchValue.toLocaleLowerCase();
|
const value = searchValue.toLocaleLowerCase();
|
||||||
|
|
||||||
return items.filter(item => item.name.toLocaleLowerCase().includes(value));
|
return items.filter(item => item.name?.toLocaleLowerCase().includes(value));
|
||||||
}, [ items, searchValue ]);
|
}, [ items, searchValue ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
|
Loading…
Reference in New Issue
Block a user