diff --git a/src/components/hc-center/HcCenterView.tsx b/src/components/hc-center/HcCenterView.tsx index 2c94d395..27570165 100644 --- a/src/components/hc-center/HcCenterView.tsx +++ b/src/components/hc-center/HcCenterView.tsx @@ -19,12 +19,12 @@ export const HcCenterView: FC<{}> = props => const getClubText = () => { if(purse.clubDays <= 0) return LocalizeText('purse.clubdays.zero.amount.text'); - + if((purse.minutesUntilExpiration > -1) && (purse.minutesUntilExpiration < (60 * 24))) { return FriendlyTime.shortFormat(purse.minutesUntilExpiration * 60); } - + return FriendlyTime.shortFormat(((purse.clubPeriods * 31) + purse.clubDays) * 86400); } @@ -33,16 +33,16 @@ export const HcCenterView: FC<{}> = props => switch(clubStatus) { 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: - return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'joindate' ], [ kickbackData.firstSubscriptionDate ]); + return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'joindate' ], [ kickbackData?.firstSubscriptionDate ]); default: return LocalizeText(`hccenter.status.${ clubStatus }.info`); } } - const getHcPaydayTime = () => (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 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() ]); useMessageEvent(ClubGiftInfoEvent, event => { @@ -64,9 +64,9 @@ export const HcCenterView: FC<{}> = props => linkReceived: (url: string) => { const parts = url.split('/'); - + if(parts.length < 2) return; - + switch(parts[1]) { case 'open': @@ -80,7 +80,7 @@ export const HcCenterView: FC<{}> = props => } } return; - } + } }, eventUrlPrefix: 'habboUI/' }; @@ -116,11 +116,11 @@ export const HcCenterView: FC<{}> = props =>
{ LocalizeText('hccenter.breakdown.title') }
-
{ LocalizeText('hccenter.breakdown.creditsspent', [ 'credits' ], [ kickbackData.totalCreditsSpent.toString() ]) }
-
{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData.kickbackPercentage * 100).toString() ]) }
-
{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData.creditRewardForStreakBonus.toString() ]) }
+
{ LocalizeText('hccenter.breakdown.creditsspent', [ 'credits' ], [ kickbackData?.totalCreditsSpent.toString() ]) }
+
{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData?.kickbackPercentage * 100).toString() ]) }
+
{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData?.creditRewardForStreakBonus.toString() ]) }

-
{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), ((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ]) }
+
{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), ((((kickbackData?.kickbackPercentage * kickbackData?.totalCreditsSpent) + kickbackData?.creditRewardForStreakBonus) * 100) / 100).toString() ]) }
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }> { LocalizeText('hccenter.special.infolink') }
@@ -154,7 +154,7 @@ export const HcCenterView: FC<{}> = props => { GetConfiguration('hc.center')['payday.info'] && - +

{ LocalizeText('hccenter.special.title') }

{ LocalizeText('hccenter.special.info') }
diff --git a/src/components/room/widgets/choosers/ChooserWidgetView.tsx b/src/components/room/widgets/choosers/ChooserWidgetView.tsx index 2f192d42..0f7f5167 100644 --- a/src/components/room/widgets/choosers/ChooserWidgetView.tsx +++ b/src/components/room/widgets/choosers/ChooserWidgetView.tsx @@ -21,7 +21,7 @@ export const ChooserWidgetView: FC = props => { const value = searchValue.toLocaleLowerCase(); - return items.filter(item => item.name.toLocaleLowerCase().includes(value)); + return items.filter(item => item.name?.toLocaleLowerCase().includes(value)); }, [ items, searchValue ]); useEffect(() =>