From c697a9aa30b522e58ac8e87cb492cbef158072c7 Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 3 Apr 2022 22:45:47 -0400 Subject: [PATCH] Updates --- .eslintrc.json | 12 +- .../common => api/hc-center}/ClubStatus.ts | 0 src/api/hc-center/GetClubBadge.ts | 11 + src/api/hc-center/index.ts | 2 + src/api/index.ts | 2 + .../purse/common => api/purse}/IPurse.ts | 0 .../purse/common => api/purse}/Purse.ts | 2 +- src/api/purse/index.ts | 2 + .../transitions/TransitionAnimation.tsx | 2 +- .../avatar-editor/AvatarEditorView.tsx | 2 +- .../views/model/AvatarEditorModelView.tsx | 2 +- src/components/campaign/CampaignView.tsx | 2 +- .../catalog/CatalogMessageHandler.tsx | 21 +- .../catalog/common/ICatalogOptions.ts | 2 - .../navigation/CatalogNavigationView.tsx | 2 +- .../page/layout/CatalogLayoutVipBuyView.tsx | 25 +- ...atalogLayoutMarketplacePublicItemsView.tsx | 10 +- .../pets/CatalogLayoutPetPurchaseView.tsx | 4 +- .../page/layout/pets/CatalogLayoutPetView.tsx | 2 +- .../vip-gifts/CatalogLayoutVipGiftsView.tsx | 8 +- .../widgets/CatalogPurchaseWidgetView.tsx | 8 +- .../views/messenger/FriendsMessengerView.tsx | 2 +- src/components/hc-center/HcCenterView.tsx | 215 ++++++------------ .../hc-center/common/BadgeResolver.ts | 23 -- .../help/views/SanctionStatusView.tsx | 22 +- src/components/hotel-view/HotelView.tsx | 4 +- .../bonus-rare/BonusRareWidgetView.tsx | 2 +- .../hall-of-fame-item/HallOfFameItemView.tsx | 2 +- .../hall-of-fame/HallOfFameWidgetView.tsx | 2 +- .../promo-article/PromoArticleWidgetView.tsx | 8 +- .../widget-container/WidgetContainerView.tsx | 2 +- src/components/loading/LoadingView.tsx | 2 +- .../views/tickets/CfhChatlogView.tsx | 2 +- .../views/user/ModToolsUserModActionView.tsx | 2 +- .../NavigatorRoomSettingsModTabView.tsx | 6 +- .../NavigatorRoomSettingsVipChatTabView.tsx | 12 +- .../NavigatorSearchResultItemInfoView.tsx | 18 +- .../search/NavigatorSearchResultItemView.tsx | 2 +- .../search/NavigatorSearchResultView.tsx | 4 +- .../NotificationDefaultAlertView.tsx | 18 +- .../NotificationSearchAlertView.tsx | 4 +- src/components/purse/PurseContext.tsx | 18 -- src/components/purse/PurseView.tsx | 168 +++----------- src/components/purse/common/CurrencyHelper.ts | 17 -- .../AvatarInfoWidgetAvatarView.tsx | 8 +- .../room/widgets/chat-input/ChatInputView.tsx | 2 +- .../room/widgets/chat/ChatWidgetView.tsx | 2 +- .../high-score/FurnitureHighScoreView.tsx | 2 +- .../stickie/FurnitureStickieView.tsx | 2 +- .../FurnitureYoutubeDisplayView.tsx | 14 +- .../infostand/InfoStandWidgetFurniView.tsx | 2 +- src/hooks/index.ts | 1 + src/hooks/purse/index.ts | 1 + src/hooks/purse/usePurse.ts | 134 +++++++++++ 54 files changed, 374 insertions(+), 470 deletions(-) rename src/{components/hc-center/common => api/hc-center}/ClubStatus.ts (100%) create mode 100644 src/api/hc-center/GetClubBadge.ts create mode 100644 src/api/hc-center/index.ts rename src/{components/purse/common => api/purse}/IPurse.ts (100%) rename src/{components/purse/common => api/purse}/Purse.ts (98%) create mode 100644 src/api/purse/index.ts delete mode 100644 src/components/hc-center/common/BadgeResolver.ts delete mode 100644 src/components/purse/PurseContext.tsx delete mode 100644 src/components/purse/common/CurrencyHelper.ts create mode 100644 src/hooks/purse/index.ts create mode 100644 src/hooks/purse/usePurse.ts diff --git a/.eslintrc.json b/.eslintrc.json index 1cd6d95c..97926803 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,11 +35,17 @@ "brace-style": [ "error", "allman" ], "template-curly-spacing": [ "error", "always" ], "no-multi-spaces": [ "error" ], - "react/prop-types": [ "off" ], "jsx-quotes": [ "error" ], - "react/jsx-curly-spacing": [ "error", "always" ], + "react/prop-types": [ "off" ], + "react/jsx-curly-spacing": [ "error", { "when": "always", "children": true } ], "react/jsx-equals-spacing": [ "error" ], - "@typescript-eslint/object-curly-spacing": [ "error", "always", { "arraysInObjects": true, "objectsInObjects": false } ], + "react/jsx-newline": [ "error", { "prevent": true } ], + "@typescript-eslint/object-curly-spacing": [ "error", "always", + { + "arraysInObjects": true, + "objectsInObjects": false + } + ], "@typescript-eslint/ban-types": [ "error", { diff --git a/src/components/hc-center/common/ClubStatus.ts b/src/api/hc-center/ClubStatus.ts similarity index 100% rename from src/components/hc-center/common/ClubStatus.ts rename to src/api/hc-center/ClubStatus.ts diff --git a/src/api/hc-center/GetClubBadge.ts b/src/api/hc-center/GetClubBadge.ts new file mode 100644 index 00000000..6b779e0f --- /dev/null +++ b/src/api/hc-center/GetClubBadge.ts @@ -0,0 +1,11 @@ +const DEFAULT_BADGE: string = 'HC1'; +const BADGES: string[] = [ 'ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5' ]; + +export const GetClubBadge = (badgeCodes: string[]) => +{ + let badgeCode: string = null; + + BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge))); + + return (badgeCode || DEFAULT_BADGE); +} diff --git a/src/api/hc-center/index.ts b/src/api/hc-center/index.ts new file mode 100644 index 00000000..cee8f692 --- /dev/null +++ b/src/api/hc-center/index.ts @@ -0,0 +1,2 @@ +export * from './ClubStatus'; +export * from './GetClubBadge'; diff --git a/src/api/index.ts b/src/api/index.ts index 92da5d94..d3473996 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -6,6 +6,7 @@ export * from './friends'; export * from './GetRendererVersion'; export * from './GetUIVersion'; export * from './groups'; +export * from './hc-center'; export * from './inventory'; export * from './inventory/unseen'; export * from './navigator'; @@ -19,6 +20,7 @@ export * from './nitro/room/widgets/handlers'; export * from './nitro/room/widgets/messages'; export * from './nitro/session'; export * from './notification'; +export * from './purse'; export * from './user'; export * from './utils'; export * from './wired'; diff --git a/src/components/purse/common/IPurse.ts b/src/api/purse/IPurse.ts similarity index 100% rename from src/components/purse/common/IPurse.ts rename to src/api/purse/IPurse.ts diff --git a/src/components/purse/common/Purse.ts b/src/api/purse/Purse.ts similarity index 98% rename from src/components/purse/common/Purse.ts rename to src/api/purse/Purse.ts index f9ea045a..a0a54b4c 100644 --- a/src/components/purse/common/Purse.ts +++ b/src/api/purse/Purse.ts @@ -1,5 +1,5 @@ import { HabboClubLevelEnum } from '@nitrots/nitro-renderer'; -import { GetNitroInstance } from '../../../api'; +import { GetNitroInstance } from '..'; import { IPurse } from './IPurse'; export class Purse implements IPurse diff --git a/src/api/purse/index.ts b/src/api/purse/index.ts new file mode 100644 index 00000000..ed344804 --- /dev/null +++ b/src/api/purse/index.ts @@ -0,0 +1,2 @@ +export * from './IPurse'; +export * from './Purse'; diff --git a/src/common/transitions/TransitionAnimation.tsx b/src/common/transitions/TransitionAnimation.tsx index cc3c3d8d..4f52e38f 100644 --- a/src/common/transitions/TransitionAnimation.tsx +++ b/src/common/transitions/TransitionAnimation.tsx @@ -45,7 +45,7 @@ export const TransitionAnimation: FC = props =>
{ isChildrenVisible && children }
- )} + ) } ); } diff --git a/src/components/avatar-editor/AvatarEditorView.tsx b/src/components/avatar-editor/AvatarEditorView.tsx index 06e08d2c..5ab1bd60 100644 --- a/src/components/avatar-editor/AvatarEditorView.tsx +++ b/src/components/avatar-editor/AvatarEditorView.tsx @@ -296,7 +296,7 @@ export const AvatarEditorView: FC<{}> = props => { LocalizeText(`avatareditor.category.${ category }`) } ); - })} + }) } setIsWardrobeVisible(true) }> { LocalizeText('avatareditor.category.wardrobe') } diff --git a/src/components/avatar-editor/views/model/AvatarEditorModelView.tsx b/src/components/avatar-editor/views/model/AvatarEditorModelView.tsx index 3382a71f..ea9cbda7 100644 --- a/src/components/avatar-editor/views/model/AvatarEditorModelView.tsx +++ b/src/components/avatar-editor/views/model/AvatarEditorModelView.tsx @@ -76,7 +76,7 @@ export const AvatarEditorModelView: FC = props => ); - })} + }) } diff --git a/src/components/campaign/CampaignView.tsx b/src/components/campaign/CampaignView.tsx index 3af14b5e..3a8964a7 100644 --- a/src/components/campaign/CampaignView.tsx +++ b/src/components/campaign/CampaignView.tsx @@ -102,7 +102,7 @@ export const CampaignView: FC<{}> = props => return ( <> - {(calendarData && isCalendarOpen) && + { (calendarData && isCalendarOpen) && } diff --git a/src/components/catalog/CatalogMessageHandler.tsx b/src/components/catalog/CatalogMessageHandler.tsx index 3f2d88e9..b1a53941 100644 --- a/src/components/catalog/CatalogMessageHandler.tsx +++ b/src/components/catalog/CatalogMessageHandler.tsx @@ -1,4 +1,4 @@ -import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; +import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent } from '@nitrots/nitro-renderer'; import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent'; import { FC, useCallback } from 'react'; import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities, ProductTypeEnum } from '../../api'; @@ -15,7 +15,6 @@ import { IPurchasableOffer } from './common/IPurchasableOffer'; import { Offer } from './common/Offer'; import { PageLocalization } from './common/PageLocalization'; import { Product } from './common/Product'; -import { SubscriptionInfo } from './common/SubscriptionInfo'; export const CatalogMessageHandler: FC<{}> = props => { @@ -227,23 +226,6 @@ export const CatalogMessageHandler: FC<{}> = props => }); }, [ setCatalogOptions ]); - const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) => - { - const parser = event.getParser(); - - setCatalogOptions(prevValue => - { - const subscriptionInfo = new SubscriptionInfo( - Math.max(0, parser.daysToPeriodEnd), - Math.max(0, parser.periodsSubscribedAhead), - parser.isVip, - parser.pastClubDays, - parser.pastVipDays); - - return { ...prevValue, subscriptionInfo }; - }); - }, [ setCatalogOptions ]); - const onGiftWrappingConfigurationEvent = useCallback((event: GiftWrappingConfigurationEvent) => { const parser = event.getParser(); @@ -301,7 +283,6 @@ export const CatalogMessageHandler: FC<{}> = props => UseMessageEventHook(ApproveNameMessageEvent, onApproveNameMessageEvent); UseMessageEventHook(GiftReceiverNotFoundEvent, onGiftReceiverNotFoundEvent); UseMessageEventHook(HabboClubOffersMessageEvent, onHabboClubOffersMessageEvent); - UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent); UseMessageEventHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent); UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent); UseMessageEventHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult); diff --git a/src/components/catalog/common/ICatalogOptions.ts b/src/components/catalog/common/ICatalogOptions.ts index 49ed1737..20356947 100644 --- a/src/components/catalog/common/ICatalogOptions.ts +++ b/src/components/catalog/common/ICatalogOptions.ts @@ -1,7 +1,6 @@ import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer'; import { CatalogPetPalette } from './CatalogPetPalette'; import { GiftWrappingConfiguration } from './GiftWrappingConfiguration'; -import { SubscriptionInfo } from './SubscriptionInfo'; export interface ICatalogOptions { @@ -9,7 +8,6 @@ export interface ICatalogOptions petPalettes?: CatalogPetPalette[]; clubOffers?: ClubOfferData[]; clubGifts?: ClubGiftInfoParser; - subscriptionInfo?: SubscriptionInfo; giftConfiguration?: GiftWrappingConfiguration; marketplaceConfiguration?: MarketplaceConfigurationMessageParser; } diff --git a/src/components/catalog/views/navigation/CatalogNavigationView.tsx b/src/components/catalog/views/navigation/CatalogNavigationView.tsx index 7f8ef439..c1d187f4 100644 --- a/src/components/catalog/views/navigation/CatalogNavigationView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationView.tsx @@ -25,7 +25,7 @@ export const CatalogNavigationView: FC = props => { searchResult && (searchResult.filteredNodes.length > 0) && searchResult.filteredNodes.map((n, index) => { return ; - })} + }) } { !searchResult && } diff --git a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx index 1dff2dab..00aaad8e 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx @@ -3,9 +3,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { LocalizeText, SendMessageComposer } from '../../../../../api'; import { AutoGrid, Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, LayoutLoadingSpinnerView, Text } from '../../../../../common'; import { CatalogEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent } from '../../../../../events'; -import { UseUiEvent } from '../../../../../hooks'; -import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper'; -import { GLOBAL_PURSE } from '../../../../purse/PurseView'; +import { usePurse, UseUiEvent } from '../../../../../hooks'; import { useCatalogContext } from '../../../CatalogContext'; import { CatalogPurchaseState } from '../../../common/CatalogPurchaseState'; import { CatalogLayoutProps } from './CatalogLayout.types'; @@ -15,7 +13,8 @@ export const CatalogLayoutVipBuyView: FC = props => const [ pendingOffer, setPendingOffer ] = useState(null); const [ purchaseState, setPurchaseState ] = useState(CatalogPurchaseState.NONE); const { currentPage = null, catalogOptions = null } = useCatalogContext(); - const { clubOffers = null, subscriptionInfo = null } = catalogOptions; + const { purse = null, getCurrencyAmount = null } = usePurse(); + const { clubOffers = null } = catalogOptions; const onCatalogEvent = useCallback((event: CatalogEvent) => { @@ -54,8 +53,6 @@ export const CatalogLayoutVipBuyView: FC = props => const getPurchaseHeader = useCallback(() => { - const purse = GLOBAL_PURSE; - if(!purse) return ''; const extensionOrSubscription = (purse.clubDays > 0 || purse.clubPeriods > 0) ? 'extension.' : 'subscription.'; @@ -64,7 +61,7 @@ export const CatalogLayoutVipBuyView: FC = props => const locale = LocalizeText('catalog.vip.buy.confirm.' + extensionOrSubscription + daysOrMonths); return locale.replace('%NUM_' + daysOrMonths.toUpperCase() + '%', daysOrMonthsText.toString()); - }, [ pendingOffer ]); + }, [ pendingOffer, purse ]); const getPurchaseValidUntil = useCallback(() => { @@ -79,14 +76,12 @@ export const CatalogLayoutVipBuyView: FC = props => const getSubscriptionDetails = useMemo(() => { - if(!subscriptionInfo) return ''; - - const clubDays = subscriptionInfo.clubDays; - const clubPeriods = subscriptionInfo.clubPeriods; + const clubDays = purse.clubDays; + const clubPeriods = purse.clubPeriods; const totalDays = (clubPeriods * 31) + clubDays; return LocalizeText('catalog.vip.extend.info', [ 'days' ], [ totalDays.toString() ]); - }, [ subscriptionInfo ]); + }, [ purse ]); const purchaseSubscription = useCallback(() => { @@ -106,12 +101,12 @@ export const CatalogLayoutVipBuyView: FC = props => { if(!pendingOffer) return null; - if(pendingOffer.priceCredits > GetCurrencyAmount(-1)) + if(pendingOffer.priceCredits > getCurrencyAmount(-1)) { return ; } - if(pendingOffer.priceActivityPoints > GetCurrencyAmount(pendingOffer.priceActivityPointsType)) + if(pendingOffer.priceActivityPoints > getCurrencyAmount(pendingOffer.priceActivityPointsType)) { return ; } @@ -128,7 +123,7 @@ export const CatalogLayoutVipBuyView: FC = props => default: return ; } - }, [ pendingOffer, purchaseState, purchaseSubscription ]); + }, [ pendingOffer, purchaseState, purchaseSubscription, getCurrencyAmount ]); useEffect(() => { diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx index ef10dd3b..a39a21fa 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx @@ -2,8 +2,7 @@ import { BuyMarketplaceOfferMessageComposer, GetMarketplaceOffersMessageComposer import { FC, useCallback, useMemo, useState } from 'react'; import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { Button, ButtonGroup, Column, Text } from '../../../../../../common'; -import { UseMessageEventHook } from '../../../../../../hooks'; -import { GetCurrencyAmount } from '../../../../../purse/common/CurrencyHelper'; +import { UseMessageEventHook, usePurse } from '../../../../../../hooks'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutMarketplaceItemView, PUBLIC_OFFER } from './CatalogLayoutMarketplaceItemView'; import { SearchFormView } from './CatalogLayoutMarketplaceSearchFormView'; @@ -25,6 +24,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC()); const [ lastSearch, setLastSearch ] = useState({ minPrice: -1, maxPrice: -1, query: '', type: 3 }); + const { getCurrencyAmount = null } = usePurse(); const requestOffers = useCallback((options: IMarketplaceSearchOptions) => { @@ -48,18 +48,20 @@ export const CatalogLayoutMarketplacePublicItemsView: FC { - if(offerData.price > GetCurrencyAmount(-1)) + if(offerData.price > getCurrencyAmount(-1)) { NotificationUtilities.simpleAlert(LocalizeText('catalog.alert.notenough.credits.description'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.alert.notenough.title')); return; } + const offerId = offerData.offerId; + NotificationUtilities.confirm(LocalizeText('catalog.marketplace.confirm_header'), () => { SendMessageComposer(new BuyMarketplaceOfferMessageComposer(offerId)); }, null, null, null, LocalizeText('catalog.marketplace.confirm_title')); - },[]); + }, [ getCurrencyAmount ]); const onMarketPlaceOffersEvent = useCallback( (event: MarketPlaceOffersEvent) => { diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx index c5800e67..a9bd44a5 100644 --- a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx @@ -60,9 +60,9 @@ export const CatalogLayoutPetPurchaseView: FC - {/* + { /* { offer.giftable && - } */} + } */ } ); diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx index d2dde60c..665a7a4a 100644 --- a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx @@ -206,7 +206,7 @@ export const CatalogLayoutPetView: FC = props => ); - })} + }) } { colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => setSelectedColorIndex(index) } />) } diff --git a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx index 4c90be62..3b760d27 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx @@ -2,14 +2,16 @@ import { SelectClubGiftComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { AutoGrid, Text } from '../../../../../../common'; +import { usePurse } from '../../../../../../hooks'; import { useCatalogContext } from '../../../../CatalogContext'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { VipGiftItem } from './VipGiftItemView'; export const CatalogLayoutVipGiftsView: FC = props => { + const { purse = null } = usePurse(); const { catalogOptions = null, setCatalogOptions = null } = useCatalogContext(); - const { clubGifts = null, subscriptionInfo = null } = catalogOptions; + const { clubGifts = null } = catalogOptions; const giftsAvailable = useCallback(() => { @@ -19,10 +21,10 @@ export const CatalogLayoutVipGiftsView: FC = props => if(clubGifts.daysUntilNextGift > 0) return LocalizeText('catalog.club_gift.days_until_next', [ 'days' ], [ clubGifts.daysUntilNextGift.toString() ]); - if(subscriptionInfo.isVip) return LocalizeText('catalog.club_gift.not_available'); + if(purse.isVip) return LocalizeText('catalog.club_gift.not_available'); return LocalizeText('catalog.club_gift.no_club'); - }, [ clubGifts, subscriptionInfo ]); + }, [ clubGifts, purse ]); const selectGift = useCallback((localizationId: string) => { diff --git a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx index 7ed446aa..7a874acc 100644 --- a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx @@ -3,8 +3,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { CreateLinkEvent, GetClubMemberLevel, LocalizeText, SendMessageComposer } from '../../../../../api'; import { Button, LayoutLoadingSpinnerView } from '../../../../../common'; import { CatalogEvent, CatalogInitGiftEvent, CatalogInitPurchaseEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogWidgetEvent } from '../../../../../events'; -import { DispatchUiEvent, UseUiEvent } from '../../../../../hooks'; -import { GetCurrencyAmount } from '../../../../purse/common/CurrencyHelper'; +import { DispatchUiEvent, usePurse, UseUiEvent } from '../../../../../hooks'; import { useCatalogContext } from '../../../CatalogContext'; import { CatalogPurchaseState } from '../../../common/CatalogPurchaseState'; import { Offer } from '../../../common/Offer'; @@ -21,6 +20,7 @@ export const CatalogPurchaseWidgetView: FC = pro const [ purchaseWillBeGift, setPurchaseWillBeGift ] = useState(false); const [ purchaseState, setPurchaseState ] = useState(CatalogPurchaseState.NONE); const { currentOffer = null, currentPage = null, purchaseOptions = null, setPurchaseOptions = null } = useCatalogContext(); + const { getCurrencyAmount = null } = usePurse(); const onCatalogInitPurchaseEvent = useCallback((event: CatalogInitPurchaseEvent) => { @@ -148,9 +148,9 @@ export const CatalogPurchaseWidgetView: FC = pro if(isLimitedSoldOut) return ; - if(priceCredits > GetCurrencyAmount(-1)) return ; + if(priceCredits > getCurrencyAmount(-1)) return ; - if(pricePoints > GetCurrencyAmount(currentOffer.activityPointType)) return ; + if(pricePoints > getCurrencyAmount(currentOffer.activityPointType)) return ; switch(purchaseState) { diff --git a/src/components/friends/views/messenger/FriendsMessengerView.tsx b/src/components/friends/views/messenger/FriendsMessengerView.tsx index 28bc8880..d10770bc 100644 --- a/src/components/friends/views/messenger/FriendsMessengerView.tsx +++ b/src/components/friends/views/messenger/FriendsMessengerView.tsx @@ -124,7 +124,7 @@ export const FriendsMessengerView: FC<{}> = props => ); - })} + }) } diff --git a/src/components/hc-center/HcCenterView.tsx b/src/components/hc-center/HcCenterView.tsx index 98df9e63..c680a01b 100644 --- a/src/components/hc-center/HcCenterView.tsx +++ b/src/components/hc-center/HcCenterView.tsx @@ -1,42 +1,31 @@ -import { BadgesEvent, ClubGiftInfoEvent, FriendlyTime, GetClubGiftInfo, ILinkEventTracker, RequestBadgesComposer, ScrGetKickbackInfoMessageComposer, ScrKickbackData, ScrSendKickbackInfoMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; +import { ClubGiftInfoEvent, FriendlyTime, GetClubGiftInfo, ILinkEventTracker, ScrGetKickbackInfoMessageComposer, ScrKickbackData, ScrSendKickbackInfoMessageEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { OverlayTrigger, Popover } from 'react-bootstrap'; -import { AddEventLinkTracker, CreateLinkEvent, GetConfiguration, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api'; +import { AddEventLinkTracker, ClubStatus, CreateLinkEvent, GetClubBadge, GetConfiguration, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api'; import { Base, Button, Column, Flex, LayoutAvatarImageView, LayoutBadgeImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common'; -import { UseMessageEventHook, useSessionInfo } from '../../hooks'; -import { BadgeResolver } from './common/BadgeResolver'; -import { ClubStatus } from './common/ClubStatus'; +import { useInventoryBadges, UseMessageEventHook, usePurse, useSessionInfo } from '../../hooks'; export const HcCenterView: FC<{}> = props => { const [ isVisible, setIsVisible ] = useState(false); const [ kickbackData, setKickbackData ] = useState(null); - const [ clubDays, setClubDays ] = useState(0); - const [ pastClubDays, setPastClubDays ] = useState(0); - const [ clubPeriods, setPastClubPeriods ] = useState(0); - const [ minsTillExpire, setMinsTillExpire ] = useState(0); - const [ clubStatus, setClubStatus ] = useState(ClubStatus.NONE); const [ unclaimedGifts, setUnclaimedGifts ] = useState(0); - const [ badgeCode, setBadgeCode ] = useState(BadgeResolver.default_badge); + const [ badgeCode, setBadgeCode ] = useState(null); const { userFigure = null } = useSessionInfo(); + const { purse = null, clubStatus = null } = usePurse(); + const { badgeCodes = [], activate = null, deactivate = null } = useInventoryBadges(); const getClubText = () => { - const totalDays = ((clubPeriods * 31) + clubDays); - const minutesUntilExpiration = minsTillExpire; - - if(clubStatus !== ClubStatus.ACTIVE) + if(purse.clubDays <= 0) return LocalizeText('purse.clubdays.zero.amount.text'); + + if((purse.minutesUntilExpiration > -1) && (purse.minutesUntilExpiration < (60 * 24))) { - return LocalizeText('purse.clubdays.zero.amount.text'); + return FriendlyTime.shortFormat(purse.minutesUntilExpiration * 60); } - if((minutesUntilExpiration > -1) && (minutesUntilExpiration < (60 * 24))) - { - return FriendlyTime.shortFormat(minutesUntilExpiration * 60); - } - - return FriendlyTime.shortFormat(totalDays * 86400); + return FriendlyTime.shortFormat(((purse.clubPeriods * 31) + purse.clubDays) * 86400); } const getInfoText = () => @@ -52,16 +41,8 @@ export const HcCenterView: FC<{}> = props => } } - const getHcPaydayTime = () => - { - if(kickbackData.timeUntilPayday < 60) return LocalizeText('hccenter.special.time.soon'); - return FriendlyTime.shortFormat(kickbackData.timeUntilPayday * 60); - } - - const getHcPaydayAmount = () => - { - return LocalizeText('hccenter.special.sum', [ 'credits' ], [ (kickbackData.creditRewardForStreakBonus + kickbackData.creditRewardForMonthlySpent).toString() ]); - } + 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 onClubGiftInfoEvent = useCallback((event: ClubGiftInfoEvent) => { @@ -81,87 +62,56 @@ export const HcCenterView: FC<{}> = props => UseMessageEventHook(ScrSendKickbackInfoMessageEvent, onScrSendKickbackInfo); - const onBadges = useCallback((event: BadgesEvent) => - { - const parser = event.getParser(); - - setBadgeCode(BadgeResolver.getClubBadge(parser.getAllBadgeCodes())); - }, []); - - UseMessageEventHook(BadgesEvent, onBadges); - - const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) => - { - const parser = event.getParser(); - - const productName = parser.productName; - - if((productName !== 'club_habbo') && (productName !== 'habbo_club')) return; - - setClubDays(Math.max(0, parser.daysToPeriodEnd)); - setPastClubPeriods(Math.max(0, parser.periodsSubscribedAhead)); - setPastClubDays(Math.max(0, parser.pastClubDays)); - setMinsTillExpire(Math.max(0, parser.minutesUntilExpiration)); - }, []); - - UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent); - - const linkReceived = useCallback((url: string) => - { - const parts = url.split('/'); - - if(parts.length < 2) return; - - switch(parts[1]) - { - case 'open': - if(parts.length > 2) - { - switch(parts[2]) - { - case 'hccenter': - setIsVisible(true); - break; - } - } - return; - } - }, []); - useEffect(() => { const linkTracker: ILinkEventTracker = { - linkReceived, + linkReceived: (url: string) => + { + const parts = url.split('/'); + + if(parts.length < 2) return; + + switch(parts[1]) + { + case 'open': + if(parts.length > 2) + { + switch(parts[2]) + { + case 'hccenter': + setIsVisible(true); + break; + } + } + return; + } + }, eventUrlPrefix: 'habboUI/' }; AddEventLinkTracker(linkTracker); return () => RemoveLinkEventTracker(linkTracker); - }, [ linkReceived ]); + }, []); useEffect(() => { - if(clubDays > 0) - { - setClubStatus(ClubStatus.ACTIVE); + setBadgeCode(GetClubBadge(badgeCodes)); + }, [ badgeCodes ]); - return; - } + useEffect(() => + { + if(!isVisible) return; - if(pastClubDays > 0) - { - setClubStatus(ClubStatus.EXPIRED); + const id = activate(); - return; - } - }, [ clubDays, pastClubDays ]); + return () => deactivate(id); + }, [ isVisible, activate, deactivate ]); useEffect(() => { SendMessageComposer(new GetClubGiftInfo()); SendMessageComposer(new ScrGetKickbackInfoMessageComposer()); - SendMessageComposer(new RequestBadgesComposer()); }, []); if(!isVisible) return null; @@ -169,18 +119,14 @@ export const HcCenterView: FC<{}> = props => const popover = ( -
{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.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.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), - ((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ])}
-
- { - CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) - } }>{ - LocalizeText('hccenter.special.infolink')} +
{ 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') }
@@ -193,10 +139,7 @@ export const HcCenterView: FC<{}> = props =>
- @@ -215,58 +158,50 @@ export const HcCenterView: FC<{}> = props => { GetConfiguration('hc.center')['payday.info'] && + -

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

-
{LocalizeText('hccenter.special.info')}
-
- { - CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) - } }>{LocalizeText('hccenter.special.infolink')}
+

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

+
{ LocalizeText('hccenter.special.info') }
+
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }>{ LocalizeText('hccenter.special.infolink') }
-
{LocalizeText('hccenter.special.time.title')}
+
{ LocalizeText('hccenter.special.time.title') }
-
{getHcPaydayTime()}
+
{ getHcPaydayTime() }
- {clubStatus === ClubStatus.ACTIVE && + { clubStatus === ClubStatus.ACTIVE &&
-
{LocalizeText('hccenter.special.amount.title')}
+
{ LocalizeText('hccenter.special.amount.title') }
-
{getHcPaydayAmount()}
+
{ getHcPaydayAmount() }
- {LocalizeText('hccenter.breakdown.infolink')} + { LocalizeText('hccenter.breakdown.infolink') }
-
- } +
}
-
- } - {GetConfiguration('hc.center')['gift.info'] && + } + { GetConfiguration('hc.center')['gift.info'] &&
-

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

+

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

0 ? LocalizeText('hccenter.unclaimedgifts', [ 'unclaimedgifts' ], [ unclaimedGifts.toString() ]) : LocalizeText('hccenter.gift.info') } }>
- -
- } - {GetConfiguration('hc.center')['benefits.info'] && + +
} + { GetConfiguration('hc.center')['benefits.info'] &&
-
{LocalizeText('hccenter.general.title')}
+
{ LocalizeText('hccenter.general.title') }
- -
- } + +
} ); diff --git a/src/components/hc-center/common/BadgeResolver.ts b/src/components/hc-center/common/BadgeResolver.ts deleted file mode 100644 index e334b6e8..00000000 --- a/src/components/hc-center/common/BadgeResolver.ts +++ /dev/null @@ -1,23 +0,0 @@ - -export class BadgeResolver -{ - public static default_badge: string = 'HC1'; - public static badges: string[] = [ 'ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5' ]; - - - public static getClubBadge(k: string[]): string - { - var badgeCode: string = null; - - this.badges.forEach(badge => - { - if (k.indexOf(badge) > -1) - { - badgeCode = badge; - } - }); - - return badgeCode || this.default_badge; - } - -} diff --git a/src/components/help/views/SanctionStatusView.tsx b/src/components/help/views/SanctionStatusView.tsx index b01a1698..5930ca24 100644 --- a/src/components/help/views/SanctionStatusView.tsx +++ b/src/components/help/views/SanctionStatusView.tsx @@ -58,28 +58,28 @@ export const SanctionSatusView:FC<{}> = props =>
{ (sanctionInfo.sanctionReason === 'cfh.reason.EMPTY') - ?
{LocalizeText('help.sanction.current.none')}
+ ?
{ LocalizeText('help.sanction.current.none') }
: <> - {((sanctionInfo.probationHoursLeft > 0) || (sanctionInfo.isSanctionActive)) && -
{LocalizeText('help.sanction.probation.reminder')}
+ { ((sanctionInfo.probationHoursLeft > 0) || (sanctionInfo.isSanctionActive)) && +
{ LocalizeText('help.sanction.probation.reminder') }
}
- {LocalizeText('help.sanction.last.sanction')} {sanctionLocalization('current', sanctionInfo.sanctionName, sanctionInfo.sanctionLengthHours)} + { LocalizeText('help.sanction.last.sanction') } { sanctionLocalization('current', sanctionInfo.sanctionName, sanctionInfo.sanctionLengthHours) }
-
{LocalizeText('generic.start.time')} {sanctionInfo.sanctionCreationTime}
-
{LocalizeText('generic.reason')} {sanctionInfo.sanctionReason}
-
{LocalizeText('help.sanction.probation.days.left')} {Math.trunc((sanctionInfo.probationHoursLeft / 24)) + 1}
+
{ LocalizeText('generic.start.time') } { sanctionInfo.sanctionCreationTime }
+
{ LocalizeText('generic.reason') } { sanctionInfo.sanctionReason }
+
{ LocalizeText('help.sanction.probation.days.left') } { Math.trunc((sanctionInfo.probationHoursLeft / 24)) + 1 }
} { ((sanctionInfo.hasCustomMute) && (!(sanctionInfo.isSanctionActive))) && -
{LocalizeText('help.sanction.custom.mute')}
+
{ LocalizeText('help.sanction.custom.mute') }
} { (sanctionInfo.tradeLockExpiryTime && sanctionInfo.tradeLockExpiryTime.length > 0) && -
{LocalizeText('trade.locked.until')} {sanctionInfo.tradeLockExpiryTime}
+
{ LocalizeText('trade.locked.until') } { sanctionInfo.tradeLockExpiryTime }
} -
{sanctionLocalization('next', sanctionInfo.nextSanctionName, sanctionInfo.nextSanctionLengthHours)}
- +
{ sanctionLocalization('next', sanctionInfo.nextSanctionName, sanctionInfo.nextSanctionLengthHours) }
+
diff --git a/src/components/hotel-view/HotelView.tsx b/src/components/hotel-view/HotelView.tsx index c821eaa1..561bfa94 100644 --- a/src/components/hotel-view/HotelView.tsx +++ b/src/components/hotel-view/HotelView.tsx @@ -97,11 +97,11 @@ export const HotelView: FC<{}> = props =>
- {GetConfiguration('hotelview')['show.avatar'] && ( + { GetConfiguration('hotelview')['show.avatar'] && (
- )} + ) }
); } diff --git a/src/components/hotel-view/views/widgets/bonus-rare/BonusRareWidgetView.tsx b/src/components/hotel-view/views/widgets/bonus-rare/BonusRareWidgetView.tsx index cf11987f..bc3c2b15 100644 --- a/src/components/hotel-view/views/widgets/bonus-rare/BonusRareWidgetView.tsx +++ b/src/components/hotel-view/views/widgets/bonus-rare/BonusRareWidgetView.tsx @@ -36,7 +36,7 @@ export const BonusRareWidgetView: FC = props =>
{ productType }
-
{(totalCoinsForBonus - coinsStillRequiredToBuy) + '/' + totalCoinsForBonus}
+
{ (totalCoinsForBonus - coinsStillRequiredToBuy) + '/' + totalCoinsForBonus }
diff --git a/src/components/hotel-view/views/widgets/hall-of-fame-item/HallOfFameItemView.tsx b/src/components/hotel-view/views/widgets/hall-of-fame-item/HallOfFameItemView.tsx index bd5bda1f..b4237f51 100644 --- a/src/components/hotel-view/views/widgets/hall-of-fame-item/HallOfFameItemView.tsx +++ b/src/components/hotel-view/views/widgets/hall-of-fame-item/HallOfFameItemView.tsx @@ -19,7 +19,7 @@ export const HallOfFameItemView: FC = props =>
{ level }. { data.userName }
-
{ LocalizeText('landing.view.competition.hof.points', [ 'points' ], [ LocalizeFormattedNumber(data.currentScore).toString() ])}
+
{ LocalizeText('landing.view.competition.hof.points', [ 'points' ], [ LocalizeFormattedNumber(data.currentScore).toString() ]) }
diff --git a/src/components/hotel-view/views/widgets/hall-of-fame/HallOfFameWidgetView.tsx b/src/components/hotel-view/views/widgets/hall-of-fame/HallOfFameWidgetView.tsx index 2abee5a6..621570f5 100644 --- a/src/components/hotel-view/views/widgets/hall-of-fame/HallOfFameWidgetView.tsx +++ b/src/components/hotel-view/views/widgets/hall-of-fame/HallOfFameWidgetView.tsx @@ -33,7 +33,7 @@ export const HallOfFameWidgetView: FC = props => { return ; } - )} + ) }
); } diff --git a/src/components/hotel-view/views/widgets/promo-article/PromoArticleWidgetView.tsx b/src/components/hotel-view/views/widgets/promo-article/PromoArticleWidgetView.tsx index 522e5eb5..49850939 100644 --- a/src/components/hotel-view/views/widgets/promo-article/PromoArticleWidgetView.tsx +++ b/src/components/hotel-view/views/widgets/promo-article/PromoArticleWidgetView.tsx @@ -30,15 +30,15 @@ export const PromoArticleWidgetView: FC<{}> = props =>
- {articles && (articles.length > 0) && articles.map((article, ind) => + { articles && (articles.length > 0) && articles.map((article, ind) =>
setIndex(ind) } /> - )} + ) }
- {articles && articles[index] && + { articles && articles[index] &&
-

{articles[index].title}

+

{ articles[index].title }

{ articles[index].bodyText }
diff --git a/src/components/hotel-view/views/widgets/widget-container/WidgetContainerView.tsx b/src/components/hotel-view/views/widgets/widget-container/WidgetContainerView.tsx index d6a096f7..5e583562 100644 --- a/src/components/hotel-view/views/widgets/widget-container/WidgetContainerView.tsx +++ b/src/components/hotel-view/views/widgets/widget-container/WidgetContainerView.tsx @@ -29,7 +29,7 @@ export const WidgetContainerView: FC = props =>
-

{LocalizeText(`landing.view.${ getOption('texts') }.header`)}

+

{ LocalizeText(`landing.view.${ getOption('texts') }.header`) }

{ LocalizeText(`landing.view.${ getOption('texts') }.body`) }
diff --git a/src/components/loading/LoadingView.tsx b/src/components/loading/LoadingView.tsx index de643af4..a803e9aa 100644 --- a/src/components/loading/LoadingView.tsx +++ b/src/components/loading/LoadingView.tsx @@ -27,7 +27,7 @@ export const LoadingView: FC = props => { isError && (message && message.length) ? - {message} + { message } : <> { percent.toFixed() }% diff --git a/src/components/mod-tools/views/tickets/CfhChatlogView.tsx b/src/components/mod-tools/views/tickets/CfhChatlogView.tsx index 16ced18c..c2229914 100644 --- a/src/components/mod-tools/views/tickets/CfhChatlogView.tsx +++ b/src/components/mod-tools/views/tickets/CfhChatlogView.tsx @@ -36,7 +36,7 @@ export const CfhChatlogView: FC = props => - { chatlogData && } + { chatlogData && } ); diff --git a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx index 5d8f1bf3..91d1f57a 100644 --- a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx +++ b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx @@ -155,7 +155,7 @@ export const ModToolsUserModActionView: FC = pro handleChange('moderation_kick', (event.target.checked ? 0 : 2)) } /> { LocalizeText('navigator.roomsettings.moderation.all') } @@ -91,7 +91,7 @@ export const NavigatorRoomSettingsModTabView: FC - {LocalizeText('navigator.roomsettings.moderation.ban.header')} + { LocalizeText('navigator.roomsettings.moderation.ban.header') } handleChange('moderation_ban', (event.target.checked ? 1 : 0)) } /> { LocalizeText('navigator.roomsettings.moderation.rights') } diff --git a/src/components/navigator/views/room-settings/NavigatorRoomSettingsVipChatTabView.tsx b/src/components/navigator/views/room-settings/NavigatorRoomSettingsVipChatTabView.tsx index e77f6691..5975e24d 100644 --- a/src/components/navigator/views/room-settings/NavigatorRoomSettingsVipChatTabView.tsx +++ b/src/components/navigator/views/room-settings/NavigatorRoomSettingsVipChatTabView.tsx @@ -22,13 +22,13 @@ export const NavigatorRoomSettingsVipChatTabView: FC - {LocalizeText('navigator.roomsettings.vip.caption')} - {LocalizeText('navigator.roomsettings.vip.info')} + { LocalizeText('navigator.roomsettings.vip.caption') } + { LocalizeText('navigator.roomsettings.vip.info') } - {LocalizeText('navigator.roomsettings.chat_settings')} - {LocalizeText('navigator.roomsettings.chat_settings.info')} + { LocalizeText('navigator.roomsettings.chat_settings') } + { LocalizeText('navigator.roomsettings.chat_settings.info') } handleChange('hide_walls', event.target.checked) } /> - {LocalizeText('navigator.roomsettings.hide_walls')} + { LocalizeText('navigator.roomsettings.hide_walls') } updateChatInput(event.target.value) } onMouseDown={ event => setInputFocus() } /> } { floodBlocked && - { LocalizeText('chat.input.alert.flood', [ 'time' ], [ floodBlockedSeconds.toString() ]) } } + { LocalizeText('chat.input.alert.flood', [ 'time' ], [ floodBlockedSeconds.toString() ]) } }
, document.getElementById('toolbar-chat-input-container')) diff --git a/src/components/room/widgets/chat/ChatWidgetView.tsx b/src/components/room/widgets/chat/ChatWidgetView.tsx index 7da4c033..55ec7559 100644 --- a/src/components/room/widgets/chat/ChatWidgetView.tsx +++ b/src/components/room/widgets/chat/ChatWidgetView.tsx @@ -236,7 +236,7 @@ export const ChatWidgetView: FC<{}> = props => return (
- {chatMessages.map(chat => )} + { chatMessages.map(chat => ) }
); } diff --git a/src/components/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx b/src/components/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx index 646b12bd..77c70570 100644 --- a/src/components/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx +++ b/src/components/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx @@ -95,7 +95,7 @@ export const FurnitureHighScoreView: FC<{}> = props => ); - })} + }) } diff --git a/src/components/room/widgets/furniture/stickie/FurnitureStickieView.tsx b/src/components/room/widgets/furniture/stickie/FurnitureStickieView.tsx index 0905edee..6e28f260 100644 --- a/src/components/room/widgets/furniture/stickie/FurnitureStickieView.tsx +++ b/src/components/room/widgets/furniture/stickie/FurnitureStickieView.tsx @@ -121,7 +121,7 @@ export const FurnitureStickieView: FC<{}> = props => { STICKIE_COLORS.map(color => { return
processAction('changeColor', color) } style={ { backgroundColor: ColorUtils.makeColorHex(color) } } /> - })} + }) } }
processAction('close') }>
diff --git a/src/components/room/widgets/furniture/youtube-tv/FurnitureYoutubeDisplayView.tsx b/src/components/room/widgets/furniture/youtube-tv/FurnitureYoutubeDisplayView.tsx index c272fe0a..2a005287 100644 --- a/src/components/room/widgets/furniture/youtube-tv/FurnitureYoutubeDisplayView.tsx +++ b/src/components/room/widgets/furniture/youtube-tv/FurnitureYoutubeDisplayView.tsx @@ -208,11 +208,11 @@ export const FurnitureYoutubeDisplayView: FC<{}> = props =>
- {(videoId && videoId.length > 0) && + { (videoId && videoId.length > 0) && } - {(!videoId || videoId.length === 0) && -
{LocalizeText('widget.furni.video_viewer.no_videos')}
+ { (!videoId || videoId.length === 0) && +
{ LocalizeText('widget.furni.video_viewer.no_videos') }
}
@@ -220,16 +220,16 @@ export const FurnitureYoutubeDisplayView: FC<{}> = props => processAction('playlist_prev') } /> processAction('playlist_next') } /> -
{LocalizeText('widget.furni.video_viewer.playlists')}
+
{ LocalizeText('widget.furni.video_viewer.playlists') }
- {playlists && playlists.map((entry, index) => + { playlists && playlists.map((entry, index) => { return ( processAction(entry.video) } itemActive={ entry.video === selectedItem }> - {entry.title} - {entry.description} + { entry.title } - { entry.description } ) - })} + }) }
diff --git a/src/components/room/widgets/infostand/InfoStandWidgetFurniView.tsx b/src/components/room/widgets/infostand/InfoStandWidgetFurniView.tsx index a5d7af12..3e20c33d 100644 --- a/src/components/room/widgets/infostand/InfoStandWidgetFurniView.tsx +++ b/src/components/room/widgets/infostand/InfoStandWidgetFurniView.tsx @@ -369,7 +369,7 @@ export const InfoStandWidgetFurniView: FC = props { canUse && } + } { ((furniKeys.length > 0 && furniValues.length > 0) && (furniKeys.length === furniValues.length)) &&