From 5bd351c3dc97432ce3800324a2b336c76ee5d243 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 18 Jun 2024 18:58:45 -0400 Subject: [PATCH] Fix eslint issues --- .editorconfig | 14 +- .eslintrc.json | 121 -- .vscode/settings.json | 22 +- css-utils/CSSColorUtils.js | 2 - eslint.config.mjs | 138 ++ package.json | 93 +- prettier.config.js | 7 - src/App.tsx | 129 +- src/api/achievements/AchievementUtilities.ts | 46 +- src/api/avatar/AvatarEditorColorSorter.ts | 2 +- src/api/avatar/AvatarEditorPartSorter.ts | 4 +- .../avatar/AvatarEditorThumbnailsHelper.ts | 8 +- src/api/camera/CameraPicture.ts | 2 +- src/api/camera/CameraPictureThumbnail.ts | 2 +- src/api/catalog/CatalogNode.ts | 2 +- src/api/catalog/CatalogPageName.ts | 2 +- src/api/catalog/CatalogPetPalette.ts | 2 +- src/api/catalog/CatalogUtilities.ts | 12 +- src/api/catalog/GetImageIconUrlForProduct.ts | 2 +- src/api/catalog/ICatalogNode.ts | 2 +- src/api/catalog/MarketplaceOfferState.ts | 2 +- src/api/catalog/Offer.ts | 4 +- src/api/catalog/PageLocalization.ts | 2 +- src/api/catalog/PlacedObjectPurchaseData.ts | 2 +- src/api/catalog/RequestedPage.ts | 2 +- src/api/catalog/SearchResult.ts | 2 +- .../chat-history/ChatHistoryCurrentDate.ts | 2 +- .../MessengerHistoryCurrentDate.ts | 4 +- src/api/friends/GetGroupChatData.ts | 4 +- src/api/friends/MessengerSettings.ts | 2 +- src/api/friends/MessengerThread.ts | 2 +- src/api/groups/GroupBadgePart.ts | 2 +- src/api/groups/GroupType.ts | 2 +- src/api/groups/ToggleFavoriteGroup.ts | 2 +- src/api/guide-tool/GuideToolMessage.ts | 2 +- src/api/hc-center/ClubStatus.ts | 2 +- src/api/hc-center/GetClubBadge.ts | 2 +- src/api/help/GetCloseReasonKey.ts | 2 +- src/api/inventory/FurnitureItem.ts | 2 +- src/api/inventory/FurnitureUtilities.ts | 12 +- src/api/inventory/InventoryUtilities.ts | 10 +- src/api/inventory/PetUtilities.ts | 12 +- src/api/inventory/TradeUserData.ts | 2 +- src/api/inventory/TradingUtilities.ts | 20 +- src/api/mod-tools/GetIssueCategoryName.ts | 2 +- src/api/navigator/RoomSettingsUtils.ts | 2 +- src/api/nitro/GetConfigurationValue.ts | 2 +- src/api/nitro/OpenUrl.ts | 4 +- src/api/nitro/room/DispatchMouseEvent.ts | 4 +- src/api/nitro/room/DispatchTouchEvent.ts | 8 +- src/api/nitro/room/GetRoomObjectBounds.ts | 2 +- .../nitro/room/GetRoomObjectScreenLocation.ts | 2 +- .../InitializeRoomInstanceRenderingCanvas.ts | 2 +- src/api/nitro/session/GetCanStandUp.ts | 4 +- src/api/nitro/session/GetCanUseExpression.ts | 2 +- src/api/nitro/session/GetClubMemberLevel.ts | 2 +- .../GetFurnitureDataForProductOffer.ts | 4 +- src/api/nitro/session/GetOwnPosture.ts | 4 +- src/api/nitro/session/IsRidingHorse.ts | 4 +- src/api/nitro/session/VisitDesktop.ts | 2 +- .../notification/NotificationBubbleType.ts | 2 +- src/api/room/widgets/AvatarInfoUser.ts | 2 +- src/api/room/widgets/AvatarInfoUtilities.ts | 6 +- src/api/room/widgets/ChatBubbleMessage.ts | 4 +- src/api/room/widgets/ChatBubbleUtilities.ts | 2 +- .../DimmerFurnitureWidgetPresetItem.ts | 2 +- src/api/room/widgets/DoChatsOverlap.ts | 3 +- src/api/room/widgets/GetDiskColor.ts | 6 +- src/api/room/widgets/MannequinUtilities.ts | 4 +- .../widgets/YoutubeVideoPlaybackStateEnum.ts | 2 +- src/api/utils/CloneObject.ts | 2 +- src/api/utils/ColorUtils.ts | 2 +- src/api/utils/ConvertSeconds.ts | 2 +- src/api/utils/GetLocalStorage.ts | 6 +- src/api/utils/LocalizeBadgeDescription.ts | 2 +- src/api/utils/LocalizeBageName.ts | 2 +- src/api/utils/PlaySound.ts | 4 +- src/api/utils/RoomChatFormatter.ts | 4 +- src/api/wired/GetWiredTimeLocale.ts | 2 +- src/common/AutoGrid.tsx | 4 +- src/common/Base.tsx | 32 +- src/common/Button.tsx | 34 +- src/common/Column.tsx | 12 +- src/common/Flex.tsx | 20 +- src/common/FormGroup.tsx | 2 +- src/common/Grid.tsx | 24 +- src/common/GridContext.tsx | 4 +- src/common/HorizontalRule.tsx | 2 +- src/common/InfiniteScroll.tsx | 2 +- src/common/Popover.tsx | 62 +- src/common/Text.tsx | 30 +- src/common/card/NitroCardContentView.tsx | 4 +- src/common/card/NitroCardContext.tsx | 4 +- src/common/card/NitroCardHeaderView.tsx | 4 +- src/common/card/NitroCardView.tsx | 4 +- .../accordion/NitroCardAccordionContext.tsx | 2 +- .../accordion/NitroCardAccordionItemView.tsx | 2 +- .../accordion/NitroCardAccordionSetView.tsx | 10 +- .../card/accordion/NitroCardAccordionView.tsx | 4 +- .../card/tabs/NitroCardTabsItemView.tsx | 4 +- src/common/card/tabs/NitroCardTabsView.tsx | 4 +- .../draggable-window/DraggableWindow.tsx | 14 +- src/common/layout/LayoutAvatarImageView.tsx | 28 +- src/common/layout/LayoutBackgroundImage.tsx | 2 +- src/common/layout/LayoutBadgeImageView.tsx | 24 +- src/common/layout/LayoutCounterTimeView.tsx | 2 +- src/common/layout/LayoutCurrencyIcon.tsx | 8 +- .../layout/LayoutFurniIconImageView.tsx | 2 +- src/common/layout/LayoutFurniImageView.tsx | 2 +- src/common/layout/LayoutGridItem.tsx | 24 +- src/common/layout/LayoutImage.tsx | 2 +- src/common/layout/LayoutItemCountView.tsx | 4 +- .../layout/LayoutLoadingSpinnerView.tsx | 4 +- src/common/layout/LayoutMiniCameraView.tsx | 6 +- .../layout/LayoutNotificationAlertView.tsx | 4 +- .../layout/LayoutNotificationBubbleView.tsx | 6 +- src/common/layout/LayoutPetImageView.tsx | 4 +- .../layout/LayoutPrizeProductImageView.tsx | 8 +- src/common/layout/LayoutProgressBar.tsx | 4 +- src/common/layout/LayoutRarityLevelView.tsx | 2 +- .../layout/LayoutRoomObjectImageView.tsx | 2 +- src/common/layout/LayoutRoomPreviewerView.tsx | 14 +- src/common/layout/LayoutRoomThumbnailView.tsx | 6 +- src/common/layout/LayoutTrophyView.tsx | 2 +- src/common/layout/UserProfileIconView.tsx | 4 +- .../LayoutLimitedEditionCompactPlateView.tsx | 2 +- .../LayoutLimitedEditionCompletePlateView.tsx | 4 +- .../LayoutLimitedEditionStyledNumberView.tsx | 4 +- .../transitions/TransitionAnimation.tsx | 4 +- .../transitions/TransitionAnimationStyles.ts | 64 +- src/common/utils/CreateTransitionToIcon.ts | 2 +- src/common/utils/FriendlyTimeView.tsx | 2 +- src/components/MainView.tsx | 8 +- .../achievements/AchievementsView.tsx | 134 +- .../views/AchievementBadgeView.tsx | 2 +- .../views/AchievementCategoryView.tsx | 27 +- .../views/AchievementDetailsView.tsx | 6 +- .../AchievementListItemView.tsx | 2 +- .../achievement-list/AchievementListView.tsx | 2 +- .../AchievementsCategoryListItemView.tsx | 2 +- .../AvatarEditorFigurePreviewView.tsx | 8 +- .../avatar-editor/AvatarEditorIcon.tsx | 2 +- .../avatar-editor/AvatarEditorModelView.tsx | 8 +- .../avatar-editor/AvatarEditorView.tsx | 14 +- .../AvatarEditorWardrobeView.tsx | 6 +- .../AvatarEditorFigureSetItemView.tsx | 6 +- .../figure-set/AvatarEditorFigureSetView.tsx | 10 +- .../AvatarEditorPaletteSetItemView.tsx | 4 +- .../AvatarEditorPaletteSetView.tsx | 10 +- src/components/camera/CameraWidgetView.tsx | 18 +- .../camera/views/CameraWidgetCaptureView.tsx | 12 +- .../camera/views/CameraWidgetCheckoutView.tsx | 14 +- .../views/CameraWidgetShowPhotoView.tsx | 12 +- .../views/editor/CameraWidgetEditorView.tsx | 30 +- .../CameraWidgetEffectListItemView.tsx | 2 +- .../CameraWidgetEffectListView.tsx | 4 +- src/components/campaign/CalendarItemView.tsx | 6 +- src/components/campaign/CalendarView.tsx | 38 +- src/components/campaign/CampaignView.tsx | 22 +- src/components/catalog/CatalogView.tsx | 16 +- .../views/CatalogPurchaseConfirmView.tsx | 2 +- .../catalog-header/CatalogHeaderView.tsx | 4 +- .../views/catalog-icon/CatalogIconView.tsx | 2 +- .../CatalogRoomPreviewerView.tsx | 6 +- .../catalog/views/gift/CatalogGiftView.tsx | 42 +- .../navigation/CatalogNavigationItemView.tsx | 2 +- .../navigation/CatalogNavigationSetView.tsx | 8 +- .../navigation/CatalogNavigationView.tsx | 2 +- .../page/common/CatalogGridOfferView.tsx | 4 +- .../page/common/CatalogRedeemVoucherView.tsx | 8 +- .../views/page/common/CatalogSearchView.tsx | 26 +- .../layout/CatalogLayoutBadgeDisplayView.tsx | 2 +- .../layout/CatalogLayoutColorGroupingView.tsx | 38 +- .../page/layout/CatalogLayoutDefaultView.tsx | 2 +- .../CatalogLayoutGuildCustomFurniView.tsx | 2 +- .../layout/CatalogLayoutGuildForumView.tsx | 2 +- .../CatalogLayoutGuildFrontpageView.tsx | 4 +- .../layout/CatalogLayoutInfoLoyaltyView.tsx | 2 +- .../page/layout/CatalogLayoutPets2View.tsx | 4 +- .../page/layout/CatalogLayoutPets3View.tsx | 2 +- .../page/layout/CatalogLayoutRoomAdsView.tsx | 10 +- .../layout/CatalogLayoutRoomBundleView.tsx | 2 +- .../layout/CatalogLayoutSingleBundleView.tsx | 2 +- .../layout/CatalogLayoutSoundMachineView.tsx | 12 +- .../page/layout/CatalogLayoutSpacesView.tsx | 2 +- .../page/layout/CatalogLayoutTrophiesView.tsx | 4 +- .../page/layout/CatalogLayoutVipBuyView.tsx | 4 +- .../views/page/layout/GetCatalogLayout.tsx | 4 +- .../CatalogLayoutFrontPageItemView.tsx | 2 +- .../CatalogLayoutFrontpage4View.tsx | 2 +- .../CatalogLayoutMarketplaceItemView.tsx | 6 +- .../CatalogLayoutMarketplaceOwnItemsView.tsx | 10 +- ...atalogLayoutMarketplacePublicItemsView.tsx | 16 +- ...CatalogLayoutMarketplaceSearchFormView.tsx | 12 +- .../marketplace/MarketplacePostOfferView.tsx | 22 +- .../page/layout/pets/CatalogLayoutPetView.tsx | 50 +- .../vip-gifts/CatalogLayoutVipGiftsView.tsx | 16 +- .../page/layout/vip-gifts/VipGiftItemView.tsx | 8 +- .../widgets/CatalogAddOnBadgeWidgetView.tsx | 2 +- .../CatalogBadgeSelectorWidgetView.tsx | 4 +- .../widgets/CatalogBundleGridWidgetView.tsx | 2 +- .../CatalogFirstProductSelectorWidgetView.tsx | 2 +- .../widgets/CatalogGuildBadgeWidgetView.tsx | 2 +- .../CatalogGuildSelectorWidgetView.tsx | 10 +- .../widgets/CatalogItemGridWidgetView.tsx | 10 +- .../widgets/CatalogLimitedItemWidgetView.tsx | 4 +- .../widgets/CatalogPriceDisplayWidgetView.tsx | 2 +- .../widgets/CatalogPurchaseWidgetView.tsx | 10 +- .../widgets/CatalogSimplePriceWidgetView.tsx | 2 +- .../widgets/CatalogSingleViewWidgetView.tsx | 2 +- .../page/widgets/CatalogSpacesWidgetView.tsx | 24 +- .../page/widgets/CatalogSpinnerWidgetView.tsx | 10 +- .../page/widgets/CatalogTotalPriceWidget.tsx | 2 +- .../widgets/CatalogViewProductWidgetView.tsx | 6 +- .../views/targeted-offer/OfferBubbleView.tsx | 4 +- .../views/targeted-offer/OfferView.tsx | 18 +- .../views/targeted-offer/OfferWindowView.tsx | 18 +- .../chat-history/ChatHistoryView.tsx | 16 +- .../floorplan-editor/FloorplanEditorView.tsx | 10 +- .../common/FloorplanEditor.ts | 12 +- .../floorplan-editor/common/Utils.ts | 10 +- .../views/FloorplanCanvasView.tsx | 26 +- .../views/FloorplanImportExportView.tsx | 12 +- .../views/FloorplanOptionsView.tsx | 32 +- src/components/friends/FriendsView.tsx | 2 +- .../views/friends-bar/FriendBarItemView.tsx | 10 +- .../views/friends-bar/FriendsBarView.tsx | 2 +- .../friends-list/FriendsListSearchView.tsx | 10 +- .../views/friends-list/FriendsListView.tsx | 14 +- .../FriendsListGroupItemView.tsx | 16 +- .../FriendsListGroupView.tsx | 4 +- .../FriendsListRequestItemView.tsx | 2 +- .../FriendsListRequestView.tsx | 2 +- .../views/messenger/FriendsMessengerView.tsx | 30 +- .../FriendsMessengerThreadGroup.tsx | 12 +- .../FriendsMessengerThreadView.tsx | 2 +- src/components/game-center/GameCenterView.tsx | 16 +- .../game-center/views/GameListView.tsx | 18 +- .../game-center/views/GameStageView.tsx | 20 +- src/components/game-center/views/GameView.tsx | 32 +- src/components/groups/GroupsView.tsx | 8 +- .../groups/views/GroupBadgeCreatorView.tsx | 12 +- .../groups/views/GroupCreatorView.tsx | 28 +- .../groups/views/GroupInformationView.tsx | 38 +- .../groups/views/GroupManagerView.tsx | 6 +- .../groups/views/GroupMembersView.tsx | 36 +- .../groups/views/GroupRoomInformationView.tsx | 34 +- .../groups/views/tabs/GroupTabBadgeView.tsx | 12 +- .../groups/views/tabs/GroupTabColorsView.tsx | 22 +- .../tabs/GroupTabCreatorConfirmationView.tsx | 10 +- .../views/tabs/GroupTabIdentityView.tsx | 172 +- .../views/tabs/GroupTabSettingsView.tsx | 2 +- src/components/guide-tool/GuideToolView.tsx | 4 +- .../guide-tool/views/GuideToolAcceptView.tsx | 2 +- .../guide-tool/views/GuideToolMenuView.tsx | 2 +- .../guide-tool/views/GuideToolOngoingView.tsx | 4 +- .../views/GuideToolUserCreateRequestView.tsx | 2 +- src/components/hc-center/HcCenterView.tsx | 24 +- src/components/help/HelpView.tsx | 12 +- .../help/views/DescribeReportView.tsx | 8 +- src/components/help/views/HelpIndexView.tsx | 6 +- .../help/views/ReportSummaryView.tsx | 6 +- .../help/views/SanctionStatusView.tsx | 12 +- .../help/views/SelectReportedChatsView.tsx | 8 +- .../help/views/SelectReportedUserView.tsx | 8 +- src/components/help/views/SelectTopicView.tsx | 6 +- .../NameChangeConfirmationView.tsx | 10 +- .../views/name-change/NameChangeInitView.tsx | 2 +- .../views/name-change/NameChangeInputView.tsx | 12 +- .../help/views/name-change/NameChangeView.tsx | 8 +- src/components/hotel-view/HotelView.tsx | 6 +- .../views/widgets/GetWidgetLayout.tsx | 4 +- .../views/widgets/WidgetSlotView.tsx | 4 +- .../bonus-rare/BonusRareWidgetView.tsx | 4 +- .../hall-of-fame-item/HallOfFameItemView.tsx | 2 +- .../hall-of-fame/HallOfFameWidgetView.tsx | 4 +- .../promo-article/PromoArticleWidgetView.tsx | 4 +- .../widget-container/WidgetContainerView.tsx | 8 +- src/components/inventory/InventoryView.tsx | 12 +- .../views/InventoryCategoryEmptyView.tsx | 4 +- .../views/badge/InventoryBadgeItemView.tsx | 2 +- .../views/badge/InventoryBadgeView.tsx | 6 +- .../views/bot/InventoryBotItemView.tsx | 4 +- .../inventory/views/bot/InventoryBotView.tsx | 10 +- .../furniture/InventoryFurnitureItemView.tsx | 6 +- .../InventoryFurnitureSearchView.tsx | 2 +- .../furniture/InventoryFurnitureView.tsx | 26 +- .../views/furniture/InventoryTradeView.tsx | 64 +- .../views/pet/InventoryPetItemView.tsx | 4 +- .../inventory/views/pet/InventoryPetView.tsx | 10 +- src/components/loading/LoadingView.tsx | 6 +- src/components/mod-tools/ModToolsView.tsx | 16 +- .../mod-tools/views/chatlog/ChatlogView.tsx | 4 +- .../views/room/ModToolsChatlogView.tsx | 2 +- .../mod-tools/views/room/ModToolsRoomView.tsx | 16 +- .../views/tickets/CfhChatlogView.tsx | 6 +- .../views/tickets/ModToolsIssueInfoView.tsx | 12 +- .../views/tickets/ModToolsMyIssuesTabView.tsx | 2 +- .../tickets/ModToolsOpenIssuesTabView.tsx | 2 +- .../tickets/ModToolsPickedIssuesTabView.tsx | 2 +- .../views/tickets/ModToolsTicketsView.tsx | 10 +- .../views/user/ModToolsUserChatlogView.tsx | 4 +- .../views/user/ModToolsUserModActionView.tsx | 38 +- .../views/user/ModToolsUserRoomVisitsView.tsx | 6 +- .../user/ModToolsUserSendMessageView.tsx | 8 +- .../mod-tools/views/user/ModToolsUserView.tsx | 6 +- src/components/navigator/NavigatorView.tsx | 36 +- .../views/NavigatorDoorStateView.tsx | 18 +- .../views/NavigatorRoomCreatorView.tsx | 18 +- .../navigator/views/NavigatorRoomInfoView.tsx | 6 +- .../navigator/views/NavigatorRoomLinkView.tsx | 2 +- .../NavigatorRoomSettingsAccessTabView.tsx | 4 +- .../NavigatorRoomSettingsBasicTabView.tsx | 24 +- .../NavigatorRoomSettingsModTabView.tsx | 6 +- .../NavigatorRoomSettingsRightsTabView.tsx | 4 +- .../NavigatorRoomSettingsView.tsx | 6 +- .../NavigatorRoomSettingsVipChatTabView.tsx | 2 +- .../NavigatorSearchResultItemInfoView.tsx | 10 +- .../search/NavigatorSearchResultItemView.tsx | 20 +- .../search/NavigatorSearchResultView.tsx | 22 +- .../views/search/NavigatorSearchView.tsx | 6 +- src/components/nitropedia/NitropediaView.tsx | 12 +- .../NotificationCenterView.tsx | 2 +- .../views/alert-layouts/GetAlertLayout.tsx | 8 +- .../alert-layouts/NitroSystemAlertView.tsx | 2 +- .../NotificationDefaultAlertView.tsx | 10 +- .../NotificationSearchAlertView.tsx | 8 +- .../views/bubble-layouts/GetBubbleLayout.tsx | 6 +- .../NotificationClubGiftBubbleView.tsx | 2 +- .../NotificationDefaultBubbleView.tsx | 2 +- .../confirm-layouts/GetConfirmLayout.tsx | 4 +- .../NotificationDefaultConfirmView.tsx | 8 +- src/components/purse/PurseView.tsx | 22 +- src/components/purse/views/CurrencyView.tsx | 4 +- src/components/purse/views/SeasonalView.tsx | 2 +- src/components/right-side/RightSideView.tsx | 2 +- src/components/room/RoomView.tsx | 38 +- .../room/widgets/RoomWidgetsView.tsx | 2 +- .../AvatarInfoPetTrainingPanelView.tsx | 6 +- .../AvatarInfoRentableBotChatView.tsx | 6 +- .../AvatarInfoUseProductConfirmView.tsx | 54 +- .../avatar-info/AvatarInfoUseProductView.tsx | 8 +- .../avatar-info/AvatarInfoWidgetView.tsx | 42 +- .../infostand/InfoStandWidgetBotView.tsx | 4 +- .../infostand/InfoStandWidgetFurniView.tsx | 74 +- .../infostand/InfoStandWidgetPetView.tsx | 16 +- .../InfoStandWidgetRentableBotView.tsx | 8 +- ...nfoStandWidgetUserRelationshipItemView.tsx | 2 +- .../InfoStandWidgetUserRelationshipsView.tsx | 2 +- .../infostand/InfoStandWidgetUserTagsView.tsx | 4 +- .../infostand/InfoStandWidgetUserView.tsx | 26 +- .../menu/AvatarInfoWidgetAvatarView.tsx | 4 +- .../menu/AvatarInfoWidgetDecorateView.tsx | 6 +- .../menu/AvatarInfoWidgetFurniView.tsx | 4 +- .../menu/AvatarInfoWidgetNameView.tsx | 2 +- .../menu/AvatarInfoWidgetOwnAvatarView.tsx | 12 +- .../menu/AvatarInfoWidgetOwnPetView.tsx | 4 +- .../menu/AvatarInfoWidgetPetView.tsx | 4 +- .../menu/AvatarInfoWidgetRentableBotView.tsx | 16 +- .../chat-input/ChatInputStyleSelectorView.tsx | 10 +- .../room/widgets/chat-input/ChatInputView.tsx | 58 +- .../widgets/chat/ChatWidgetMessageView.tsx | 38 +- .../room/widgets/chat/ChatWidgetView.tsx | 36 +- .../widgets/choosers/ChooserWidgetView.tsx | 4 +- .../choosers/FurniChooserWidgetView.tsx | 4 +- .../choosers/UserChooserWidgetView.tsx | 4 +- .../context-menu/ContextMenuCaretView.tsx | 4 +- .../context-menu/ContextMenuHeaderView.tsx | 4 +- .../context-menu/ContextMenuListItemView.tsx | 12 +- .../context-menu/ContextMenuListView.tsx | 4 +- .../widgets/context-menu/ContextMenuView.tsx | 36 +- .../widgets/doorbell/DoorbellWidgetView.tsx | 4 +- .../FriendRequestDialogView.tsx | 2 +- .../FriendRequestWidgetView.tsx | 2 +- .../FurnitureBackgroundColorView.tsx | 4 +- .../furniture/FurnitureBadgeDisplayView.tsx | 2 +- .../furniture/FurnitureCraftingView.tsx | 14 +- .../widgets/furniture/FurnitureDimmerView.tsx | 8 +- .../furniture/FurnitureExchangeCreditView.tsx | 4 +- .../furniture/FurnitureExternalImageView.tsx | 2 +- .../furniture/FurnitureFriendFurniView.tsx | 8 +- .../furniture/FurnitureGiftOpeningView.tsx | 4 +- .../furniture/FurnitureHighScoreView.tsx | 4 +- .../furniture/FurnitureInternalLinkView.tsx | 2 +- .../furniture/FurnitureMannequinView.tsx | 14 +- .../FurnitureMysteryBoxOpenDialogView.tsx | 4 +- .../FurnitureMysteryTrophyOpenDialogView.tsx | 6 +- .../furniture/FurnitureRoomLinkView.tsx | 2 +- .../furniture/FurnitureSpamWallPostItView.tsx | 10 +- .../furniture/FurnitureStackHeightView.tsx | 4 +- .../furniture/FurnitureStickieView.tsx | 14 +- .../widgets/furniture/FurnitureTrophyView.tsx | 2 +- .../furniture/FurnitureWidgetsView.tsx | 2 +- .../furniture/FurnitureYoutubeDisplayView.tsx | 28 +- .../context-menu/EffectBoxConfirmView.tsx | 4 +- .../context-menu/FurnitureContextMenuView.tsx | 4 +- .../MonsterPlantSeedConfirmView.tsx | 14 +- .../PurchasableClothingConfirmView.tsx | 18 +- .../playlist-editor/DiskInventoryView.tsx | 24 +- .../FurniturePlaylistEditorWidgetView.tsx | 4 +- .../playlist-editor/SongPlaylistView.tsx | 12 +- .../mysterybox/MysteryBoxExtensionView.tsx | 8 +- .../object-location/ObjectLocationView.tsx | 8 +- .../pet-package/PetPackageWidgetView.tsx | 2 +- .../RoomFilterWordsWidgetView.tsx | 14 +- .../room-promotes/RoomPromotesWidgetView.tsx | 2 +- .../views/RoomPromoteEditWidgetView.tsx | 2 +- .../views/RoomPromoteMyOwnEventWidgetView.tsx | 2 +- .../RoomThumbnailWidgetView.tsx | 6 +- .../room-tools/RoomToolsWidgetView.tsx | 16 +- .../user-location/UserLocationView.tsx | 2 +- .../word-quiz/WordQuizQuestionView.tsx | 2 +- .../widgets/word-quiz/WordQuizVoteView.tsx | 2 +- .../widgets/word-quiz/WordQuizWidgetView.tsx | 2 +- src/components/toolbar/ToolbarMeView.tsx | 4 +- src/components/toolbar/ToolbarView.tsx | 12 +- .../user-profile/UserProfileView.tsx | 28 +- .../views/BadgesContainerView.tsx | 2 +- .../views/FriendsContainerView.tsx | 6 +- .../views/GroupsContainerView.tsx | 14 +- .../views/RelationshipsContainerView.tsx | 4 +- .../user-profile/views/UserContainerView.tsx | 8 +- .../user-settings/UserSettingsView.tsx | 22 +- src/components/wired/WiredView.tsx | 4 +- src/components/wired/views/WiredBaseView.tsx | 8 +- .../wired/views/WiredFurniSelectorView.tsx | 4 +- .../views/actions/WiredActionBaseView.tsx | 2 +- .../WiredActionBotChangeFigureView.tsx | 6 +- .../WiredActionBotFollowAvatarView.tsx | 4 +- .../WiredActionBotGiveHandItemView.tsx | 4 +- .../views/actions/WiredActionBotMoveView.tsx | 2 +- .../WiredActionBotTalkToAvatarView.tsx | 8 +- .../views/actions/WiredActionBotTalkView.tsx | 8 +- .../actions/WiredActionBotTeleportView.tsx | 2 +- .../WiredActionCallAnotherStackView.tsx | 2 +- .../views/actions/WiredActionChaseView.tsx | 2 +- .../views/actions/WiredActionChatView.tsx | 2 +- .../views/actions/WiredActionFleeView.tsx | 2 +- .../actions/WiredActionGiveRewardView.tsx | 26 +- ...redActionGiveScoreToPredefinedTeamView.tsx | 2 +- .../actions/WiredActionGiveScoreView.tsx | 2 +- .../views/actions/WiredActionJoinTeamView.tsx | 4 +- .../actions/WiredActionKickFromRoomView.tsx | 2 +- .../views/actions/WiredActionLayoutView.tsx | 2 +- .../actions/WiredActionLeaveTeamView.tsx | 2 +- .../WiredActionMoveAndRotateFurniView.tsx | 6 +- .../actions/WiredActionMoveFurniToView.tsx | 4 +- .../actions/WiredActionMoveFurniView.tsx | 8 +- .../views/actions/WiredActionMuteUserView.tsx | 4 +- .../views/actions/WiredActionResetView.tsx | 2 +- .../WiredActionSetFurniStateToView.tsx | 2 +- .../views/actions/WiredActionTeleportView.tsx | 2 +- .../WiredActionToggleFurniStateView.tsx | 2 +- .../WiredConditionActorHasHandItem.tsx | 4 +- .../WiredConditionActorIsGroupMemberView.tsx | 2 +- .../WiredConditionActorIsOnFurniView.tsx | 2 +- .../WiredConditionActorIsTeamMemberView.tsx | 6 +- .../WiredConditionActorIsWearingBadgeView.tsx | 2 +- ...WiredConditionActorIsWearingEffectView.tsx | 2 +- .../conditions/WiredConditionBaseView.tsx | 4 +- .../WiredConditionDateRangeView.tsx | 12 +- .../WiredConditionFurniHasAvatarOnView.tsx | 2 +- .../WiredConditionFurniHasFurniOnView.tsx | 6 +- .../WiredConditionFurniHasNotFurniOnView.tsx | 6 +- .../WiredConditionFurniIsOfTypeView.tsx | 2 +- ...WiredConditionFurniMatchesSnapshotView.tsx | 4 +- .../conditions/WiredConditionLayoutView.tsx | 2 +- .../WiredConditionTimeElapsedLessView.tsx | 4 +- .../WiredConditionTimeElapsedMoreView.tsx | 4 +- .../WiredConditionUserCountInRoomView.tsx | 4 +- .../WiredTriggerAvatarEnterRoomView.tsx | 2 +- .../WiredTriggerAvatarSaysSomethingView.tsx | 4 +- .../WiredTriggerAvatarWalksOffFurniView.tsx | 2 +- .../WiredTriggerAvatarWalksOnFurni.tsx | 2 +- .../views/triggers/WiredTriggerBaseView.tsx | 4 +- .../WiredTriggerBotReachedAvatarView.tsx | 2 +- .../WiredTriggerBotReachedStuffView.tsx | 2 +- .../triggers/WiredTriggerCollisionView.tsx | 2 +- .../triggers/WiredTriggerExecuteOnceView.tsx | 2 +- ...iredTriggerExecutePeriodicallyLongView.tsx | 2 +- .../WiredTriggerExecutePeriodicallyView.tsx | 2 +- .../triggers/WiredTriggerGameEndsView.tsx | 2 +- .../triggers/WiredTriggerGameStartsView.tsx | 2 +- .../views/triggers/WiredTriggerLayoutView.tsx | 2 +- .../WiredTriggerScoreAchievedView.tsx | 2 +- .../triggers/WiredTriggerToggleFurniView.tsx | 2 +- .../CatalogPostMarketplaceOfferEvent.ts | 2 +- src/hooks/UseMountEffect.tsx | 7 - src/hooks/achievements/useAchievements.ts | 4 +- src/hooks/avatar-editor/useAvatarEditor.ts | 26 +- src/hooks/avatar-editor/useFigureData.ts | 16 +- src/hooks/camera/useCamera.ts | 4 +- src/hooks/catalog/useCatalog.ts | 12 +- src/hooks/chat-history/useChatHistory.ts | 10 +- src/hooks/events/useEventDispatcher.tsx | 4 +- src/hooks/events/useMessageEvent.tsx | 19 +- src/hooks/events/useNitroEvent.tsx | 6 +- src/hooks/friends/useFriends.ts | 16 +- src/hooks/friends/useMessenger.ts | 90 +- src/hooks/game-center/useGameCenter.ts | 24 +- src/hooks/groups/useGroup.ts | 4 +- src/hooks/help/useHelp.ts | 6 +- src/hooks/index.ts | 1 - src/hooks/inventory/useInventoryBadges.ts | 12 +- src/hooks/inventory/useInventoryBots.ts | 4 +- src/hooks/inventory/useInventoryFurni.ts | 22 +- src/hooks/inventory/useInventoryPets.ts | 4 +- src/hooks/inventory/useInventoryTrade.ts | 14 +- .../inventory/useInventoryUnseenTracker.ts | 2 +- src/hooks/mod-tools/useModTools.ts | 32 +- src/hooks/navigator/useNavigator.ts | 6 +- src/hooks/notification/useNotification.ts | 20 +- src/hooks/purse/usePurse.ts | 12 +- src/hooks/rooms/engine/useFurniAddedEvent.ts | 4 +- .../rooms/engine/useFurniRemovedEvent.ts | 4 +- .../rooms/engine/useObjectDeselectedEvent.ts | 2 +- .../engine/useObjectDoubleClickedEvent.ts | 2 +- .../rooms/engine/useObjectRollOutEvent.ts | 2 +- .../rooms/engine/useObjectRollOverEvent.ts | 2 +- .../rooms/engine/useObjectSelectedEvent.ts | 2 +- src/hooks/rooms/engine/useUserAddedEvent.ts | 4 +- src/hooks/rooms/engine/useUserRemovedEvent.ts | 4 +- src/hooks/rooms/promotes/useRoomPromote.ts | 4 +- src/hooks/rooms/useRoom.ts | 79 +- .../useFurnitureBackgroundColorWidget.ts | 8 +- .../useFurnitureBadgeDisplayWidget.ts | 6 +- .../useFurnitureContextMenuWidget.ts | 8 +- .../furniture/useFurnitureCraftingWidget.ts | 16 +- .../furniture/useFurnitureDimmerWidget.ts | 10 +- .../furniture/useFurnitureExchangeWidget.ts | 6 +- .../useFurnitureExternalImageWidget.ts | 8 +- .../useFurnitureFriendFurniWidget.ts | 8 +- .../furniture/useFurnitureHighScoreWidget.ts | 4 +- .../useFurnitureInternalLinkWidget.ts | 4 +- .../furniture/useFurnitureMannequinWidget.ts | 10 +- .../useFurniturePlaylistEditorWidget.ts | 10 +- .../furniture/useFurniturePresentWidget.ts | 12 +- .../furniture/useFurnitureRoomLinkWidget.ts | 4 +- .../useFurnitureSpamWallPostItWidget.ts | 6 +- .../useFurnitureStackHeightWidget.ts | 6 +- .../furniture/useFurnitureStickieWidget.ts | 8 +- .../furniture/useFurnitureTrophyWidget.ts | 4 +- .../furniture/useFurnitureYoutubeWidget.ts | 8 +- .../rooms/widgets/useAvatarInfoWidget.ts | 16 +- src/hooks/rooms/widgets/useChatInputWidget.ts | 20 +- src/hooks/rooms/widgets/useChatWidget.ts | 28 +- src/hooks/rooms/widgets/useDoorbellWidget.ts | 8 +- .../rooms/widgets/useFilterWordsWidget.ts | 2 +- .../rooms/widgets/useFriendRequestWidget.ts | 6 +- .../rooms/widgets/useFurniChooserWidget.ts | 4 +- .../rooms/widgets/usePetPackageWidget.ts | 30 +- src/hooks/rooms/widgets/usePollWidget.ts | 2 +- .../rooms/widgets/useUserChooserWidget.ts | 6 +- src/hooks/rooms/widgets/useWordQuizWidget.ts | 10 +- src/hooks/session/useSessionInfo.ts | 10 +- src/hooks/useLocalStorage.ts | 8 +- src/hooks/useSharedVisibility.ts | 2 +- src/hooks/wired/useWired.ts | 14 +- src/layout/InfiniteGrid.tsx | 24 +- src/layout/NitroButton.tsx | 2 +- src/layout/NitroCard.tsx | 10 +- src/layout/NitroInput.tsx | 2 +- src/layout/NitroItemCountBadge.tsx | 2 +- .../NitroLimitedEditionStyledNumberView.tsx | 4 +- src/layout/styleNames.ts | 2 +- src/workers/IntervalWebWorker.ts | 6 +- tailwind.config.js | 2 - tsconfig.json | 53 +- vite.config.mjs | 1 - yarn.lock | 1411 +++++++---------- 570 files changed, 3584 insertions(+), 3609 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.mjs delete mode 100644 prettier.config.js delete mode 100644 src/hooks/UseMountEffect.tsx diff --git a/.editorconfig b/.editorconfig index a8dfa3ee..07926923 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,16 @@ +# Editor configuration, see https://editorconfig.org +root = true + [*] charset = utf-8 -insert_final_newline = true -end_of_line = lf indent_style = space indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +quote_type = single + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index bd3e3f3a..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "settings": { - "react": { - "pragma": "React", - "version": "18.0.0" - } - }, - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "plugin:react/recommended", - "plugin:react/jsx-runtime", - "plugin:react-hooks/recommended" - ], - "plugins": [ - "@typescript-eslint", - "react" - ], - "rules": { - "linebreak-style": [ - "off" - ], - "quotes": [ - "error", - "single" - ], - "@typescript-eslint/indent": [ - "error", - 4, - { - "SwitchCase": 1 - } - ], - "array-bracket-spacing": [ - "error", - "always" - ], - "brace-style": [ - "error", - "allman" - ], - "template-curly-spacing": [ - "error", - "always" - ], - "no-multi-spaces": [ - "error" - ], - "@typescript-eslint/object-curly-spacing": [ - "error", - "always", - { - "arraysInObjects": true, - "objectsInObjects": false - } - ], - "@typescript-eslint/ban-types": [ - "error", - { - "types": { - "String": true, - "Boolean": true, - "Number": true, - "Symbol": true, - "{}": false, - "Object": false, - "object": false, - "Function": false - }, - "extendDefaults": true - } - ], - "no-switch-case-fall-through": [ - "off" - ], - "jsx-quotes": [ - "error" - ], - "react/prop-types": [ - "off" - ], - "react/jsx-curly-spacing": [ - "error", - { - "when": "always", - "children": true - } - ], - "react/jsx-equals-spacing": [ - "error" - ], - "react/jsx-newline": [ - "error", - { - "prevent": true - } - ], - "react/jsx-sort-props": [ - "error", - { - "callbacksLast": true, - "shorthandFirst": true, - "shorthandLast": false, - "ignoreCase": true, - "noSortAlphabetically": false, - "reservedFirst": true - } - ] - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 53df7a1a..5bbc5505 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,7 @@ "typescript.format.placeOpenBraceOnNewLineForFunctions": true, "editor.wordWrap": "on", "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit", + "source.fixAll.eslint": "always", "source.fixAll.sortJSON": "never", "source.organizeImports": "always" }, @@ -17,10 +17,7 @@ "files.trimFinalNewlines": true, "emmet.showExpandedAbbreviation": "never", "eslint.format.enable": true, - "eslint.validate": [ - "javascript", - "typescript" - ], + "eslint.validate": ["javascript", "typescript"], "eslint.workingDirectories": [ { "pattern": "./src" @@ -34,18 +31,9 @@ "css": "css" }, "tailwindCSS.experimental.classRegex": [ - [ - "classes \\=([^;]*);", - "'([^']*)'" - ], - [ - "classes \\=([^;]*);", - "\"([^\"]*)\"" - ], - [ - "classes \\=([^;]*);", - "\\`([^\\`]*)\\`" - ] + ["classes \\=([^;]*);", "'([^']*)'"], + ["classes \\=([^;]*);", "\"([^\"]*)\""], + ["classes \\=([^;]*);", "\\`([^\\`]*)\\`"] ], "editor.quickSuggestions": { "strings": true diff --git a/css-utils/CSSColorUtils.js b/css-utils/CSSColorUtils.js index a2f32989..77077fc1 100644 --- a/css-utils/CSSColorUtils.js +++ b/css-utils/CSSColorUtils.js @@ -64,8 +64,6 @@ const generateShades = (colors) => } } - console.log(colors) - return colors; } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..108a976b --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,138 @@ +import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin"; +import typescriptEslintParser from "@typescript-eslint/parser"; +import reactPlugin from "eslint-plugin-react"; +import reactHooksPlugin from "eslint-plugin-react-hooks"; +import path from "path"; +import { fileURLToPath } from "url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +export default [ + { + files: ["**/*.jsx", "**/*.js", "**/*.tsx", "**/*.ts"], + plugins: { + react: reactPlugin, + "react-hooks": reactHooksPlugin, + "@typescript-eslint": typescriptEslintPlugin, + }, + languageOptions: { + parser: typescriptEslintParser, + ecmaVersion: "latest", + parserOptions: { + sourceType: "module", + project: "./tsconfig.json", + tsconfigRootDir: __dirname, + ecmaFeatures: { + jsx: true, + }, + }, + }, + rules: { + ...reactPlugin.configs.recommended.rules, + ...reactHooksPlugin.configs.recommended.rules, + ...typescriptEslintPlugin.configs.recommended.rules, + ...typescriptEslintPlugin.configs[ + "recommended-requiring-type-checking" + ].rules, + 'indent': [ + 'error', + 4, + { + 'SwitchCase': 1 + } + ], + 'no-multi-spaces': [ + 'error' + ], + 'no-trailing-spaces': [ + 'error', + { + 'skipBlankLines': false, + 'ignoreComments': true + } + ], + 'linebreak-style': [ + 'off' + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always' + ], + 'brace-style': [ + 'error', + 'allman' + ], + 'object-curly-spacing': [ + 'error', + 'always' + ], + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/require-await': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/explicit-module-boundary-types': [ + 'off', + { + 'allowedNames': [ + 'getMessageArray' + ] + } + ], + '@typescript-eslint/unbound-method': [ + 'off' + ], + '@typescript-eslint/ban-ts-comment': [ + 'off' + ], + '@typescript-eslint/no-empty-function': [ + 'error', + { + 'allow': [ + 'functions', + 'arrowFunctions', + 'generatorFunctions', + 'methods', + 'generatorMethods', + 'constructors' + ] + } + ], + '@typescript-eslint/no-unused-vars': [ + 'off' + ], + '@typescript-eslint/ban-types': [ + 'error', + { + 'types': + { + 'String': true, + 'Boolean': true, + 'Number': true, + 'Symbol': true, + '{}': false, + 'Object': false, + 'object': false, + 'Function': false + }, + 'extendDefaults': true + } + ], + 'react/react-in-jsx-scope': 'off' + }, + settings: { + react: { + version: "18.3.1", + }, + }, + }, +]; diff --git a/package.json b/package.json index 87dcffc1..afc6533c 100644 --- a/package.json +++ b/package.json @@ -1,50 +1,47 @@ { - "name": "nitro-react", - "version": "2.2", - "homepage": ".", - "private": true, - "scripts": { - "start": "vite", - "build": "vite build", - "build:prod": "npx browserslist@latest --update-db && yarn build", - "eslint": "eslint src --ext .ts,.tsx" - }, - "dependencies": { - "@tanstack/react-virtual": "3.2.0", - "@types/react-transition-group": "^4.4.10", - "dompurify": "^3.1.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-icons": "^5.0.1", - "react-slider": "^2.0.6", - "react-tiny-popover": "^8.0.4", - "react-transition-group": "^4.4.5", - "react-youtube": "^7.13.1", - "use-between": "^1.3.5" - }, - "devDependencies": { - "@tailwindcss/forms": "^0.5.7", - "@types/node": "^20.11.30", - "@types/react": "^18.2.67", - "@types/react-dom": "^18.2.22", - "@types/react-slider": "^1.3.6", - "@typescript-eslint/eslint-plugin": "^7.3.1", - "@typescript-eslint/parser": "^7.3.1", - "@vitejs/plugin-react": "^4.2.1", - "autoprefixer": "^10.4.19", - "eslint": "^8.57.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.34.1", - "eslint-plugin-react-hooks": "^4.6.0", - "postcss": "^8.4.38", - "postcss-nested": "^6.0.1", - "prettier": "^3.2.5", - "prettier-plugin-tailwindcss": "^0.5.13", - "sass": "^1.72.0", - "tailwindcss": "^3.4.3", - "typescript": "^5.4.2", - "vite": "^5.1.6", - "vite-tsconfig-paths": "^4.3.2" - } + "name": "nitro-react", + "version": "2.2", + "homepage": ".", + "private": true, + "scripts": { + "start": "vite", + "build": "vite build", + "build:prod": "npx browserslist@latest --update-db && yarn build", + "eslint": "eslint ./src" + }, + "dependencies": { + "@tanstack/react-virtual": "3.2.0", + "@types/react-transition-group": "^4.4.10", + "dompurify": "^3.1.5", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-icons": "^5.2.1", + "react-slider": "^2.0.6", + "react-tiny-popover": "^8.0.4", + "react-transition-group": "^4.4.5", + "react-youtube": "^7.13.1", + "use-between": "^1.3.5" + }, + "devDependencies": { + "@tailwindcss/forms": "^0.5.7", + "@types/node": "^20.11.30", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@types/react-slider": "^1.3.6", + "@typescript-eslint/eslint-plugin": "^7.13.1", + "@typescript-eslint/parser": "^7.13.1", + "@vitejs/plugin-react": "^4.3.1", + "autoprefixer": "^10.4.19", + "eslint": "^9.5.0", + "eslint-plugin-react": "^7.34.2", + "eslint-plugin-react-hooks": "^5.1.0-rc-1434af3d22-20240618", + "postcss": "^8.4.38", + "postcss-nested": "^6.0.1", + "sass": "^1.77.4", + "tailwindcss": "^3.4.4", + "typescript": "^5.4.5", + "typescript-eslint": "^7.13.1", + "vite": "^5.2.13", + "vite-tsconfig-paths": "^4.3.2" + } } diff --git a/prettier.config.js b/prettier.config.js deleted file mode 100644 index ae27533e..00000000 --- a/prettier.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("prettier").Config} */ - -module.exports = { - plugins: [ - 'prettier-plugin-tailwindcss' - ] -} diff --git a/src/App.tsx b/src/App.tsx index 2df4532b..7263ba21 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,25 @@ -import { GetAssetManager, GetAvatarRenderManager, GetCommunication, GetConfiguration, GetLocalizationManager, GetRoomCameraWidgetManager, GetRoomEngine, GetRoomSessionManager, GetSessionDataManager, GetSoundManager, GetStage, GetTexturePool, GetTicker, HabboWebTools, LegacyExternalInterface, LoadGameUrlEvent, NitroLogger, NitroVersion, PrepareRenderer } from '@nitrots/nitro-renderer'; +import +{ + GetAssetManager, + GetAvatarRenderManager, + GetCommunication, + GetConfiguration, + GetLocalizationManager, + GetRoomCameraWidgetManager, + GetRoomEngine, + GetRoomSessionManager, + GetSessionDataManager, + GetSoundManager, + GetStage, + GetTexturePool, + GetTicker, + HabboWebTools, + LegacyExternalInterface, + LoadGameUrlEvent, + NitroLogger, + NitroVersion, + PrepareRenderer, +} from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { GetUIVersion } from './api'; import { MainView } from './components/MainView'; @@ -8,15 +29,15 @@ import { classNames } from './layout'; NitroVersion.UI_VERSION = GetUIVersion(); -export const App: FC<{}> = props => +export const App: FC<{}> = (props) => { - const [ isReady, setIsReady ] = useState(false); + const [isReady, setIsReady] = useState(false); - useMessageEvent(LoadGameUrlEvent, event => + useMessageEvent(LoadGameUrlEvent, (event) => { const parser = event.getParser(); - if (!parser) return; + if(!parser) return; LegacyExternalInterface.callGame('showGame', parser.url); }); @@ -27,78 +48,108 @@ export const App: FC<{}> = props => { try { - if (!window.NitroConfig) throw new Error('NitroConfig is not defined!'); + if(!window.NitroConfig) + throw new Error('NitroConfig is not defined!'); const renderer = await PrepareRenderer({ width, height, + resolution: window.devicePixelRatio, autoDensity: true, backgroundAlpha: 0, preference: 'webgl', eventMode: 'none', - failIfMajorPerformanceCaveat: false + failIfMajorPerformanceCaveat: false, }); await GetConfiguration().init(); - GetTicker().maxFPS = GetConfiguration().getValue('system.fps.max', 24); - NitroLogger.LOG_DEBUG = GetConfiguration().getValue('system.log.debug', true); - NitroLogger.LOG_WARN = GetConfiguration().getValue('system.log.warn', false); - NitroLogger.LOG_ERROR = GetConfiguration().getValue('system.log.error', false); - NitroLogger.LOG_EVENTS = GetConfiguration().getValue('system.log.events', false); - NitroLogger.LOG_PACKETS = GetConfiguration().getValue('system.log.packets', false); - - const assetUrls = GetConfiguration().getValue('preload.assets.urls').map(url => GetConfiguration().interpolate(url)) ?? []; - - await Promise.all( - [ - GetRoomCameraWidgetManager().init(), - GetAssetManager().downloadAssets(assetUrls), - GetLocalizationManager().init(), - GetAvatarRenderManager().init(), - GetSoundManager().init(), - GetSessionDataManager().init(), - GetRoomSessionManager().init(), - GetCommunication().init(), - - ] + GetTicker().maxFPS = GetConfiguration().getValue( + 'system.fps.max', + 24, ); + NitroLogger.LOG_DEBUG = GetConfiguration().getValue( + 'system.log.debug', + true, + ); + NitroLogger.LOG_WARN = GetConfiguration().getValue( + 'system.log.warn', + false, + ); + NitroLogger.LOG_ERROR = GetConfiguration().getValue( + 'system.log.error', + false, + ); + NitroLogger.LOG_EVENTS = GetConfiguration().getValue( + 'system.log.events', + false, + ); + NitroLogger.LOG_PACKETS = GetConfiguration().getValue( + 'system.log.packets', + false, + ); + + const assetUrls = + GetConfiguration() + .getValue('preload.assets.urls') + .map((url) => GetConfiguration().interpolate(url)) ?? + []; + + await Promise.all([ + GetRoomCameraWidgetManager().init(), + GetAssetManager().downloadAssets(assetUrls), + GetLocalizationManager().init(), + GetAvatarRenderManager().init(), + GetSoundManager().init(), + GetSessionDataManager().init(), + GetRoomSessionManager().init(), + GetCommunication().init(), + ]); await GetRoomEngine().init(); // new GameMessageHandler(); - if (LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); + if(LegacyExternalInterface.available) + LegacyExternalInterface.call( + 'legacyTrack', + 'authentication', + 'authok', + [], + ); HabboWebTools.sendHeartBeat(); setInterval(() => HabboWebTools.sendHeartBeat(), 10000); - GetTicker().add(ticker => GetRoomEngine().update(ticker)); - GetTicker().add(ticker => renderer.render(GetStage())); - GetTicker().add(ticker => GetTexturePool().run()); + GetTicker().add((ticker) => GetRoomEngine().update(ticker)); + GetTicker().add((ticker) => renderer.render(GetStage())); + GetTicker().add((ticker) => GetTexturePool().run()); setIsReady(true); // handle socket close //canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST))); } - catch (err) { NitroLogger.error(err); } - } + }; prepare(window.innerWidth, window.innerHeight); }, []); return ( -
- { !isReady && - } - { isReady && } +
+ {!isReady && } + {isReady && }
); -} +}; diff --git a/src/api/achievements/AchievementUtilities.ts b/src/api/achievements/AchievementUtilities.ts index 55180e6e..30f14033 100644 --- a/src/api/achievements/AchievementUtilities.ts +++ b/src/api/achievements/AchievementUtilities.ts @@ -7,91 +7,91 @@ export class AchievementUtilities public static getAchievementBadgeCode(achievement: AchievementData): string { if(!achievement) return null; - + let badgeId = achievement.badgeId; - + if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId); - + return badgeId; } public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string { const imageUrl = GetConfigurationValue('achievements.images.url'); - + let imageName = icon ? 'achicon_' : 'achcategory_'; - + imageName += category.code; - + if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`; - + return imageUrl.replace('%image%', imageName); } public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number { if(!category) return 0; - + let progress = 0; - + for(const achievement of category.achievements) { progress += achievement.levelCount; } - + return progress; } public static getAchievementCategoryProgress(category: IAchievementCategory): number { if(!category) return 0; - + let progress = 0; - + for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1)); - + return progress; } public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number { if(!category) return 0; - + let unseen = 0; - + for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++); - + return unseen; } public static getAchievementHasStarted(achievement: AchievementData): boolean { if(!achievement) return false; - + if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true; - + return false; } public static getAchievementIsIgnored(achievement: AchievementData): boolean { if(!achievement) return false; - + const ignored = GetConfigurationValue('achievements.unseen.ignored'); const value = achievement.badgeId.replace(/[0-9]/g, ''); const index = ignored.indexOf(value); - + if(index >= 0) return true; - + return false; } public static getAchievementLevel(achievement: AchievementData): number { if(!achievement) return 0; - + if(achievement.finalLevel) return achievement.level; - + return (achievement.level - 1); } } diff --git a/src/api/avatar/AvatarEditorColorSorter.ts b/src/api/avatar/AvatarEditorColorSorter.ts index d64057a5..7ae5960b 100644 --- a/src/api/avatar/AvatarEditorColorSorter.ts +++ b/src/api/avatar/AvatarEditorColorSorter.ts @@ -14,4 +14,4 @@ export const AvatarEditorColorSorter = (a: IPartColor, b: IPartColor) => if(a.index > b.index) return 1; return 0; -} +}; diff --git a/src/api/avatar/AvatarEditorPartSorter.ts b/src/api/avatar/AvatarEditorPartSorter.ts index 276108f4..41e98d85 100644 --- a/src/api/avatar/AvatarEditorPartSorter.ts +++ b/src/api/avatar/AvatarEditorPartSorter.ts @@ -31,5 +31,5 @@ export const AvatarEditorPartSorter = (hcFirst: boolean) => if(a.partSet.id > b.partSet.id) return 1; return 0; - } -} + }; +}; diff --git a/src/api/avatar/AvatarEditorThumbnailsHelper.ts b/src/api/avatar/AvatarEditorThumbnailsHelper.ts index 0f2f4e42..88a79063 100644 --- a/src/api/avatar/AvatarEditorThumbnailsHelper.ts +++ b/src/api/avatar/AvatarEditorThumbnailsHelper.ts @@ -108,7 +108,7 @@ export class AvatarEditorThumbnailsHelper } return container; - } + }; return new Promise(async (resolve, reject) => { @@ -120,7 +120,7 @@ export class AvatarEditorThumbnailsHelper AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl); resolve(imageUrl); - } + }; const figureContainer = GetAvatarRenderManager().createFigureContainer(`${ setType }-${ part.partSet.id }`); @@ -168,11 +168,11 @@ export class AvatarEditorThumbnailsHelper sprite.destroy(); avatarImage.dispose(); - + AvatarEditorThumbnailsHelper.THUMBNAIL_CACHE.set(thumbnailKey, imageUrl); resolve(imageUrl); - } + }; resetFigure(figureString); }); diff --git a/src/api/camera/CameraPicture.ts b/src/api/camera/CameraPicture.ts index fe8c2210..020e1ec5 100644 --- a/src/api/camera/CameraPicture.ts +++ b/src/api/camera/CameraPicture.ts @@ -4,6 +4,6 @@ export class CameraPicture { constructor( public texture: NitroTexture, - public imageUrl: string) + public imageUrl: string) {} } diff --git a/src/api/camera/CameraPictureThumbnail.ts b/src/api/camera/CameraPictureThumbnail.ts index cd126607..3e3f7825 100644 --- a/src/api/camera/CameraPictureThumbnail.ts +++ b/src/api/camera/CameraPictureThumbnail.ts @@ -2,6 +2,6 @@ export class CameraPictureThumbnail { constructor( public effectName: string, - public thumbnailUrl: string) + public thumbnailUrl: string) {} } diff --git a/src/api/catalog/CatalogNode.ts b/src/api/catalog/CatalogNode.ts index 893aa323..5e7c2fc3 100644 --- a/src/api/catalog/CatalogNode.ts +++ b/src/api/catalog/CatalogNode.ts @@ -1,7 +1,7 @@ import { NodeData } from '@nitrots/nitro-renderer'; import { ICatalogNode } from './ICatalogNode'; -export class CatalogNode implements ICatalogNode +export class CatalogNode implements ICatalogNode { private _depth: number = 0; private _localization: string = ''; diff --git a/src/api/catalog/CatalogPageName.ts b/src/api/catalog/CatalogPageName.ts index 8e4c7b64..ed217d87 100644 --- a/src/api/catalog/CatalogPageName.ts +++ b/src/api/catalog/CatalogPageName.ts @@ -1,4 +1,4 @@ -export class CatalogPageName +export class CatalogPageName { public static DUCKET_INFO: string = 'ducket_info'; public static CREDITS: string = 'credits'; diff --git a/src/api/catalog/CatalogPetPalette.ts b/src/api/catalog/CatalogPetPalette.ts index d92c40dd..3b3c1344 100644 --- a/src/api/catalog/CatalogPetPalette.ts +++ b/src/api/catalog/CatalogPetPalette.ts @@ -5,6 +5,6 @@ export class CatalogPetPalette constructor( public readonly breed: string, public readonly palettes: SellablePetPaletteData[] - ) + ) {} } diff --git a/src/api/catalog/CatalogUtilities.ts b/src/api/catalog/CatalogUtilities.ts index 7aff6a8a..c2e1d5eb 100644 --- a/src/api/catalog/CatalogUtilities.ts +++ b/src/api/catalog/CatalogUtilities.ts @@ -4,12 +4,12 @@ import { ICatalogNode } from './ICatalogNode'; export const GetPixelEffectIcon = (id: number) => { return ''; -} +}; export const GetSubscriptionProductIcon = (id: number) => { return ''; -} +}; export const GetOfferNodes = (offerNodes: Map, offerId: number) => { @@ -21,20 +21,20 @@ export const GetOfferNodes = (offerNodes: Map, offerId: for(const node of nodes) { if(!node.isVisible) continue; - + allowedNodes.push(node); } } return allowedNodes; -} +}; export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) => { if(node.isVisible && (node.pageId > 0)) { let nodeAdded = false; - + const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, ''); if(hayStack.indexOf(search) > -1) @@ -59,7 +59,7 @@ export const FilterCatalogNode = (search: string, furniLines: string[], node: IC } for(const child of node.children) FilterCatalogNode(search, furniLines, child, nodes); -} +}; export function GetPetIndexFromLocalization(localization: string) { diff --git a/src/api/catalog/GetImageIconUrlForProduct.ts b/src/api/catalog/GetImageIconUrlForProduct.ts index 8c363e7c..f0d195da 100644 --- a/src/api/catalog/GetImageIconUrlForProduct.ts +++ b/src/api/catalog/GetImageIconUrlForProduct.ts @@ -16,4 +16,4 @@ export const GetImageIconUrlForProduct = (productType: string, productClassId: n } return imageUrl; -} +}; diff --git a/src/api/catalog/ICatalogNode.ts b/src/api/catalog/ICatalogNode.ts index c69f5a65..6253a750 100644 --- a/src/api/catalog/ICatalogNode.ts +++ b/src/api/catalog/ICatalogNode.ts @@ -1,4 +1,4 @@ -export interface ICatalogNode +export interface ICatalogNode { activate(): void; deactivate(): void; diff --git a/src/api/catalog/MarketplaceOfferState.ts b/src/api/catalog/MarketplaceOfferState.ts index 20c0e45b..6267a5f6 100644 --- a/src/api/catalog/MarketplaceOfferState.ts +++ b/src/api/catalog/MarketplaceOfferState.ts @@ -1,4 +1,4 @@ -export class MarketPlaceOfferState +export class MarketPlaceOfferState { public static readonly ONGOING = 1; public static readonly ONGOING_OWN = 1; diff --git a/src/api/catalog/Offer.ts b/src/api/catalog/Offer.ts index c14d6ac1..9182c03e 100644 --- a/src/api/catalog/Offer.ts +++ b/src/api/catalog/Offer.ts @@ -60,7 +60,7 @@ export class Offer implements IPurchasableOffer public activate(): void { - + } public get clubLevel(): number @@ -228,7 +228,7 @@ export class Offer implements IPurchasableOffer { const products: IProduct[] = []; const productData = GetProductDataForLocalization(this.localizationId); - + for(const product of this._products) { const furnitureData = GetFurnitureData(product.productClassId, product.productType); diff --git a/src/api/catalog/PageLocalization.ts b/src/api/catalog/PageLocalization.ts index d4339235..f24ae872 100644 --- a/src/api/catalog/PageLocalization.ts +++ b/src/api/catalog/PageLocalization.ts @@ -4,7 +4,7 @@ import { IPageLocalization } from './IPageLocalization'; export class PageLocalization implements IPageLocalization { private _images: string[]; - private _texts: string[] + private _texts: string[]; constructor(images: string[], texts: string[]) { diff --git a/src/api/catalog/PlacedObjectPurchaseData.ts b/src/api/catalog/PlacedObjectPurchaseData.ts index 84bad8cd..43d23e3c 100644 --- a/src/api/catalog/PlacedObjectPurchaseData.ts +++ b/src/api/catalog/PlacedObjectPurchaseData.ts @@ -11,7 +11,7 @@ export class PlacedObjectPurchaseData public readonly x: number, public readonly y: number, public readonly direction: number, - public readonly offer: IPurchasableOffer) + public readonly offer: IPurchasableOffer) {} public get offerId(): number diff --git a/src/api/catalog/RequestedPage.ts b/src/api/catalog/RequestedPage.ts index 8c227309..205cc3e2 100644 --- a/src/api/catalog/RequestedPage.ts +++ b/src/api/catalog/RequestedPage.ts @@ -1,4 +1,4 @@ -export class RequestedPage +export class RequestedPage { public static REQUEST_TYPE_NONE: number = 0; public static REQUEST_TYPE_ID: number = 1; diff --git a/src/api/catalog/SearchResult.ts b/src/api/catalog/SearchResult.ts index 419f3cf4..120aed4b 100644 --- a/src/api/catalog/SearchResult.ts +++ b/src/api/catalog/SearchResult.ts @@ -6,6 +6,6 @@ export class SearchResult constructor( public readonly searchValue: string, public readonly offers: IPurchasableOffer[], - public readonly filteredNodes: ICatalogNode[]) + public readonly filteredNodes: ICatalogNode[]) {} } diff --git a/src/api/chat-history/ChatHistoryCurrentDate.ts b/src/api/chat-history/ChatHistoryCurrentDate.ts index 6947bca4..35d6143f 100644 --- a/src/api/chat-history/ChatHistoryCurrentDate.ts +++ b/src/api/chat-history/ChatHistoryCurrentDate.ts @@ -3,4 +3,4 @@ export const ChatHistoryCurrentDate = () => const currentTime = new Date(); return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`; -} +}; diff --git a/src/api/chat-history/MessengerHistoryCurrentDate.ts b/src/api/chat-history/MessengerHistoryCurrentDate.ts index 3aeebc50..b5f79725 100644 --- a/src/api/chat-history/MessengerHistoryCurrentDate.ts +++ b/src/api/chat-history/MessengerHistoryCurrentDate.ts @@ -1,6 +1,6 @@ export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) => { const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date(); - + return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`; -} +}; diff --git a/src/api/friends/GetGroupChatData.ts b/src/api/friends/GetGroupChatData.ts index 75df9629..d1a2c7b9 100644 --- a/src/api/friends/GetGroupChatData.ts +++ b/src/api/friends/GetGroupChatData.ts @@ -3,11 +3,11 @@ import { IGroupChatData } from './IGroupChatData'; export const GetGroupChatData = (extraData: string) => { if(!extraData || !extraData.length) return null; - + const splitData = extraData.split('/'); const username = splitData[0]; const figure = splitData[1]; const userId = parseInt(splitData[2]); return ({ username: username, figure: figure, userId: userId } as IGroupChatData); -} +}; diff --git a/src/api/friends/MessengerSettings.ts b/src/api/friends/MessengerSettings.ts index e0fc8c24..e890fcc0 100644 --- a/src/api/friends/MessengerSettings.ts +++ b/src/api/friends/MessengerSettings.ts @@ -6,6 +6,6 @@ export class MessengerSettings public userFriendLimit: number = 0, public normalFriendLimit: number = 0, public extendedFriendLimit: number = 0, - public categories: FriendCategoryData[] = []) + public categories: FriendCategoryData[] = []) {} } diff --git a/src/api/friends/MessengerThread.ts b/src/api/friends/MessengerThread.ts index 405ea338..30e931c4 100644 --- a/src/api/friends/MessengerThread.ts +++ b/src/api/friends/MessengerThread.ts @@ -40,7 +40,7 @@ export class MessengerThread group.addChat(chat); this._lastUpdated = new Date(); - + this._unreadCount++; return chat; diff --git a/src/api/groups/GroupBadgePart.ts b/src/api/groups/GroupBadgePart.ts index 09c137cf..bb6f5e70 100644 --- a/src/api/groups/GroupBadgePart.ts +++ b/src/api/groups/GroupBadgePart.ts @@ -19,7 +19,7 @@ export class GroupBadgePart public get code(): string { if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null; - + return GroupBadgePart.getCode(this.type, this.key, this.color, this.position); } diff --git a/src/api/groups/GroupType.ts b/src/api/groups/GroupType.ts index 58ae72c6..744c6c6d 100644 --- a/src/api/groups/GroupType.ts +++ b/src/api/groups/GroupType.ts @@ -1,4 +1,4 @@ -export class GroupType +export class GroupType { public static REGULAR: number = 0; public static EXCLUSIVE: number = 1; diff --git a/src/api/groups/ToggleFavoriteGroup.ts b/src/api/groups/ToggleFavoriteGroup.ts index 572e05d7..82385d4f 100644 --- a/src/api/groups/ToggleFavoriteGroup.ts +++ b/src/api/groups/ToggleFavoriteGroup.ts @@ -4,4 +4,4 @@ import { SendMessageComposer } from '../nitro'; export const ToggleFavoriteGroup = (group: HabboGroupEntryData) => { SendMessageComposer(group.favourite ? new GroupUnfavoriteComposer(group.groupId) : new GroupFavoriteComposer(group.groupId)); -} +}; diff --git a/src/api/guide-tool/GuideToolMessage.ts b/src/api/guide-tool/GuideToolMessage.ts index 38107266..3ed87be5 100644 --- a/src/api/guide-tool/GuideToolMessage.ts +++ b/src/api/guide-tool/GuideToolMessage.ts @@ -2,7 +2,7 @@ export class GuideToolMessage { private _message: string; private _roomId: number; - + constructor(message: string, roomId?: number) { this._message = message; diff --git a/src/api/hc-center/ClubStatus.ts b/src/api/hc-center/ClubStatus.ts index 8200b148..e3cba000 100644 --- a/src/api/hc-center/ClubStatus.ts +++ b/src/api/hc-center/ClubStatus.ts @@ -1,4 +1,4 @@ -export class ClubStatus +export class ClubStatus { public static ACTIVE: string = 'active'; public static NONE: string = 'none'; diff --git a/src/api/hc-center/GetClubBadge.ts b/src/api/hc-center/GetClubBadge.ts index 6b779e0f..79cf9790 100644 --- a/src/api/hc-center/GetClubBadge.ts +++ b/src/api/hc-center/GetClubBadge.ts @@ -8,4 +8,4 @@ export const GetClubBadge = (badgeCodes: string[]) => BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge))); return (badgeCode || DEFAULT_BADGE); -} +}; diff --git a/src/api/help/GetCloseReasonKey.ts b/src/api/help/GetCloseReasonKey.ts index 520d14fd..8658492f 100644 --- a/src/api/help/GetCloseReasonKey.ts +++ b/src/api/help/GetCloseReasonKey.ts @@ -5,4 +5,4 @@ export const GetCloseReasonKey = (code: number) => if(code === 2) return 'abusive'; return 'resolved'; -} +}; diff --git a/src/api/inventory/FurnitureItem.ts b/src/api/inventory/FurnitureItem.ts index f5f2f0fa..655d1d37 100644 --- a/src/api/inventory/FurnitureItem.ts +++ b/src/api/inventory/FurnitureItem.ts @@ -29,7 +29,7 @@ export class FurnitureItem implements IFurnitureItem constructor(parser: IFurnitureItemData) { if(!parser) return; - + this._locked = false; this._id = parser.itemId; this._type = parser.spriteId; diff --git a/src/api/inventory/FurnitureUtilities.ts b/src/api/inventory/FurnitureUtilities.ts index 1c12803a..93b9765e 100644 --- a/src/api/inventory/FurnitureUtilities.ts +++ b/src/api/inventory/FurnitureUtilities.ts @@ -35,7 +35,7 @@ const addSingleFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: b } return groupItem; -} +}; const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) => { @@ -85,7 +85,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen const index = set.indexOf(existingGroup); if(index >= 0) set.splice(index, 1); - + set.unshift(existingGroup); } @@ -108,7 +108,7 @@ const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen } return existingGroup; -} +}; export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) => { @@ -120,7 +120,7 @@ export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: { addGroupableFurnitureItem(set, item, unseen); } -} +}; export const mergeFurniFragments = (fragment: Map, totalFragments: number, fragmentNumber: number, fragments: Map[]) => { @@ -145,7 +145,7 @@ export const mergeFurniFragments = (fragment: Map { @@ -168,4 +168,4 @@ export const getAllItemIds = (groupItems: GroupItem[]) => } return itemIds; -} +}; diff --git a/src/api/inventory/InventoryUtilities.ts b/src/api/inventory/InventoryUtilities.ts index c383e079..ac28cbdb 100644 --- a/src/api/inventory/InventoryUtilities.ts +++ b/src/api/inventory/InventoryUtilities.ts @@ -19,12 +19,12 @@ export const setPlacingItemId = (id: number) => (itemIdInPlacing = id); export const cancelRoomObjectPlacement = () => { if(getPlacingItemId() === -1) return; - + GetRoomEngine().cancelRoomObjectPlacement(); setPlacingItemId(-1); setObjectMoverRequested(false); -} +}; export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) => { @@ -47,7 +47,7 @@ export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) => } return true; -} +}; export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false) => { @@ -92,7 +92,7 @@ export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false } return true; -} +}; export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) => @@ -114,4 +114,4 @@ export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) => } return true; -} +}; diff --git a/src/api/inventory/PetUtilities.ts b/src/api/inventory/PetUtilities.ts index bee286af..c53ada2c 100644 --- a/src/api/inventory/PetUtilities.ts +++ b/src/api/inventory/PetUtilities.ts @@ -12,7 +12,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool if(unseen) { //petItem.isUnseen = true; - + set.unshift(petItem); } else @@ -21,7 +21,7 @@ export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: bool } return petItem; -} +}; export const removePetItemById = (id: number, set: IPetItem[]) => { @@ -39,7 +39,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) => CreateLinkEvent('inventory/open'); } - + set.splice(index, 1); return petItem; @@ -49,7 +49,7 @@ export const removePetItemById = (id: number, set: IPetItem[]) => } return null; -} +}; export const processPetFragment = (set: IPetItem[], fragment: Map, isUnseen: (category: number, itemId: number) => boolean) => { @@ -75,7 +75,7 @@ export const processPetFragment = (set: IPetItem[], fragment: Map, totalFragments: number, fragmentNumber: number, fragments: Map[]) => { @@ -100,4 +100,4 @@ export const mergePetFragments = (fragment: Map, totalFragments fragments = null; return merged; -} +}; diff --git a/src/api/inventory/TradeUserData.ts b/src/api/inventory/TradeUserData.ts index 452c7ee5..ba3d66bc 100644 --- a/src/api/inventory/TradeUserData.ts +++ b/src/api/inventory/TradeUserData.ts @@ -10,6 +10,6 @@ export class TradeUserData public itemCount: number = 0, public creditsCount: number = 0, public accepts: boolean = false, - public canTrade: boolean = false) + public canTrade: boolean = false) {} } diff --git a/src/api/inventory/TradingUtilities.ts b/src/api/inventory/TradingUtilities.ts index cd18fbae..8cdfb96b 100644 --- a/src/api/inventory/TradingUtilities.ts +++ b/src/api/inventory/TradingUtilities.ts @@ -17,39 +17,39 @@ export const parseTradeItems = (items: ItemDataStructure[]) => { const spriteId = item.spriteId; const category = item.category; - + let name = (item.furniType + spriteId); - + if(!item.isGroupable || isExternalImage(spriteId)) { name = ('itemid' + item.itemId); } - + if(item.category === FurniCategory.POSTER) { name = (item.itemId + 'poster' + item.stuffData.getLegacyString()); } - + else if(item.category === FurniCategory.GUILD_FURNI) { name = ''; } - + let groupItem = ((item.isGroupable && !isExternalImage(item.spriteId)) ? existingItems.getValue(name) : null); - + if(!groupItem) { groupItem = createGroupItem(spriteId, category, item.stuffData); - + existingItems.add(name, groupItem); } - + groupItem.push(new FurnitureItem(item)); } } return existingItems; -} +}; export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) => { @@ -67,4 +67,4 @@ export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) => } return type; -} +}; diff --git a/src/api/mod-tools/GetIssueCategoryName.ts b/src/api/mod-tools/GetIssueCategoryName.ts index 81a3f862..ce2b902b 100644 --- a/src/api/mod-tools/GetIssueCategoryName.ts +++ b/src/api/mod-tools/GetIssueCategoryName.ts @@ -32,4 +32,4 @@ export const GetIssueCategoryName = (categoryId: number) => } return 'Unknown'; -} +}; diff --git a/src/api/navigator/RoomSettingsUtils.ts b/src/api/navigator/RoomSettingsUtils.ts index bc611dad..36f636f2 100644 --- a/src/api/navigator/RoomSettingsUtils.ts +++ b/src/api/navigator/RoomSettingsUtils.ts @@ -5,6 +5,6 @@ const BuildMaxVisitorsList = () => for(let i = 10; i <= 100; i = i + 10) list.push(i); return list; -} +}; export const GetMaxVisitorsList = BuildMaxVisitorsList(); diff --git a/src/api/nitro/GetConfigurationValue.ts b/src/api/nitro/GetConfigurationValue.ts index 4438444a..755ca1d0 100644 --- a/src/api/nitro/GetConfigurationValue.ts +++ b/src/api/nitro/GetConfigurationValue.ts @@ -1,6 +1,6 @@ import { GetConfiguration } from '@nitrots/nitro-renderer'; -export function GetConfigurationValue(key: string, value: T = null): T +export function GetConfigurationValue(key: string, value: T = null): T { return GetConfiguration().getValue(key, value); } diff --git a/src/api/nitro/OpenUrl.ts b/src/api/nitro/OpenUrl.ts index 0329c00d..44992e8a 100644 --- a/src/api/nitro/OpenUrl.ts +++ b/src/api/nitro/OpenUrl.ts @@ -3,7 +3,7 @@ import { CreateLinkEvent, HabboWebTools } from '@nitrots/nitro-renderer'; export const OpenUrl = (url: string) => { if(!url || !url.length) return; - + if(url.startsWith('http')) { HabboWebTools.openWebPage(url); @@ -12,4 +12,4 @@ export const OpenUrl = (url: string) => { CreateLinkEvent(url); } -} +}; diff --git a/src/api/nitro/room/DispatchMouseEvent.ts b/src/api/nitro/room/DispatchMouseEvent.ts index c28e5e45..ccbe0bcd 100644 --- a/src/api/nitro/room/DispatchMouseEvent.ts +++ b/src/api/nitro/room/DispatchMouseEvent.ts @@ -49,6 +49,6 @@ export const DispatchMouseEvent = (event: MouseEvent, canvasId: number = 1) => break; default: return; } - + GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false); -} +}; diff --git a/src/api/nitro/room/DispatchTouchEvent.ts b/src/api/nitro/room/DispatchTouchEvent.ts index 0f31bdc2..7a909972 100644 --- a/src/api/nitro/room/DispatchTouchEvent.ts +++ b/src/api/nitro/room/DispatchTouchEvent.ts @@ -20,7 +20,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long x = event.changedTouches[0].clientX; y = event.changedTouches[0].clientY; } - + let eventType = event.type; if(longTouch) eventType = TouchEventType.TOUCH_LONG; @@ -53,7 +53,7 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long break; case MouseEventType.DOUBLE_CLICK: break; - case TouchEventType.TOUCH_START: + case TouchEventType.TOUCH_START: eventType = MouseEventType.MOUSE_DOWN; didMouseMove = false; @@ -72,10 +72,10 @@ export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, long default: return; } - if (eventType === TouchEventType.TOUCH_START) + if(eventType === TouchEventType.TOUCH_START) { GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false); } GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, altKey, ctrlKey, shiftKey, false); -} +}; diff --git a/src/api/nitro/room/GetRoomObjectBounds.ts b/src/api/nitro/room/GetRoomObjectBounds.ts index e32fd25f..dca0338f 100644 --- a/src/api/nitro/room/GetRoomObjectBounds.ts +++ b/src/api/nitro/room/GetRoomObjectBounds.ts @@ -10,4 +10,4 @@ export const GetRoomObjectBounds = (roomId: number, objectId: number, category: rectangle.y = Math.round(rectangle.y); return rectangle; -} +}; diff --git a/src/api/nitro/room/GetRoomObjectScreenLocation.ts b/src/api/nitro/room/GetRoomObjectScreenLocation.ts index 58cbc922..41526094 100644 --- a/src/api/nitro/room/GetRoomObjectScreenLocation.ts +++ b/src/api/nitro/room/GetRoomObjectScreenLocation.ts @@ -10,4 +10,4 @@ export const GetRoomObjectScreenLocation = (roomId: number, objectId: number, ca point.y = Math.round(point.y); return point; -} +}; diff --git a/src/api/nitro/room/InitializeRoomInstanceRenderingCanvas.ts b/src/api/nitro/room/InitializeRoomInstanceRenderingCanvas.ts index 4f3eae51..1289b5ef 100644 --- a/src/api/nitro/room/InitializeRoomInstanceRenderingCanvas.ts +++ b/src/api/nitro/room/InitializeRoomInstanceRenderingCanvas.ts @@ -6,4 +6,4 @@ export const InitializeRoomInstanceRenderingCanvas = (width: number, height: num const roomId = roomEngine.activeRoomId; roomEngine.initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height); -} +}; diff --git a/src/api/nitro/session/GetCanStandUp.ts b/src/api/nitro/session/GetCanStandUp.ts index 4915d183..841ada94 100644 --- a/src/api/nitro/session/GetCanStandUp.ts +++ b/src/api/nitro/session/GetCanStandUp.ts @@ -6,8 +6,8 @@ export function GetCanStandUp(): string const roomObject = GetOwnRoomObject(); if(!roomObject) return AvatarAction.POSTURE_STAND; - + const model = roomObject.model; - + return model.getValue(RoomObjectVariable.FIGURE_CAN_STAND_UP); } diff --git a/src/api/nitro/session/GetCanUseExpression.ts b/src/api/nitro/session/GetCanUseExpression.ts index c7c73676..da27f6a8 100644 --- a/src/api/nitro/session/GetCanUseExpression.ts +++ b/src/api/nitro/session/GetCanUseExpression.ts @@ -6,7 +6,7 @@ export function GetCanUseExpression(): boolean const roomObject = GetOwnRoomObject(); if(!roomObject) return false; - + const model = roomObject.model; const effectId = model.getValue(RoomObjectVariable.FIGURE_EFFECT); diff --git a/src/api/nitro/session/GetClubMemberLevel.ts b/src/api/nitro/session/GetClubMemberLevel.ts index 97d4949a..d3cdc379 100644 --- a/src/api/nitro/session/GetClubMemberLevel.ts +++ b/src/api/nitro/session/GetClubMemberLevel.ts @@ -4,6 +4,6 @@ import { GetConfigurationValue } from '../GetConfigurationValue'; export function GetClubMemberLevel(): number { if(GetConfigurationValue('hc.disabled', false)) return HabboClubLevelEnum.VIP; - + return GetSessionDataManager().clubLevel; } diff --git a/src/api/nitro/session/GetFurnitureDataForProductOffer.ts b/src/api/nitro/session/GetFurnitureDataForProductOffer.ts index 95a62568..9bfd214b 100644 --- a/src/api/nitro/session/GetFurnitureDataForProductOffer.ts +++ b/src/api/nitro/session/GetFurnitureDataForProductOffer.ts @@ -2,11 +2,11 @@ import { CatalogPageMessageProductData, FurnitureType, GetSessionDataManager, IF export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProductData): IFurnitureData { - if(!offer) return null; + if (!offer) return null; let furniData: IFurnitureData = null; - switch((offer.productType.toUpperCase())) + switch ((offer.productType.toUpperCase()) as FurnitureType) { case FurnitureType.FLOOR: furniData = GetSessionDataManager().getFloorItemData(offer.furniClassId); diff --git a/src/api/nitro/session/GetOwnPosture.ts b/src/api/nitro/session/GetOwnPosture.ts index fe0c5f33..ed2a698c 100644 --- a/src/api/nitro/session/GetOwnPosture.ts +++ b/src/api/nitro/session/GetOwnPosture.ts @@ -6,8 +6,8 @@ export function GetOwnPosture(): string const roomObject = GetOwnRoomObject(); if(!roomObject) return AvatarAction.POSTURE_STAND; - + const model = roomObject.model; - + return model.getValue(RoomObjectVariable.FIGURE_POSTURE); } diff --git a/src/api/nitro/session/IsRidingHorse.ts b/src/api/nitro/session/IsRidingHorse.ts index f946b69b..9c70b5dd 100644 --- a/src/api/nitro/session/IsRidingHorse.ts +++ b/src/api/nitro/session/IsRidingHorse.ts @@ -6,9 +6,9 @@ export function IsRidingHorse(): boolean const roomObject = GetOwnRoomObject(); if(!roomObject) return false; - + const model = roomObject.model; const effectId = model.getValue(RoomObjectVariable.FIGURE_EFFECT); - + return (effectId === 77); } diff --git a/src/api/nitro/session/VisitDesktop.ts b/src/api/nitro/session/VisitDesktop.ts index 9fe3fb7a..2309f010 100644 --- a/src/api/nitro/session/VisitDesktop.ts +++ b/src/api/nitro/session/VisitDesktop.ts @@ -8,4 +8,4 @@ export const VisitDesktop = () => GoToDesktop(); GetRoomSessionManager().removeSession(-1); -} +}; diff --git a/src/api/notification/NotificationBubbleType.ts b/src/api/notification/NotificationBubbleType.ts index cce38f5b..858573b5 100644 --- a/src/api/notification/NotificationBubbleType.ts +++ b/src/api/notification/NotificationBubbleType.ts @@ -1,4 +1,4 @@ -export class NotificationBubbleType +export class NotificationBubbleType { public static FRIENDOFFLINE: string = 'friendoffline'; public static FRIENDONLINE: string = 'friendonline'; diff --git a/src/api/room/widgets/AvatarInfoUser.ts b/src/api/room/widgets/AvatarInfoUser.ts index 270bfbd4..5ea0dd06 100644 --- a/src/api/room/widgets/AvatarInfoUser.ts +++ b/src/api/room/widgets/AvatarInfoUser.ts @@ -39,7 +39,7 @@ export class AvatarInfoUser implements IAvatarInfo public targetRoomControllerLevel: number = 0; public isAmbassador: boolean = false; - constructor(public readonly type: string) + constructor(public readonly type: string) {} public get isOwnUser(): boolean diff --git a/src/api/room/widgets/AvatarInfoUtilities.ts b/src/api/room/widgets/AvatarInfoUtilities.ts index b670bdec..94e7d321 100644 --- a/src/api/room/widgets/AvatarInfoUtilities.ts +++ b/src/api/room/widgets/AvatarInfoUtilities.ts @@ -398,7 +398,7 @@ export class AvatarInfoUtilities default: return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); } - } + }; return this.isValidSetting(userInfo, checkSetting); } @@ -416,7 +416,7 @@ export class AvatarInfoUtilities default: return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); } - } + }; return this.isValidSetting(userInfo, checkSetting); } @@ -432,7 +432,7 @@ export class AvatarInfoUtilities default: return (userInfo.roomControllerLevel >= RoomControllerLevel.ROOM_OWNER); } - } + }; return this.isValidSetting(userInfo, checkSetting); } diff --git a/src/api/room/widgets/ChatBubbleMessage.ts b/src/api/room/widgets/ChatBubbleMessage.ts index 44d848cf..3e31e389 100644 --- a/src/api/room/widgets/ChatBubbleMessage.ts +++ b/src/api/room/widgets/ChatBubbleMessage.ts @@ -10,7 +10,7 @@ export class ChatBubbleMessage private _top: number = 0; private _left: number = 0; - + constructor( public senderId: number = -1, public senderCategory: number = -1, @@ -23,7 +23,7 @@ export class ChatBubbleMessage public styleId: number = 0, public imageUrl: string = null, public color: string = null - ) + ) { this.id = ++ChatBubbleMessage.BUBBLE_COUNTER; } diff --git a/src/api/room/widgets/ChatBubbleUtilities.ts b/src/api/room/widgets/ChatBubbleUtilities.ts index 0ccbb144..fff0a14c 100644 --- a/src/api/room/widgets/ChatBubbleUtilities.ts +++ b/src/api/room/widgets/ChatBubbleUtilities.ts @@ -12,7 +12,7 @@ export class ChatBubbleUtilities { const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, { resetFigure: figure => this.setFigureImage(figure), - dispose: () => + dispose: () => {}, disposed: false }); diff --git a/src/api/room/widgets/DimmerFurnitureWidgetPresetItem.ts b/src/api/room/widgets/DimmerFurnitureWidgetPresetItem.ts index 1a2759f6..009e530a 100644 --- a/src/api/room/widgets/DimmerFurnitureWidgetPresetItem.ts +++ b/src/api/room/widgets/DimmerFurnitureWidgetPresetItem.ts @@ -4,6 +4,6 @@ export class DimmerFurnitureWidgetPresetItem public id: number = 0, public type: number = 0, public color: number = 0, - public light: number = 0) + public light: number = 0) {} } diff --git a/src/api/room/widgets/DoChatsOverlap.ts b/src/api/room/widgets/DoChatsOverlap.ts index 092ce5db..74f0d7fe 100644 --- a/src/api/room/widgets/DoChatsOverlap.ts +++ b/src/api/room/widgets/DoChatsOverlap.ts @@ -3,5 +3,4 @@ import { ChatBubbleMessage } from './ChatBubbleMessage'; export const DoChatsOverlap = (a: ChatBubbleMessage, b: ChatBubbleMessage, additionalBTop: number, padding: number = 0) => { return !((((a.left + padding) + a.width) < (b.left + padding)) || ((a.left + padding) > ((b.left + padding) + b.width)) || ((a.top + a.height) < (b.top + additionalBTop)) || (a.top > ((b.top + additionalBTop) + b.height))); -} - \ No newline at end of file +}; diff --git a/src/api/room/widgets/GetDiskColor.ts b/src/api/room/widgets/GetDiskColor.ts index 989f2949..97cd24d7 100644 --- a/src/api/room/widgets/GetDiskColor.ts +++ b/src/api/room/widgets/GetDiskColor.ts @@ -12,9 +12,9 @@ export const GetDiskColor = (name: string) => let b: number = 0; let index: number = 0; - while (index < name.length) + while(index < name.length) { - switch ((index % 3)) + switch((index % 3)) { case 0: r = (r + ( name.charCodeAt(index) * 37) ); @@ -34,4 +34,4 @@ export const GetDiskColor = (name: string) => b = ((b % DISK_COLOR_BLUE_RANGE) + DISK_COLOR_BLUE_MIN); return `rgb(${ r },${ g },${ b })`; -} +}; diff --git a/src/api/room/widgets/MannequinUtilities.ts b/src/api/room/widgets/MannequinUtilities.ts index 9368a791..74d45f91 100644 --- a/src/api/room/widgets/MannequinUtilities.ts +++ b/src/api/room/widgets/MannequinUtilities.ts @@ -29,10 +29,10 @@ export class MannequinUtilities for(const part of figureContainer.getPartTypeIds()) { if(this.MANNEQUIN_CLOTHING_PART_TYPES.indexOf(part) >= 0) continue; - + figureContainer.removePart(part); } - + figureContainer.updatePart((this.MANNEQUIN_FIGURE[0] as string), (this.MANNEQUIN_FIGURE[1] as number), (this.MANNEQUIN_FIGURE[2] as number[])); }; } diff --git a/src/api/room/widgets/YoutubeVideoPlaybackStateEnum.ts b/src/api/room/widgets/YoutubeVideoPlaybackStateEnum.ts index 3a885d15..2d178415 100644 --- a/src/api/room/widgets/YoutubeVideoPlaybackStateEnum.ts +++ b/src/api/room/widgets/YoutubeVideoPlaybackStateEnum.ts @@ -1,4 +1,4 @@ -export class YoutubeVideoPlaybackStateEnum +export class YoutubeVideoPlaybackStateEnum { public static readonly UNSTARTED = -1; public static readonly ENDED = 0; diff --git a/src/api/utils/CloneObject.ts b/src/api/utils/CloneObject.ts index 6cd8d3eb..b306fac0 100644 --- a/src/api/utils/CloneObject.ts +++ b/src/api/utils/CloneObject.ts @@ -11,4 +11,4 @@ export const CloneObject = (object: T): T => } return copy; -} +}; diff --git a/src/api/utils/ColorUtils.ts b/src/api/utils/ColorUtils.ts index c32f8fba..ff3a0bf0 100644 --- a/src/api/utils/ColorUtils.ts +++ b/src/api/utils/ColorUtils.ts @@ -30,7 +30,7 @@ export class ColorUtils */ public static int_to_8BitVals(value: number): [number, number, number, number] { - const val1 = ((value >> 24) & 0xFF) + const val1 = ((value >> 24) & 0xFF); const val2 = ((value >> 16) & 0xFF); const val3 = ((value >> 8) & 0xFF); const val4 = (value & 0xFF); diff --git a/src/api/utils/ConvertSeconds.ts b/src/api/utils/ConvertSeconds.ts index f559dea9..351dda81 100644 --- a/src/api/utils/ConvertSeconds.ts +++ b/src/api/utils/ConvertSeconds.ts @@ -6,4 +6,4 @@ export const ConvertSeconds = (seconds: number) => let numSeconds = ((seconds % 86400) % 3600) % 60; return numDays.toString().padStart(2, '0') + ':' + numHours.toString().padStart(2, '0') + ':' + numMinutes.toString().padStart(2, '0') + ':' + numSeconds.toString().padStart(2, '0'); -} +}; diff --git a/src/api/utils/GetLocalStorage.ts b/src/api/utils/GetLocalStorage.ts index 769df6d7..a4270cfc 100644 --- a/src/api/utils/GetLocalStorage.ts +++ b/src/api/utils/GetLocalStorage.ts @@ -2,10 +2,10 @@ export const GetLocalStorage = (key: string) => { try { - JSON.parse(window.localStorage.getItem(key)) as T ?? null + JSON.parse(window.localStorage.getItem(key)) as T ?? null; } - catch(e) + catch (e) { return null; } -} +}; diff --git a/src/api/utils/LocalizeBadgeDescription.ts b/src/api/utils/LocalizeBadgeDescription.ts index acf37957..11f178e7 100644 --- a/src/api/utils/LocalizeBadgeDescription.ts +++ b/src/api/utils/LocalizeBadgeDescription.ts @@ -7,4 +7,4 @@ export const LocalizeBadgeDescription = (key: string) => if(!badgeDesc || !badgeDesc.length) badgeDesc = `badge_desc_${ key }`; return badgeDesc; -} +}; diff --git a/src/api/utils/LocalizeBageName.ts b/src/api/utils/LocalizeBageName.ts index 50d6ac57..47645cbf 100644 --- a/src/api/utils/LocalizeBageName.ts +++ b/src/api/utils/LocalizeBageName.ts @@ -7,4 +7,4 @@ export const LocalizeBadgeName = (key: string) => if(!badgeName || !badgeName.length) badgeName = `badge_name_${ key }`; return badgeName; -} +}; diff --git a/src/api/utils/PlaySound.ts b/src/api/utils/PlaySound.ts index 0f9a39d8..b0f903cd 100644 --- a/src/api/utils/PlaySound.ts +++ b/src/api/utils/PlaySound.ts @@ -8,7 +8,7 @@ export const PlaySound = (sampleCode: string) => if(!canPlaySound) return; DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode)); -} +}; const eventTypes = [ MouseEventType.MOUSE_CLICK ]; @@ -19,6 +19,6 @@ const startListening = () => const onEvent = (event: Event) => ((canPlaySound = true) && stopListening()); eventTypes.forEach(type => window.addEventListener(type, onEvent)); -} +}; startListening(); diff --git a/src/api/utils/RoomChatFormatter.ts b/src/api/utils/RoomChatFormatter.ts index a24cdf57..f87840b3 100644 --- a/src/api/utils/RoomChatFormatter.ts +++ b/src/api/utils/RoomChatFormatter.ts @@ -35,7 +35,7 @@ const encodeHTML = (str: string) => return full; }); -} +}; export const RoomChatFormatter = (content: string) => { @@ -72,4 +72,4 @@ export const RoomChatFormatter = (content: string) => } return result; -} +}; diff --git a/src/api/wired/GetWiredTimeLocale.ts b/src/api/wired/GetWiredTimeLocale.ts index 49025fe4..39f35160 100644 --- a/src/api/wired/GetWiredTimeLocale.ts +++ b/src/api/wired/GetWiredTimeLocale.ts @@ -5,4 +5,4 @@ export const GetWiredTimeLocale = (value: number) => if(!(value % 2)) return time.toString(); return (time + 0.5).toString(); -} +}; diff --git a/src/common/AutoGrid.tsx b/src/common/AutoGrid.tsx index c387892a..167ee92b 100644 --- a/src/common/AutoGrid.tsx +++ b/src/common/AutoGrid.tsx @@ -16,7 +16,7 @@ export const AutoGrid: FC = props => let newStyle: CSSProperties = {}; newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px'); - + if(columnCount > 1) newStyle.gridTemplateColumns = `repeat(auto-fill, minmax(${ columnMinWidth }px, 1fr))`; if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; @@ -25,4 +25,4 @@ export const AutoGrid: FC = props => }, [ columnMinWidth, columnMinHeight, columnCount, style ]); return ; -} +}; diff --git a/src/common/Base.tsx b/src/common/Base.tsx index 156336f7..a2747c65 100644 --- a/src/common/Base.tsx +++ b/src/common/Base.tsx @@ -29,31 +29,31 @@ export const Base: FC> = props => { const newClassNames: string[] = []; - if (display && display.length) newClassNames.push(display); + if(display && display.length) newClassNames.push(display); - if (fit || fullWidth) newClassNames.push('w-full'); + if(fit || fullWidth) newClassNames.push('w-full'); - if (fit || fullHeight) newClassNames.push('h-full'); + if(fit || fullHeight) newClassNames.push('h-full'); - if (fitV) newClassNames.push('vw-full', 'vh-full'); + if(fitV) newClassNames.push('vw-full', 'vh-full'); - if (grow) newClassNames.push('!flex-grow'); + if(grow) newClassNames.push('!flex-grow'); - if (shrink) newClassNames.push('!flex-shrink-0'); + if(shrink) newClassNames.push('!flex-shrink-0'); - if (overflow) newClassNames.push('overflow-' + overflow); + if(overflow) newClassNames.push('overflow-' + overflow); - if (position) newClassNames.push(position); + if(position) newClassNames.push(position); - if (float) newClassNames.push('float-' + float); + if(float) newClassNames.push('float-' + float); - if (pointer) newClassNames.push('cursor-pointer'); + if(pointer) newClassNames.push('cursor-pointer'); - if (visible !== null) newClassNames.push(visible ? 'visible' : 'invisible'); + if(visible !== null) newClassNames.push(visible ? 'visible' : 'invisible'); - if (textColor) newClassNames.push('text-' + textColor); + if(textColor) newClassNames.push('text-' + textColor); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ display, fit, fitV, grow, shrink, fullWidth, fullHeight, overflow, position, float, pointer, visible, textColor, classNames ]); @@ -62,7 +62,7 @@ export const Base: FC> = props => { let newClassName = getClassNames.join(' '); - if (className.length) newClassName += (' ' + className); + if(className.length) newClassName += (' ' + className); return newClassName.trim(); }, [ getClassNames, className ]); @@ -71,7 +71,7 @@ export const Base: FC> = props => { let newStyle: CSSProperties = {}; - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ style ]); @@ -81,4 +81,4 @@ export const Base: FC> = props => { children }
); -} +}; diff --git a/src/common/Button.tsx b/src/common/Button.tsx index 5964cc84..bdd3ccdd 100644 --- a/src/common/Button.tsx +++ b/src/common/Button.tsx @@ -21,48 +21,48 @@ export const Button: FC = props => const newClassNames: string[] = [ 'pointer-events-auto inline-block font-normal leading-normal text-[#fff] text-center no-underline align-middle cursor-pointer select-none border-[1px] border-[solid] border-[transparent] px-[.75rem] py-[.375rem] text-[.9rem] rounded-[.25rem] [transition:color_.15s_ease-in-out,_background-color_.15s_ease-in-out,_border-color_.15s_ease-in-out,_box-shadow_.15s_ease-in-out]' ]; - if (variant) + if(variant) { - if (variant == 'primary') + if(variant == 'primary') newClassNames.push('text-white bg-[#1e7295] border-[#1e7295] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#1a617f] hover:border-[#185b77]'); - if (variant == 'success') + if(variant == 'success') newClassNames.push('text-white bg-[#00800b] border-[#00800b] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#006d09] hover:border-[#006609]'); - if (variant == 'danger') + if(variant == 'danger') newClassNames.push('text-white bg-[#a81a12] border-[#a81a12] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#8f160f] hover:border-[#86150e]'); - if (variant == 'warning') + if(variant == 'warning') newClassNames.push('text-white bg-[#ffc107] border-[#ffc107] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-[#000] hover:bg-[#ffca2c] hover:border-[#ffc720]'); - if (variant == 'black') - newClassNames.push('text-white bg-[#000] border-[#000] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#000] hover:border-[#000]') + if(variant == 'black') + newClassNames.push('text-white bg-[#000] border-[#000] [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#000] hover:border-[#000]'); - if (variant == 'secondary') - newClassNames.push('text-white bg-[#185d79] border-[#185d79] [box-shadow:inset_0_2px_#ffffff26,_inset_0_-2px_#0000001a,_0_1px_#0000001a] hover:text-white hover:bg-[#144f67] hover:border-[#134a61]') + if(variant == 'secondary') + newClassNames.push('text-white bg-[#185d79] border-[#185d79] [box-shadow:inset_0_2px_#ffffff26,_inset_0_-2px_#0000001a,_0_1px_#0000001a] hover:text-white hover:bg-[#144f67] hover:border-[#134a61]'); - if (variant == 'dark') - newClassNames.push('text-white bg-dark [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#18181bfb] hover:border-[#161619fb]') + if(variant == 'dark') + newClassNames.push('text-white bg-dark [box-shadow:inset_0_2px_#ffffff26,inset_0_-2px_#0000001a,0_1px_#0000001a] hover:text-white hover:bg-[#18181bfb] hover:border-[#161619fb]'); } - if (size) + if(size) { - if (size == 'sm') + if(size == 'sm') { newClassNames.push('!px-[.5rem] !py-[.25rem] !text-[.7875rem] !rounded-[.2rem] !min-h-[28px]'); } } - if (active) newClassNames.push('active'); + if(active) newClassNames.push('active'); - if (disabled) newClassNames.push('pointer-events-none opacity-[.65] [box-shadow:none]'); + if(disabled) newClassNames.push('pointer-events-none opacity-[.65] [box-shadow:none]'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ variant, size, active, disabled, classNames ]); return ; -} +}; diff --git a/src/common/Column.tsx b/src/common/Column.tsx index a866c158..13cca1e2 100644 --- a/src/common/Column.tsx +++ b/src/common/Column.tsx @@ -19,28 +19,28 @@ export const Column: FC = props => { const newClassNames: string[] = []; - if (size) + if(size) { let colClassName = `col-span-${ size }`; - if (isCssGrid) colClassName = `${ colClassName }`; + if(isCssGrid) colClassName = `${ colClassName }`; newClassNames.push(colClassName); } - if (offset) + if(offset) { let colClassName = `offset-${ offset }`; - if (isCssGrid) colClassName = `g-start-${ offset }`; + if(isCssGrid) colClassName = `g-start-${ offset }`; newClassNames.push(colClassName); } - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ size, offset, isCssGrid, classNames ]); return ; -} +}; diff --git a/src/common/Flex.tsx b/src/common/Flex.tsx index 02647f0b..6d332acb 100644 --- a/src/common/Flex.tsx +++ b/src/common/Flex.tsx @@ -21,30 +21,30 @@ export const Flex: FC = props => { const newClassNames: string[] = []; - if (column) + if(column) { - if (reverse) newClassNames.push('flex-col-span-reverse'); + if(reverse) newClassNames.push('flex-col-span-reverse'); else newClassNames.push('flex-col'); } else { - if (reverse) newClassNames.push('flex-row-reverse'); + if(reverse) newClassNames.push('flex-row-reverse'); } - if (gap) newClassNames.push('gap-' + gap); + if(gap) newClassNames.push('gap-' + gap); - if (alignSelf) newClassNames.push('self-' + alignSelf); + if(alignSelf) newClassNames.push('self-' + alignSelf); - if (alignItems) newClassNames.push('items-' + alignItems); + if(alignItems) newClassNames.push('items-' + alignItems); - if (justifyContent) newClassNames.push('justify-' + justifyContent); + if(justifyContent) newClassNames.push('justify-' + justifyContent); - if (!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); + if(!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ column, reverse, gap, center, alignSelf, alignItems, justifyContent, classNames ]); return ; -} +}; diff --git a/src/common/FormGroup.tsx b/src/common/FormGroup.tsx index 8eb183a2..2d73f24a 100644 --- a/src/common/FormGroup.tsx +++ b/src/common/FormGroup.tsx @@ -19,4 +19,4 @@ export const FormGroup: FC = props => }, [ classNames ]); return ; -} +}; diff --git a/src/common/Grid.tsx b/src/common/Grid.tsx index 4a23b9d6..441db8ab 100644 --- a/src/common/Grid.tsx +++ b/src/common/Grid.tsx @@ -24,23 +24,23 @@ export const Grid: FC = props => const newClassNames: string[] = []; - if (inline) newClassNames.push('inline-grid'); + if(inline) newClassNames.push('inline-grid'); else newClassNames.push('grid grid-rows-[repeat(var(--bs-rows,_1),_1fr)] grid-cols-[repeat(var(--bs-columns,_12),_1fr)]'); - if (gap) newClassNames.push('gap-' + gap); - else if (gap === 0) newClassNames.push('gap-0'); + if(gap) newClassNames.push('gap-' + gap); + else if(gap === 0) newClassNames.push('gap-0'); - if (maxContent) newClassNames.push('[flex-basis:max-content]'); + if(maxContent) newClassNames.push('[flex-basis:max-content]'); - if (alignSelf) newClassNames.push('self-' + alignSelf); + if(alignSelf) newClassNames.push('self-' + alignSelf); - if (alignItems) newClassNames.push('items-' + alignItems); + if(alignItems) newClassNames.push('items-' + alignItems); - if (justifyContent) newClassNames.push('justify-' + justifyContent); + if(justifyContent) newClassNames.push('justify-' + justifyContent); - if (!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); + if(!alignItems && !justifyContent && center) newClassNames.push('items-center', 'justify-center'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ inline, gap, maxContent, alignSelf, alignItems, justifyContent, center, classNames ]); @@ -49,9 +49,9 @@ export const Grid: FC = props => { let newStyle: CSSProperties = {}; - if (columnCount) newStyle['--bs-columns'] = columnCount.toString(); + if(columnCount) newStyle['--bs-columns'] = columnCount.toString(); - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ columnCount, style ]); @@ -61,4 +61,4 @@ export const Grid: FC = props => ); -} +}; diff --git a/src/common/GridContext.tsx b/src/common/GridContext.tsx index 821e01b7..082d4bed 100644 --- a/src/common/GridContext.tsx +++ b/src/common/GridContext.tsx @@ -11,7 +11,7 @@ const GridContext = createContext({ export const GridContextProvider: FC> = props => { - return { props.children } -} + return { props.children }; +}; export const useGridContext = () => useContext(GridContext); diff --git a/src/common/HorizontalRule.tsx b/src/common/HorizontalRule.tsx index 25aeaf99..54164ae9 100644 --- a/src/common/HorizontalRule.tsx +++ b/src/common/HorizontalRule.tsx @@ -35,4 +35,4 @@ export const HorizontalRule: FC = props => }, [ height, style ]); return ; -} +}; diff --git a/src/common/InfiniteScroll.tsx b/src/common/InfiniteScroll.tsx index 8663c143..51966f88 100644 --- a/src/common/InfiniteScroll.tsx +++ b/src/common/InfiniteScroll.tsx @@ -52,4 +52,4 @@ export const InfiniteScroll: FC = props =>
); -} +}; diff --git a/src/common/Popover.tsx b/src/common/Popover.tsx index f775edb0..5a7c5c89 100644 --- a/src/common/Popover.tsx +++ b/src/common/Popover.tsx @@ -1,58 +1,40 @@ -// @flow strict -'use client' -import { useEffect, useRef, useState } from 'react'; +import { FC, PropsWithChildren, useEffect, useRef, useState } from 'react'; -function ReactPopover({ - children, - content, - trigger = 'click' -}) +export const ReactPopover: FC> = props => { + const { content = null, trigger = null, children = null } = props; const [ show, setShow ] = useState(false); const wrapperRef = useRef(null); - const handleMouseOver = () => - { - if (trigger === 'hover') - { - setShow(true); - }; - }; + const handleMouseOver = () => (trigger === 'hover') && setShow(true); - const handleMouseLeft = () => - { - if (trigger === 'hover') - { - setShow(false); - }; - }; + const handleMouseLeft = () => (trigger === 'hover') && setShow(false); useEffect(() => { - function handleClickOutside(event) - { - if (wrapperRef.current && !wrapperRef.current.contains(event.target)) - { - setShow(false); - } - } + if(!show) return; - if (show) + const handleClickOutside = (event: MouseEvent) => { - // Bind the event listener - document.addEventListener('mousedown', handleClickOutside); - return () => - { - // Unbind the event listener on clean up - document.removeEventListener('mousedown', handleClickOutside); - }; - } + if(wrapperRef.current && !wrapperRef.current.contains(event.target)) setShow(false); + }; + + document.addEventListener('mousedown', handleClickOutside); + + return () => + { + // Unbind the event listener on clean up + document.removeEventListener('mousedown', handleClickOutside); + }; }, [ show, wrapperRef ]); return (
); }; - -export default ReactPopover; diff --git a/src/common/Text.tsx b/src/common/Text.tsx index 4e8126e1..4ed1a474 100644 --- a/src/common/Text.tsx +++ b/src/common/Text.tsx @@ -28,36 +28,36 @@ export const Text: FC = props => { const newClassNames: string[] = [ 'inline' ]; - if (variant) newClassNames.push('text-' + variant); + if(variant) newClassNames.push('text-' + variant); - if (bold) newClassNames.push('font-bold '); + if(bold) newClassNames.push('font-bold '); - if (fontWeight) newClassNames.push('font-' + fontWeight); + if(fontWeight) newClassNames.push('font-' + fontWeight); - if (fontSize) newClassNames.push('fs-' + fontSize); + if(fontSize) newClassNames.push('fs-' + fontSize); - if (align) newClassNames.push('text-' + align); + if(align) newClassNames.push('text-' + align); - if (underline) newClassNames.push('underline'); + if(underline) newClassNames.push('underline'); - if (italics) newClassNames.push('italic'); + if(italics) newClassNames.push('italic'); - if (truncate) newClassNames.push('text-truncate'); + if(truncate) newClassNames.push('text-truncate'); - if (center) newClassNames.push('text-center'); + if(center) newClassNames.push('text-center'); - if (textEnd) newClassNames.push('text-end'); + if(textEnd) newClassNames.push('text-end'); - if (small) newClassNames.push('text-sm'); + if(small) newClassNames.push('text-sm'); - if (wrap) newClassNames.push('text-wrap'); + if(wrap) newClassNames.push('text-wrap'); - if (noWrap) newClassNames.push('text-nowrap'); + if(noWrap) newClassNames.push('text-nowrap'); - if (textBreak) newClassNames.push('text-break'); + if(textBreak) newClassNames.push('text-break'); return newClassNames; }, [ variant, fontWeight, fontSize, align, bold, underline, italics, truncate, center, textEnd, small, wrap, noWrap, textBreak ]); return ; -} +}; diff --git a/src/common/card/NitroCardContentView.tsx b/src/common/card/NitroCardContentView.tsx index 227261e9..a93703be 100644 --- a/src/common/card/NitroCardContentView.tsx +++ b/src/common/card/NitroCardContentView.tsx @@ -10,10 +10,10 @@ export const NitroCardContentView: FC = props => // Theme Changer const newClassNames: string[] = [ 'container-fluid', 'h-full p-[8px] overflow-auto', 'bg-light' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); return ; -} +}; diff --git a/src/common/card/NitroCardContext.tsx b/src/common/card/NitroCardContext.tsx index 517b435b..c296b2a5 100644 --- a/src/common/card/NitroCardContext.tsx +++ b/src/common/card/NitroCardContext.tsx @@ -11,7 +11,7 @@ const NitroCardContext = createContext({ export const NitroCardContextProvider: FC> = props => { - return { props.children } -} + return { props.children }; +}; export const useNitroCardContext = () => useContext(NitroCardContext); diff --git a/src/common/card/NitroCardHeaderView.tsx b/src/common/card/NitroCardHeaderView.tsx index f4f18388..2cfd6380 100644 --- a/src/common/card/NitroCardHeaderView.tsx +++ b/src/common/card/NitroCardHeaderView.tsx @@ -21,7 +21,7 @@ export const NitroCardHeaderView: FC = props => { event.stopPropagation(); event.nativeEvent.stopImmediatePropagation(); - } + }; return ( @@ -38,4 +38,4 @@ export const NitroCardHeaderView: FC = props => ); -} +}; diff --git a/src/common/card/NitroCardView.tsx b/src/common/card/NitroCardView.tsx index 9e91f156..45d81442 100644 --- a/src/common/card/NitroCardView.tsx +++ b/src/common/card/NitroCardView.tsx @@ -22,7 +22,7 @@ export const NitroCardView: FC = props => - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -34,4 +34,4 @@ export const NitroCardView: FC = props => ); -} +}; diff --git a/src/common/card/accordion/NitroCardAccordionContext.tsx b/src/common/card/accordion/NitroCardAccordionContext.tsx index 61377d54..5e65c30b 100644 --- a/src/common/card/accordion/NitroCardAccordionContext.tsx +++ b/src/common/card/accordion/NitroCardAccordionContext.tsx @@ -16,6 +16,6 @@ const NitroCardAccordionContext = createContext({ export const NitroCardAccordionContextProvider: FC> = props => { return ; -} +}; export const useNitroCardAccordionContext = () => useContext(NitroCardAccordionContext); diff --git a/src/common/card/accordion/NitroCardAccordionItemView.tsx b/src/common/card/accordion/NitroCardAccordionItemView.tsx index dbd89cc2..238aab40 100644 --- a/src/common/card/accordion/NitroCardAccordionItemView.tsx +++ b/src/common/card/accordion/NitroCardAccordionItemView.tsx @@ -15,4 +15,4 @@ export const NitroCardAccordionItemView: FC = p { children } ); -} +}; diff --git a/src/common/card/accordion/NitroCardAccordionSetView.tsx b/src/common/card/accordion/NitroCardAccordionSetView.tsx index 10e8fcd7..1a059d4b 100644 --- a/src/common/card/accordion/NitroCardAccordionSetView.tsx +++ b/src/common/card/accordion/NitroCardAccordionSetView.tsx @@ -18,9 +18,9 @@ export const NitroCardAccordionSetView: FC = pro const onClick = () => { closeAll(); - + setIsOpen(prevValue => !prevValue); - } + }; const onClose = useCallback(() => setIsOpen(false), []); @@ -62,10 +62,10 @@ export const NitroCardAccordionSetView: FC = pro const index = newClosers.indexOf(closeFunction); if(index >= 0) newClosers.splice(index, 1); - + return newClosers; }); - } + }; }, [ onClose, setClosers ]); return ( @@ -81,4 +81,4 @@ export const NitroCardAccordionSetView: FC = pro } ); -} +}; diff --git a/src/common/card/accordion/NitroCardAccordionView.tsx b/src/common/card/accordion/NitroCardAccordionView.tsx index 648a2e7d..0874450a 100644 --- a/src/common/card/accordion/NitroCardAccordionView.tsx +++ b/src/common/card/accordion/NitroCardAccordionView.tsx @@ -4,7 +4,7 @@ import { NitroCardAccordionContextProvider } from './NitroCardAccordionContext'; interface NitroCardAccordionViewProps extends ColumnProps { - + } export const NitroCardAccordionView: FC = props => @@ -22,4 +22,4 @@ export const NitroCardAccordionView: FC = props => ); -} +}; diff --git a/src/common/card/tabs/NitroCardTabsItemView.tsx b/src/common/card/tabs/NitroCardTabsItemView.tsx index bf06bbcb..2f0b0148 100644 --- a/src/common/card/tabs/NitroCardTabsItemView.tsx +++ b/src/common/card/tabs/NitroCardTabsItemView.tsx @@ -19,7 +19,7 @@ export const NitroCardTabsItemView: FC = props => //if (isActive) newClassNames.push('bg-[#dfdfdf] border-b-[1px_solid_black]'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ isActive, classNames ]); @@ -33,4 +33,4 @@ export const NitroCardTabsItemView: FC = props => } ); -} +}; diff --git a/src/common/card/tabs/NitroCardTabsView.tsx b/src/common/card/tabs/NitroCardTabsView.tsx index ad053ec5..63ba2dac 100644 --- a/src/common/card/tabs/NitroCardTabsView.tsx +++ b/src/common/card/tabs/NitroCardTabsView.tsx @@ -9,7 +9,7 @@ export const NitroCardTabsView: FC = props => { const newClassNames: string[] = [ 'justify-center gap-0.5 flex bg-card-tabs min-h-card-tabs max-h-card-tabs pt-1 border-b border-card-border px-2' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -19,4 +19,4 @@ export const NitroCardTabsView: FC = props => { children } ); -} +}; diff --git a/src/common/draggable-window/DraggableWindow.tsx b/src/common/draggable-window/DraggableWindow.tsx index f086fbd7..fa9763d8 100644 --- a/src/common/draggable-window/DraggableWindow.tsx +++ b/src/common/draggable-window/DraggableWindow.tsx @@ -106,7 +106,7 @@ export const DraggableWindow: FC = props => const completeDrag = useCallback(() => { if(!elementRef.current || !dragHandler) return; - + let offsetX = (offset.x + delta.x); let offsetY = (offset.y + delta.y); @@ -169,7 +169,7 @@ export const DraggableWindow: FC = props => if(!disableDrag) { - const handle = (element.querySelector(handleSelector) as HTMLElement); + const handle = (element.querySelector(handleSelector)); if(handle) setDragHandler(handle); } @@ -201,13 +201,13 @@ export const DraggableWindow: FC = props => const index = CURRENT_WINDOWS.indexOf(element); if(index >= 0) CURRENT_WINDOWS.splice(index, 1); - } + }; }, [ handleSelector, windowPosition, uniqueKey, disableDrag, offsetLeft, offsetTop, bringToTop ]); useEffect(() => { if(!offset && !delta) return; - + const element = (elementRef.current as HTMLElement); if(!element) return; @@ -227,7 +227,7 @@ export const DraggableWindow: FC = props => { dragHandler.removeEventListener(MouseEventType.MOUSE_DOWN, onDragMouseDown); dragHandler.removeEventListener(TouchEventType.TOUCH_START, onTouchDown); - } + }; }, [ dragHandler, onDragMouseDown, onTouchDown ]); useEffect(() => @@ -245,7 +245,7 @@ export const DraggableWindow: FC = props => document.removeEventListener(TouchEventType.TOUCH_END, onDragTouchUp); document.removeEventListener(MouseEventType.MOUSE_MOVE, onDragMouseMove); document.removeEventListener(TouchEventType.TOUCH_MOVE, onDragTouchMove); - } + }; }, [ isDragging, onDragMouseUp, onDragMouseMove, onDragTouchUp, onDragTouchMove ]); useEffect(() => @@ -266,4 +266,4 @@ export const DraggableWindow: FC = props => { children }
, document.getElementById('draggable-windows-container')) ); -} +}; diff --git a/src/common/layout/LayoutAvatarImageView.tsx b/src/common/layout/LayoutAvatarImageView.tsx index d68170ba..316b1fd5 100644 --- a/src/common/layout/LayoutAvatarImageView.tsx +++ b/src/common/layout/LayoutAvatarImageView.tsx @@ -24,7 +24,7 @@ export const LayoutAvatarImageView: FC = props => { const newClassNames: string[] = [ 'avatar-image relative w-[90px] h-[130px] bg-no-repeat bg-[center_-8px] pointer-events-none' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -33,27 +33,27 @@ export const LayoutAvatarImageView: FC = props => { let newStyle: CSSProperties = {}; - if (avatarUrl && avatarUrl.length) newStyle.backgroundImage = `url('${ avatarUrl }')`; + if(avatarUrl && avatarUrl.length) newStyle.backgroundImage = `url('${ avatarUrl }')`; - if (scale !== 1) + if(scale !== 1) { newStyle.transform = `scale(${ scale })`; - if (!(scale % 1)) newStyle.imageRendering = 'pixelated'; + if(!(scale % 1)) newStyle.imageRendering = 'pixelated'; } - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ avatarUrl, scale, style ]); useEffect(() => { - if (!isReady) return; + if(!isReady) return; const figureKey = [ figure, gender, direction, headOnly ].join('-'); - if (AVATAR_IMAGE_CACHE.has(figureKey)) + if(AVATAR_IMAGE_CACHE.has(figureKey)) { setAvatarUrl(AVATAR_IMAGE_CACHE.get(figureKey)); } @@ -61,27 +61,27 @@ export const LayoutAvatarImageView: FC = props => { const resetFigure = (_figure: string) => { - if (isDisposed.current) return; + if(isDisposed.current) return; const avatarImage = GetAvatarRenderManager().createAvatarImage(_figure, AvatarScaleType.LARGE, gender, { resetFigure: (figure: string) => resetFigure(figure), dispose: null, disposed: false }); let setType = AvatarSetType.FULL; - if (headOnly) setType = AvatarSetType.HEAD; + if(headOnly) setType = AvatarSetType.HEAD; avatarImage.setDirection(setType, direction); const imageUrl = avatarImage.processAsImageUrl(setType); - if (imageUrl && !isDisposed.current) + if(imageUrl && !isDisposed.current) { - if (!avatarImage.isPlaceholder()) AVATAR_IMAGE_CACHE.set(figureKey, imageUrl); + if(!avatarImage.isPlaceholder()) AVATAR_IMAGE_CACHE.set(figureKey, imageUrl); setAvatarUrl(imageUrl); } avatarImage.dispose(true); - } + }; resetFigure(figure); } @@ -96,8 +96,8 @@ export const LayoutAvatarImageView: FC = props => return () => { isDisposed.current = true; - } + }; }, []); return ; -} +}; diff --git a/src/common/layout/LayoutBackgroundImage.tsx b/src/common/layout/LayoutBackgroundImage.tsx index 0900a260..622d9598 100644 --- a/src/common/layout/LayoutBackgroundImage.tsx +++ b/src/common/layout/LayoutBackgroundImage.tsx @@ -20,4 +20,4 @@ export const LayoutBackgroundImage: FC = props => }, [ style, imageUrl ]); return ; -} +}; diff --git a/src/common/layout/LayoutBadgeImageView.tsx b/src/common/layout/LayoutBadgeImageView.tsx index 14b41082..7cfb838d 100644 --- a/src/common/layout/LayoutBadgeImageView.tsx +++ b/src/common/layout/LayoutBadgeImageView.tsx @@ -22,11 +22,11 @@ export const LayoutBadgeImageView: FC = props => { const newClassNames: string[] = [ 'relative w-[40px] h-[40px] bg-no-repeat bg-center' ]; - if (isGroup) newClassNames.push('group-badge'); + if(isGroup) newClassNames.push('group-badge'); - if (isGrayscale) newClassNames.push('grayscale'); + if(isGrayscale) newClassNames.push('grayscale'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames, isGroup, isGrayscale ]); @@ -35,37 +35,37 @@ export const LayoutBadgeImageView: FC = props => { let newStyle: CSSProperties = {}; - if (imageElement) + if(imageElement) { newStyle.backgroundImage = `url(${ (isGroup) ? imageElement.src : GetConfigurationValue('badge.asset.url').replace('%badgename%', badgeCode.toString()) })`; newStyle.width = imageElement.width; newStyle.height = imageElement.height; - if (scale !== 1) + if(scale !== 1) { newStyle.transform = `scale(${ scale })`; - if (!(scale % 1)) newStyle.imageRendering = 'pixelated'; + if(!(scale % 1)) newStyle.imageRendering = 'pixelated'; newStyle.width = (imageElement.width * scale); newStyle.height = (imageElement.height * scale); } } - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ badgeCode, isGroup, imageElement, scale, style ]); useEffect(() => { - if (!badgeCode || !badgeCode.length) return; + if(!badgeCode || !badgeCode.length) return; let didSetBadge = false; const onBadgeImageReadyEvent = async (event: BadgeImageReadyEvent) => { - if (event.badgeId !== badgeCode) return; + if(event.badgeId !== badgeCode) return; const element = await TextureUtils.generateImage(new NitroSprite(event.image)); @@ -74,13 +74,13 @@ export const LayoutBadgeImageView: FC = props => didSetBadge = true; GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent); - } + }; GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent); const texture = isGroup ? GetSessionDataManager().getGroupBadgeImage(badgeCode) : GetSessionDataManager().getBadgeImage(badgeCode); - if (texture && !didSetBadge) + if(texture && !didSetBadge) { (async () => { @@ -103,4 +103,4 @@ export const LayoutBadgeImageView: FC = props => { children } ); -} +}; diff --git a/src/common/layout/LayoutCounterTimeView.tsx b/src/common/layout/LayoutCounterTimeView.tsx index 05b8e153..9b370954 100644 --- a/src/common/layout/LayoutCounterTimeView.tsx +++ b/src/common/layout/LayoutCounterTimeView.tsx @@ -39,4 +39,4 @@ export const LayoutCounterTimeView: FC = props => { children }
); -} +}; diff --git a/src/common/layout/LayoutCurrencyIcon.tsx b/src/common/layout/LayoutCurrencyIcon.tsx index 3925fa84..f311c220 100644 --- a/src/common/layout/LayoutCurrencyIcon.tsx +++ b/src/common/layout/LayoutCurrencyIcon.tsx @@ -15,7 +15,7 @@ export const LayoutCurrencyIcon: FC = props => { const newClassNames: string[] = [ 'nitro-currency-icon', 'bg-center bg-no-repeat w-[15px] h-[15px]' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -35,10 +35,10 @@ export const LayoutCurrencyIcon: FC = props => newStyle.backgroundImage = urlString; - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ style, urlString ]); - return -} + return ; +}; diff --git a/src/common/layout/LayoutFurniIconImageView.tsx b/src/common/layout/LayoutFurniIconImageView.tsx index 0dcf10dd..b7eaeff7 100644 --- a/src/common/layout/LayoutFurniIconImageView.tsx +++ b/src/common/layout/LayoutFurniIconImageView.tsx @@ -14,4 +14,4 @@ export const LayoutFurniIconImageView: FC = props const { productType = 's', productClassId = -1, extraData = '', ...rest } = props; return ; -} +}; diff --git a/src/common/layout/LayoutFurniImageView.tsx b/src/common/layout/LayoutFurniImageView.tsx index 8b17723e..b83d8115 100644 --- a/src/common/layout/LayoutFurniImageView.tsx +++ b/src/common/layout/LayoutFurniImageView.tsx @@ -67,4 +67,4 @@ export const LayoutFurniImageView: FC = props => if(!imageElement) return null; return ; -} +}; diff --git a/src/common/layout/LayoutGridItem.tsx b/src/common/layout/LayoutGridItem.tsx index 6d85d643..5bf73eae 100644 --- a/src/common/layout/LayoutGridItem.tsx +++ b/src/common/layout/LayoutGridItem.tsx @@ -27,21 +27,21 @@ export const LayoutGridItem: FC = props => const newClassNames: string[] = [ 'layout-grid-item', 'border', 'border-2', 'border-muted', 'rounded' ]; - if (itemActive) newClassNames.push('!bg-[#ececec] !border-[#fff]'); + if(itemActive) newClassNames.push('!bg-[#ececec] !border-[#fff]'); - if (itemUniqueSoldout || (itemUniqueNumber > 0)) newClassNames.push('unique-item'); + if(itemUniqueSoldout || (itemUniqueNumber > 0)) newClassNames.push('unique-item'); - if (itemUniqueSoldout) newClassNames.push('sold-out'); + if(itemUniqueSoldout) newClassNames.push('sold-out'); - if (itemUnseen) newClassNames.push('unseen'); + if(itemUnseen) newClassNames.push('unseen'); - if (itemHighlight) newClassNames.push('has-highlight'); + if(itemHighlight) newClassNames.push('has-highlight'); - if (disabled) newClassNames.push('disabled') + if(disabled) newClassNames.push('disabled'); - if (itemImage === null) newClassNames.push('icon', 'loading-icon'); + if(itemImage === null) newClassNames.push('icon', 'loading-icon'); - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ itemActive, itemUniqueSoldout, itemUniqueNumber, itemUnseen, itemHighlight, disabled, itemImage, classNames ]); @@ -50,11 +50,11 @@ export const LayoutGridItem: FC = props => { let newStyle = { ...style }; - if (itemImage && !(itemUniqueSoldout || (itemUniqueNumber > 0))) newStyle.backgroundImage = `url(${ itemImage })`; + if(itemImage && !(itemUniqueSoldout || (itemUniqueNumber > 0))) newStyle.backgroundImage = `url(${ itemImage })`; - if (itemColor) newStyle.backgroundColor = itemColor; + if(itemColor) newStyle.backgroundColor = itemColor; - if (Object.keys(style).length) newStyle = { ...newStyle, ...style }; + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; }, [ style, itemImage, itemColor, itemUniqueSoldout, itemUniqueNumber ]); @@ -73,4 +73,4 @@ export const LayoutGridItem: FC = props => { children } ); -} +}; diff --git a/src/common/layout/LayoutImage.tsx b/src/common/layout/LayoutImage.tsx index 481ce2f1..f3db3bdc 100644 --- a/src/common/layout/LayoutImage.tsx +++ b/src/common/layout/LayoutImage.tsx @@ -10,4 +10,4 @@ export const LayoutImage: FC = props => const { imageUrl = null, className = '', ...rest } = props; return ; -} +}; diff --git a/src/common/layout/LayoutItemCountView.tsx b/src/common/layout/LayoutItemCountView.tsx index e1fb08f1..5b14ed54 100644 --- a/src/common/layout/LayoutItemCountView.tsx +++ b/src/common/layout/LayoutItemCountView.tsx @@ -14,7 +14,7 @@ export const LayoutItemCountView: FC = props => { const newClassNames: string[] = [ 'inline-block px-[.65em] py-[.35em] text-[.75em] font-bold leading-none text-[#fff] text-center whitespace-nowrap align-baseline rounded-[.25rem]', '!border-[1px] !border-[solid] !border-[#283F5D]', 'border-black', 'bg-danger', 'px-1', 'top-[2px] right-[2px] text-[9.5px] px-[3px] py-[2px] ' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -25,4 +25,4 @@ export const LayoutItemCountView: FC = props => { children } ); -} +}; diff --git a/src/common/layout/LayoutLoadingSpinnerView.tsx b/src/common/layout/LayoutLoadingSpinnerView.tsx index 308e0caa..1d2641f6 100644 --- a/src/common/layout/LayoutLoadingSpinnerView.tsx +++ b/src/common/layout/LayoutLoadingSpinnerView.tsx @@ -4,7 +4,7 @@ import { Base, BaseProps } from '../Base'; export const LayoutLoadingSpinnerView: FC> = props => { const { ...rest } = props; - + return ( @@ -12,4 +12,4 @@ export const LayoutLoadingSpinnerView: FC> = props => ); -} +}; diff --git a/src/common/layout/LayoutMiniCameraView.tsx b/src/common/layout/LayoutMiniCameraView.tsx index 8f9d739e..f66786d4 100644 --- a/src/common/layout/LayoutMiniCameraView.tsx +++ b/src/common/layout/LayoutMiniCameraView.tsx @@ -17,18 +17,18 @@ export const LayoutMiniCameraView: FC = props => const getCameraBounds = () => { - if (!elementRef || !elementRef.current) return null; + if(!elementRef || !elementRef.current) return null; const frameBounds = elementRef.current.getBoundingClientRect(); return new NitroRectangle(Math.floor(frameBounds.x), Math.floor(frameBounds.y), Math.floor(frameBounds.width), Math.floor(frameBounds.height)); - } + }; const takePicture = () => { PlaySound(SoundNames.CAMERA_SHUTTER); textureReceiver(GetRoomEngine().createTextureFromRoom(roomId, 1, getCameraBounds())); - } + }; return ( diff --git a/src/common/layout/LayoutNotificationAlertView.tsx b/src/common/layout/LayoutNotificationAlertView.tsx index cdff942d..b1cdf535 100644 --- a/src/common/layout/LayoutNotificationAlertView.tsx +++ b/src/common/layout/LayoutNotificationAlertView.tsx @@ -16,7 +16,7 @@ export const LayoutNotificationAlertView: FC = const getClassNames = useMemo(() => { const newClassNames: string[] = [ 'nitro-alert' ]; - + newClassNames.push('nitro-alert-' + type); if(classNames.length) newClassNames.push(...classNames); @@ -32,4 +32,4 @@ export const LayoutNotificationAlertView: FC = ); -} +}; diff --git a/src/common/layout/LayoutNotificationBubbleView.tsx b/src/common/layout/LayoutNotificationBubbleView.tsx index ef3198f8..1f6e3ac3 100644 --- a/src/common/layout/LayoutNotificationBubbleView.tsx +++ b/src/common/layout/LayoutNotificationBubbleView.tsx @@ -18,7 +18,7 @@ export const LayoutNotificationBubbleView: FC { const newClassNames: string[] = [ 'text-sm bg-[#1c1c20f2] px-[5px] py-[6px] [box-shadow:inset_0_5px_#22222799,_inset_0_-4px_#12121599] ', 'rounded' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -32,7 +32,7 @@ export const LayoutNotificationBubbleView: FC useEffect(() => { - if (!fadesOut) return; + if(!fadesOut) return; const timeout = setTimeout(() => { @@ -49,4 +49,4 @@ export const LayoutNotificationBubbleView: FC ); -} +}; diff --git a/src/common/layout/LayoutPetImageView.tsx b/src/common/layout/LayoutPetImageView.tsx index e052ddfb..acf1a799 100644 --- a/src/common/layout/LayoutPetImageView.tsx +++ b/src/common/layout/LayoutPetImageView.tsx @@ -114,10 +114,10 @@ export const LayoutPetImageView: FC = props => return () => { isDisposed.current = true; - } + }; }, []); const url = `url('${ petUrl }')`; return ; -} +}; diff --git a/src/common/layout/LayoutPrizeProductImageView.tsx b/src/common/layout/LayoutPrizeProductImageView.tsx index 3547d971..a83861e8 100644 --- a/src/common/layout/LayoutPrizeProductImageView.tsx +++ b/src/common/layout/LayoutPrizeProductImageView.tsx @@ -19,12 +19,12 @@ export const LayoutPrizeProductImageView: FC = { case ProductTypeEnum.WALL: case ProductTypeEnum.FLOOR: - return + return ; case ProductTypeEnum.BADGE: - return + return ; case ProductTypeEnum.HABBO_CLUB: - return + return ; } return null; -} +}; diff --git a/src/common/layout/LayoutProgressBar.tsx b/src/common/layout/LayoutProgressBar.tsx index 6b479778..dbbd8f93 100644 --- a/src/common/layout/LayoutProgressBar.tsx +++ b/src/common/layout/LayoutProgressBar.tsx @@ -16,7 +16,7 @@ export const LayoutProgressBar: FC = props => { const newClassNames: string[] = [ 'border-[1px] border-[solid] border-[#fff] p-[2px] h-[20px] rounded-[.25rem] overflow-hidden bg-[#1E7295] ', 'text-white' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -29,4 +29,4 @@ export const LayoutProgressBar: FC = props => { children } ); -} +}; diff --git a/src/common/layout/LayoutRarityLevelView.tsx b/src/common/layout/LayoutRarityLevelView.tsx index 6fd84d2e..f6711aae 100644 --- a/src/common/layout/LayoutRarityLevelView.tsx +++ b/src/common/layout/LayoutRarityLevelView.tsx @@ -25,4 +25,4 @@ export const LayoutRarityLevelView: FC = props => { children } ); -} +}; diff --git a/src/common/layout/LayoutRoomObjectImageView.tsx b/src/common/layout/LayoutRoomObjectImageView.tsx index cc668f81..01328afa 100644 --- a/src/common/layout/LayoutRoomObjectImageView.tsx +++ b/src/common/layout/LayoutRoomObjectImageView.tsx @@ -56,4 +56,4 @@ export const LayoutRoomObjectImageView: FC = pro if(!imageElement) return null; return ; -} +}; diff --git a/src/common/layout/LayoutRoomPreviewerView.tsx b/src/common/layout/LayoutRoomPreviewerView.tsx index 8a5e4185..daceeef0 100644 --- a/src/common/layout/LayoutRoomPreviewerView.tsx +++ b/src/common/layout/LayoutRoomPreviewerView.tsx @@ -15,7 +15,7 @@ export const LayoutRoomPreviewerView: FC<{ if(event.shiftKey) roomPreviewer.changeRoomObjectDirection(); else roomPreviewer.changeRoomObjectState(); - } + }; useEffect(() => { @@ -27,7 +27,7 @@ export const LayoutRoomPreviewerView: FC<{ const update = async (ticker: NitroTicker) => { if(!roomPreviewer || !elementRef.current) return; - + roomPreviewer.updatePreviewRoomView(); const renderingCanvas = roomPreviewer.getRenderingCanvas(); @@ -42,11 +42,11 @@ export const LayoutRoomPreviewerView: FC<{ let canvas = GetRenderer().texture.generateCanvas(texture); const base64 = canvas.toDataURL('image/png'); - + canvas = null; elementRef.current.style.backgroundImage = `url(${ base64 })`; - } + }; GetTicker().add(update); @@ -62,7 +62,7 @@ export const LayoutRoomPreviewerView: FC<{ }); roomPreviewer.getRoomCanvas(width, height); - + resizeObserver.observe(elementRef.current); return () => @@ -72,7 +72,7 @@ export const LayoutRoomPreviewerView: FC<{ resizeObserver.disconnect(); texture.destroy(true); - } + }; }, [ roomPreviewer, elementRef, height ]); return ( @@ -86,4 +86,4 @@ export const LayoutRoomPreviewerView: FC<{ } } onClick={ onClick } /> ); -} +}; diff --git a/src/common/layout/LayoutRoomThumbnailView.tsx b/src/common/layout/LayoutRoomThumbnailView.tsx index bea8a2f2..d6626ff9 100644 --- a/src/common/layout/LayoutRoomThumbnailView.tsx +++ b/src/common/layout/LayoutRoomThumbnailView.tsx @@ -16,14 +16,14 @@ export const LayoutRoomThumbnailView: FC = props = { const newClassNames: string[] = [ 'relative w-[110px] h-[110px] bg-[url("@/assets/images/navigator/thumbnail_placeholder.png")] bg-no-repeat bg-center', 'rounded', '!border-[1px] !border-[solid] !border-[#283F5D]' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); const getImageUrl = useMemo(() => { - if (customUrl && customUrl.length) return (GetConfigurationValue('image.library.url') + customUrl); + if(customUrl && customUrl.length) return (GetConfigurationValue('image.library.url') + customUrl); return (GetConfigurationValue('thumbnails.url').replace('%thumbnail%', roomId.toString())); }, [ customUrl, roomId ]); @@ -34,4 +34,4 @@ export const LayoutRoomThumbnailView: FC = props = { children } ); -} +}; diff --git a/src/common/layout/LayoutTrophyView.tsx b/src/common/layout/LayoutTrophyView.tsx index 4a7a8999..dd2c284f 100644 --- a/src/common/layout/LayoutTrophyView.tsx +++ b/src/common/layout/LayoutTrophyView.tsx @@ -39,4 +39,4 @@ export const LayoutTrophyView: FC = props => ); -} +}; diff --git a/src/common/layout/UserProfileIconView.tsx b/src/common/layout/UserProfileIconView.tsx index 0e132ecb..8898c706 100644 --- a/src/common/layout/UserProfileIconView.tsx +++ b/src/common/layout/UserProfileIconView.tsx @@ -16,7 +16,7 @@ export const UserProfileIconView: FC = props => { const newClassNames: string[] = [ 'bg-[url("@/assets/images/friends/friends-spritesheet.png")]', 'w-[13px] h-[11px] bg-[-51px_-91px]' ]; - if (classNames.length) newClassNames.push(...classNames); + if(classNames.length) newClassNames.push(...classNames); return newClassNames; }, [ classNames ]); @@ -26,4 +26,4 @@ export const UserProfileIconView: FC = props => { children } ); -} +}; diff --git a/src/common/layout/limited-edition/LayoutLimitedEditionCompactPlateView.tsx b/src/common/layout/limited-edition/LayoutLimitedEditionCompactPlateView.tsx index ee41c6c9..86fc9772 100644 --- a/src/common/layout/limited-edition/LayoutLimitedEditionCompactPlateView.tsx +++ b/src/common/layout/limited-edition/LayoutLimitedEditionCompactPlateView.tsx @@ -32,4 +32,4 @@ export const LayoutLimitedEditionCompactPlateView: FC ); -} +}; diff --git a/src/common/layout/limited-edition/LayoutLimitedEditionCompletePlateView.tsx b/src/common/layout/limited-edition/LayoutLimitedEditionCompletePlateView.tsx index 9c74b913..5bcf776f 100644 --- a/src/common/layout/limited-edition/LayoutLimitedEditionCompletePlateView.tsx +++ b/src/common/layout/limited-edition/LayoutLimitedEditionCompletePlateView.tsx @@ -18,7 +18,7 @@ export const LayoutLimitedEditionCompletePlateView: FC ); -} +}; diff --git a/src/common/layout/limited-edition/LayoutLimitedEditionStyledNumberView.tsx b/src/common/layout/limited-edition/LayoutLimitedEditionStyledNumberView.tsx index fe34ba41..992ad09d 100644 --- a/src/common/layout/limited-edition/LayoutLimitedEditionStyledNumberView.tsx +++ b/src/common/layout/limited-edition/LayoutLimitedEditionStyledNumberView.tsx @@ -9,10 +9,10 @@ export const LayoutLimitedEditionStyledNumberView: FC { numbers.map((number, index) => ) } ); -} +}; diff --git a/src/common/transitions/TransitionAnimation.tsx b/src/common/transitions/TransitionAnimation.tsx index 6eefd2df..8e348497 100644 --- a/src/common/transitions/TransitionAnimation.tsx +++ b/src/common/transitions/TransitionAnimation.tsx @@ -37,7 +37,7 @@ export const TransitionAnimation: FC = props => return () => { if(timeoutData) clearTimeout(timeoutData); - } + }; }, [ inProp, timeout ]); return ( @@ -49,4 +49,4 @@ export const TransitionAnimation: FC = props => ) } ); -} +}; diff --git a/src/common/transitions/TransitionAnimationStyles.ts b/src/common/transitions/TransitionAnimationStyles.ts index ce30533e..feebdcca 100644 --- a/src/common/transitions/TransitionAnimationStyles.ts +++ b/src/common/transitions/TransitionAnimationStyles.ts @@ -5,130 +5,130 @@ import { TransitionAnimationTypes } from './TransitionAnimationTypes'; export function getTransitionAnimationStyle(type: string, transition: TransitionStatus, timeout: number = 300): Partial { - switch (type) + switch(type) { case TransitionAnimationTypes.BOUNCE: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'bounceIn', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'bounceOut', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.SLIDE_LEFT: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'slideInLeft', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'slideOutLeft', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.SLIDE_RIGHT: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'slideInRight', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'slideOutRight', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.FLIP_X: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'flipInX', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'flipOutX', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.FADE_UP: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'fadeInUp', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'fadeOutDown', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.FADE_IN: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'fadeIn', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'fadeOut', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.FADE_DOWN: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'fadeInDown', animationDuration: `${ timeout }ms` - } + }; case EXITING: return { animationName: 'fadeOutUp', animationDuration: `${ timeout }ms` - } + }; } case TransitionAnimationTypes.HEAD_SHAKE: - switch (transition) + switch(transition) { default: - return {} + return {}; case ENTERING: return { animationName: 'headShake', animationDuration: `${ timeout }ms` - } + }; } } diff --git a/src/common/utils/CreateTransitionToIcon.ts b/src/common/utils/CreateTransitionToIcon.ts index 656eea56..20e98858 100644 --- a/src/common/utils/CreateTransitionToIcon.ts +++ b/src/common/utils/CreateTransitionToIcon.ts @@ -10,4 +10,4 @@ export const CreateTransitionToIcon = (image: HTMLImageElement, fromElement: HTM event.iconName = icon; GetEventDispatcher().dispatchEvent(event); -} +}; diff --git a/src/common/utils/FriendlyTimeView.tsx b/src/common/utils/FriendlyTimeView.tsx index cf5a6350..4a85c4ab 100644 --- a/src/common/utils/FriendlyTimeView.tsx +++ b/src/common/utils/FriendlyTimeView.tsx @@ -25,4 +25,4 @@ export const FriendlyTimeView: FC = props => const value = (Math.round(new Date().getSeconds()) - getStartSeconds); return { isShort ? FriendlyTime.shortFormat(value) : FriendlyTime.format(value) }; -} +}; diff --git a/src/components/MainView.tsx b/src/components/MainView.tsx index 673aa310..b86ac449 100644 --- a/src/components/MainView.tsx +++ b/src/components/MainView.tsx @@ -44,13 +44,13 @@ export const MainView: FC<{}> = props => useEffect(() => { - const linkTracker: ILinkEventTracker = { + const linkTracker: ILinkEventTracker = { linkReceived: (url: string) => { const parts = url.split('/'); - + if(parts.length < 2) return; - + switch(parts[1]) { case 'open': @@ -108,4 +108,4 @@ export const MainView: FC<{}> = props => ); -} +}; diff --git a/src/components/achievements/AchievementsView.tsx b/src/components/achievements/AchievementsView.tsx index 4e2f3786..ded955b3 100644 --- a/src/components/achievements/AchievementsView.tsx +++ b/src/components/achievements/AchievementsView.tsx @@ -1,15 +1,28 @@ -import { AddLinkEventTracker, ILinkEventTracker, RemoveLinkEventTracker } from '@nitrots/nitro-renderer'; +import { + AddLinkEventTracker, + ILinkEventTracker, + RemoveLinkEventTracker, +} from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { AchievementUtilities, LocalizeText } from '../../api'; -import { Column, LayoutImage, LayoutProgressBar, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common'; +import { Column, LayoutImage, LayoutProgressBar, Text } from '../../common'; import { useAchievements } from '../../hooks'; +import { NitroCard } from '../../layout'; import { AchievementCategoryView } from './views/AchievementCategoryView'; import { AchievementsCategoryListView } from './views/category-list/AchievementsCategoryListView'; -export const AchievementsView: FC<{}> = props => +export const AchievementsView: FC<{}> = (props) => { - const [ isVisible, setIsVisible ] = useState(false); - const { achievementCategories = [], selectedCategoryCode = null, setSelectedCategoryCode = null, achievementScore = 0, getProgress = 0, getMaxProgress = 0, selectedCategory = null } = useAchievements(); + const [isVisible, setIsVisible] = useState(false); + const { + achievementCategories = [], + selectedCategoryCode = null, + setSelectedCategoryCode = null, + achievementScore = 0, + getProgress = 0, + getMaxProgress = 0, + selectedCategory = null, + } = useAchievements(); useEffect(() => { @@ -18,9 +31,9 @@ export const AchievementsView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setIsVisible(true); @@ -29,11 +42,11 @@ export const AchievementsView: FC<{}> = props => setIsVisible(false); return; case 'toggle': - setIsVisible(prevValue => !prevValue); + setIsVisible((prevValue) => !prevValue); return; } }, - eventUrlPrefix: 'achievements/' + eventUrlPrefix: 'achievements/', }; AddLinkEventTracker(linkTracker); @@ -41,32 +54,91 @@ export const AchievementsView: FC<{}> = props => return () => RemoveLinkEventTracker(linkTracker); }, []); - if (!isVisible) return null; + if(!isVisible) return null; return ( - - setIsVisible(false) } /> - { selectedCategory && -
-
setSelectedCategoryCode(null) } /> - - { LocalizeText(`quests.${ selectedCategory.code }.name`) } - { LocalizeText('achievements.details.categoryprogress', [ 'progress', 'limit' ], [ selectedCategory.getProgress().toString(), selectedCategory.getMaxProgress().toString() ]) } + + setIsVisible(false)} + /> + {selectedCategory && ( +
+
setSelectedCategoryCode(null)} + /> + + + {LocalizeText( + `quests.${selectedCategory.code}.name` + )} + + + {LocalizeText( + 'achievements.details.categoryprogress', + ['progress', 'limit'], + [ + selectedCategory.getProgress().toString(), + selectedCategory + .getMaxProgress() + .toString(), + ] + )} + - -
} - - { !selectedCategory && + +
+ )} + + {!selectedCategory && ( <> - - - { LocalizeText('achievements.categories.score', [ 'score' ], [ achievementScore.toString() ]) } - + + + + {LocalizeText( + 'achievements.categories.score', + ['score'], + [achievementScore.toString()] + )} + + - } - { selectedCategory && - } - - + + )} + {selectedCategory && ( + + )} + +
); }; diff --git a/src/components/achievements/views/AchievementBadgeView.tsx b/src/components/achievements/views/AchievementBadgeView.tsx index 5b0d4f93..ab83025f 100644 --- a/src/components/achievements/views/AchievementBadgeView.tsx +++ b/src/components/achievements/views/AchievementBadgeView.tsx @@ -16,4 +16,4 @@ export const AchievementBadgeView: FC = props => if(!achievement) return null; return ; -} +}; diff --git a/src/components/achievements/views/AchievementCategoryView.tsx b/src/components/achievements/views/AchievementCategoryView.tsx index 8774d208..b739f773 100644 --- a/src/components/achievements/views/AchievementCategoryView.tsx +++ b/src/components/achievements/views/AchievementCategoryView.tsx @@ -2,18 +2,20 @@ import { FC, useEffect } from 'react'; import { AchievementCategory } from '../../../api'; import { Column } from '../../../common'; import { useAchievements } from '../../../hooks'; -import { AchievementListView } from './achievement-list'; import { AchievementDetailsView } from './AchievementDetailsView'; +import { AchievementListView } from './achievement-list'; -interface AchievementCategoryViewProps -{ +interface AchievementCategoryViewProps { category: AchievementCategory; } -export const AchievementCategoryView: FC = props => +export const AchievementCategoryView: FC = ( + props, +) => { const { category = null } = props; - const { selectedAchievement = null, setSelectedAchievementId = null } = useAchievements(); + const { selectedAchievement = null, setSelectedAchievementId = null } = + useAchievements(); useEffect(() => { @@ -21,17 +23,20 @@ export const AchievementCategoryView: FC = props = if(!selectedAchievement) { - setSelectedAchievementId(category?.achievements?.[0]?.achievementId); + setSelectedAchievementId( + category?.achievements?.[0]?.achievementId, + ); } - }, [ category, selectedAchievement, setSelectedAchievementId ]); + }, [category, selectedAchievement, setSelectedAchievementId]); if(!category) return null; return ( - - { !!selectedAchievement && - } + + {!!selectedAchievement && ( + + )} ); -} +}; diff --git a/src/components/achievements/views/AchievementDetailsView.tsx b/src/components/achievements/views/AchievementDetailsView.tsx index 01a456ab..acb3d76d 100644 --- a/src/components/achievements/views/AchievementDetailsView.tsx +++ b/src/components/achievements/views/AchievementDetailsView.tsx @@ -13,7 +13,7 @@ export const AchievementDetailsView: FC = props => { const { achievement = null } = props; - if (!achievement) return null; + if(!achievement) return null; return ( @@ -49,5 +49,5 @@ export const AchievementDetailsView: FC = props =>
} - ) -} + ); +}; diff --git a/src/components/achievements/views/achievement-list/AchievementListItemView.tsx b/src/components/achievements/views/achievement-list/AchievementListItemView.tsx index 9da632bd..9229eca0 100644 --- a/src/components/achievements/views/achievement-list/AchievementListItemView.tsx +++ b/src/components/achievements/views/achievement-list/AchievementListItemView.tsx @@ -21,4 +21,4 @@ export const AchievementListItemView: FC = props = ); -} +}; diff --git a/src/components/achievements/views/achievement-list/AchievementListView.tsx b/src/components/achievements/views/achievement-list/AchievementListView.tsx index 0433617a..4a8b8fb1 100644 --- a/src/components/achievements/views/achievement-list/AchievementListView.tsx +++ b/src/components/achievements/views/achievement-list/AchievementListView.tsx @@ -17,4 +17,4 @@ export const AchievementListView: FC = props => { achievements && (achievements.length > 0) && achievements.map((achievement, index) => ) } ); -} +}; diff --git a/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx b/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx index a5453092..d52a103d 100644 --- a/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx +++ b/src/components/achievements/views/category-list/AchievementsCategoryListItemView.tsx @@ -28,4 +28,4 @@ export const AchievementsCategoryListItemView: FC ); -} +}; diff --git a/src/components/avatar-editor/AvatarEditorFigurePreviewView.tsx b/src/components/avatar-editor/AvatarEditorFigurePreviewView.tsx index 992f1ed8..25bb6097 100644 --- a/src/components/avatar-editor/AvatarEditorFigurePreviewView.tsx +++ b/src/components/avatar-editor/AvatarEditorFigurePreviewView.tsx @@ -13,18 +13,18 @@ export const AvatarEditorFigurePreviewView: FC<{}> = props => const rotateFigure = (newDirection: number) => { - if (direction < AvatarDirectionAngle.MIN_DIRECTION) + if(direction < AvatarDirectionAngle.MIN_DIRECTION) { newDirection = (AvatarDirectionAngle.MAX_DIRECTION + (direction + 1)); } - if (direction > AvatarDirectionAngle.MAX_DIRECTION) + if(direction > AvatarDirectionAngle.MAX_DIRECTION) { newDirection = (direction - (AvatarDirectionAngle.MAX_DIRECTION + 1)); } setDirection(newDirection); - } + }; return (
@@ -37,4 +37,4 @@ export const AvatarEditorFigurePreviewView: FC<{}> = props =>
); -} +}; diff --git a/src/components/avatar-editor/AvatarEditorIcon.tsx b/src/components/avatar-editor/AvatarEditorIcon.tsx index ae7baec3..f5623ed2 100644 --- a/src/components/avatar-editor/AvatarEditorIcon.tsx +++ b/src/components/avatar-editor/AvatarEditorIcon.tsx @@ -1,7 +1,7 @@ import { DetailedHTMLProps, HTMLAttributes, PropsWithChildren, forwardRef } from 'react'; import { classNames } from '../../layout'; -type AvatarIconType = 'male' | 'female' | 'clear' | 'sellable' | string; +type AvatarIconType = 'male' | 'female' | 'clear' | 'sellable'; export const AvatarEditorIcon = forwardRef { - if (!categories || !categories.length || !didChange) return; + if(!categories || !categories.length || !didChange) return; selectSet(categories[0]?.setType); setDidChange(false); @@ -43,7 +43,7 @@ export const AvatarEditorModelView: FC<{ setDidChange(true); }, [ categories ]); - if (!activeCategory) return null; + if(!activeCategory) return null; return (
@@ -77,4 +77,4 @@ export const AvatarEditorModelView: FC<{
); -} +}; diff --git a/src/components/avatar-editor/AvatarEditorView.tsx b/src/components/avatar-editor/AvatarEditorView.tsx index 50b9d0ae..5dea113e 100644 --- a/src/components/avatar-editor/AvatarEditorView.tsx +++ b/src/components/avatar-editor/AvatarEditorView.tsx @@ -18,7 +18,7 @@ export const AvatarEditorView: FC<{}> = props => const processAction = (action: string) => { - switch (action) + switch(action) { case AvatarEditorAction.ACTION_RESET: loadAvatarData(GetSessionDataManager().figure, GetSessionDataManager().gender); @@ -34,7 +34,7 @@ export const AvatarEditorView: FC<{}> = props => setIsVisible(false); return; } - } + }; useEffect(() => { @@ -43,9 +43,9 @@ export const AvatarEditorView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setIsVisible(true); @@ -68,10 +68,10 @@ export const AvatarEditorView: FC<{}> = props => useEffect(() => { - setEditorVisibility(isVisible) + setEditorVisibility(isVisible); }, [ isVisible, setEditorVisibility ]); - if (!isVisible) return null; + if(!isVisible) return null; return ( @@ -119,4 +119,4 @@ export const AvatarEditorView: FC<{}> = props => ); -} +}; diff --git a/src/components/avatar-editor/AvatarEditorWardrobeView.tsx b/src/components/avatar-editor/AvatarEditorWardrobeView.tsx index 10bf6620..6981bd5f 100644 --- a/src/components/avatar-editor/AvatarEditorWardrobeView.tsx +++ b/src/components/avatar-editor/AvatarEditorWardrobeView.tsx @@ -38,7 +38,7 @@ export const AvatarEditorWardrobeView: FC<{}> = props => { const [ figureContainer, gender ] = item; - + let clubLevel = 0; if(figureContainer) clubLevel = GetAvatarRenderManager().getFigureClubLevel(figureContainer, gender); @@ -55,7 +55,7 @@ export const AvatarEditorWardrobeView: FC<{}> = props => } - ) + ); } } items={ savedFigures } overscan={ 5 } /> ); -} +}; diff --git a/src/components/avatar-editor/figure-set/AvatarEditorFigureSetItemView.tsx b/src/components/avatar-editor/figure-set/AvatarEditorFigureSetItemView.tsx index 699e57eb..4126fa3a 100644 --- a/src/components/avatar-editor/figure-set/AvatarEditorFigureSetItemView.tsx +++ b/src/components/avatar-editor/figure-set/AvatarEditorFigureSetItemView.tsx @@ -22,7 +22,7 @@ export const AvatarEditorFigureSetItemView: FC<{ useEffect(() => { if(!setType || !setType.length || !partItem) return; - + const loadImage = async () => { const isHC = !GetConfigurationValue('hc.disabled', false) && ((partItem.partSet?.clubLevel ?? 0) > 0); @@ -39,7 +39,7 @@ export const AvatarEditorFigureSetItemView: FC<{ } if(url && url.length) setAssetUrl(url); - } + }; loadImage(); }, [ setType, partItem, selectedColorParts, getFigureStringWithFace ]); @@ -53,4 +53,4 @@ export const AvatarEditorFigureSetItemView: FC<{ { !partItem.isClear && partItem.partSet.isSellable && } ); -} +}; diff --git a/src/components/avatar-editor/figure-set/AvatarEditorFigureSetView.tsx b/src/components/avatar-editor/figure-set/AvatarEditorFigureSetView.tsx index d928fabb..9a5b5432 100644 --- a/src/components/avatar-editor/figure-set/AvatarEditorFigureSetView.tsx +++ b/src/components/avatar-editor/figure-set/AvatarEditorFigureSetView.tsx @@ -15,18 +15,18 @@ export const AvatarEditorFigureSetView: FC<{ const isPartItemSelected = (partItem: IAvatarEditorCategoryPartItem) => { if(!category || !category.setType || !selectedParts) return false; - + if(!selectedParts[category.setType]) { if(partItem.isClear) return true; - + return false; } const partId = selectedParts[category.setType]; return (partId === partItem.id); - } + }; return ( columnCount={ columnCount } itemRender={ (item: IAvatarEditorCategoryPartItem) => @@ -35,7 +35,7 @@ export const AvatarEditorFigureSetView: FC<{ return ( selectEditorPart(category.setType, item.partSet?.id ?? -1) } /> - ) + ); } } items={ category.partItems } overscan={ columnCount } /> ); -} +}; diff --git a/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetItemView.tsx b/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetItemView.tsx index 9fc6eb3c..8a520bc5 100644 --- a/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetItemView.tsx +++ b/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetItemView.tsx @@ -13,7 +13,7 @@ export const AvatarEditorPaletteSetItem: FC<{ { const { setType = null, partColor = null, isSelected = false, width = '100%', ...rest } = props; - if (!partColor) return null; + if(!partColor) return null; const isHC = !GetConfigurationValue('hc.disabled', false) && (partColor.clubLevel > 0); @@ -22,4 +22,4 @@ export const AvatarEditorPaletteSetItem: FC<{ { isHC && } ); -} +}; diff --git a/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetView.tsx b/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetView.tsx index 37788790..d40c8d1c 100644 --- a/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetView.tsx +++ b/src/components/avatar-editor/palette-set/AvatarEditorPaletteSetView.tsx @@ -16,21 +16,21 @@ export const AvatarEditorPaletteSetView: FC<{ const isPartColorSelected = (partColor: IPartColor) => { - if (!category || !category.setType || !selectedColorParts || !selectedColorParts[category.setType] || !selectedColorParts[category.setType][paletteIndex]) return false; + if(!category || !category.setType || !selectedColorParts || !selectedColorParts[category.setType] || !selectedColorParts[category.setType][paletteIndex]) return false; const selectedColorPart = selectedColorParts[category.setType][paletteIndex]; return (selectedColorPart.id === partColor.id); - } + }; return ( columnCount={ columnCount } itemRender={ (item: IPartColor) => { - if (!item) return null; + if(!item) return null; return ( selectEditorColor(category.setType, paletteIndex, item.id) } /> - ) + ); } } items={ category.colorItems[paletteIndex] } overscan={ columnCount } /> ); -} +}; diff --git a/src/components/camera/CameraWidgetView.tsx b/src/components/camera/CameraWidgetView.tsx index 93b23786..d4221e84 100644 --- a/src/components/camera/CameraWidgetView.tsx +++ b/src/components/camera/CameraWidgetView.tsx @@ -14,12 +14,12 @@ export const CameraWidgetView: FC<{}> = props => { const [ mode, setMode ] = useState(MODE_NONE); const [ base64Url, setSavedPictureUrl ] = useState(null); - const { availableEffects = [], selectedPictureIndex = -1, cameraRoll = [], setCameraRoll = null, myLevel = 0, price = { credits: 0, duckets: 0, publishDucketPrice: 0 }} = useCamera(); + const { availableEffects = [], selectedPictureIndex = -1, cameraRoll = [], setCameraRoll = null, myLevel = 0, price = { credits: 0, duckets: 0, publishDucketPrice: 0 } } = useCamera(); const processAction = (type: string) => { - switch (type) + switch(type) { case 'close': setMode(MODE_NONE); @@ -41,13 +41,13 @@ export const CameraWidgetView: FC<{}> = props => setMode(MODE_CAPTURE); return; } - } + }; const checkoutPictureUrl = (pictureUrl: string) => { setSavedPictureUrl(pictureUrl); setMode(MODE_CHECKOUT); - } + }; useNitroEvent(RoomSessionEvent.ENDED, event => setMode(MODE_NONE)); @@ -58,9 +58,9 @@ export const CameraWidgetView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setMode(MODE_CAPTURE); @@ -71,7 +71,7 @@ export const CameraWidgetView: FC<{}> = props => case 'toggle': setMode(prevValue => { - if (!prevValue) return MODE_CAPTURE; + if(!prevValue) return MODE_CAPTURE; else return MODE_NONE; }); return; @@ -85,7 +85,7 @@ export const CameraWidgetView: FC<{}> = props => return () => RemoveLinkEventTracker(linkTracker); }, []); - if (mode === MODE_NONE) return null; + if(mode === MODE_NONE) return null; return ( <> @@ -94,4 +94,4 @@ export const CameraWidgetView: FC<{}> = props => { (mode === MODE_CHECKOUT) && processAction('editor_cancel') } onCloseClick={ () => processAction('close') }> } ); -} +}; diff --git a/src/components/camera/views/CameraWidgetCaptureView.tsx b/src/components/camera/views/CameraWidgetCaptureView.tsx index b38f0a9b..89fe25ee 100644 --- a/src/components/camera/views/CameraWidgetCaptureView.tsx +++ b/src/components/camera/views/CameraWidgetCaptureView.tsx @@ -25,16 +25,16 @@ export const CameraWidgetCaptureView: FC = props = const getCameraBounds = () => { - if (!elementRef || !elementRef.current) return null; + if(!elementRef || !elementRef.current) return null; const frameBounds = elementRef.current.getBoundingClientRect(); return new NitroRectangle(Math.floor(frameBounds.x), Math.floor(frameBounds.y), Math.floor(frameBounds.width), Math.floor(frameBounds.height)); - } + }; const takePicture = async () => { - if (selectedPictureIndex > -1) + if(selectedPictureIndex > -1) { setSelectedPictureIndex(-1); return; @@ -44,7 +44,7 @@ export const CameraWidgetCaptureView: FC = props = const clone = [ ...cameraRoll ]; - if (clone.length >= CAMERA_ROLL_LIMIT) + if(clone.length >= CAMERA_ROLL_LIMIT) { simpleAlert(LocalizeText('camera.full.body')); @@ -55,7 +55,7 @@ export const CameraWidgetCaptureView: FC = props = clone.push(new CameraPicture(texture, await TextureUtils.generateImageUrl(texture))); setCameraRoll(clone); - } + }; return ( @@ -87,4 +87,4 @@ export const CameraWidgetCaptureView: FC = props = ); -} +}; diff --git a/src/components/camera/views/CameraWidgetCheckoutView.tsx b/src/components/camera/views/CameraWidgetCheckoutView.tsx index 290ce6bc..2ab2f5b2 100644 --- a/src/components/camera/views/CameraWidgetCheckoutView.tsx +++ b/src/components/camera/views/CameraWidgetCheckoutView.tsx @@ -49,19 +49,19 @@ export const CameraWidgetCheckoutView: FC = props const processAction = (type: string, value: string | number = null) => { - switch (type) + switch(type) { case 'close': onCloseClick(); return; case 'buy': - if (isWaiting) return; + if(isWaiting) return; setIsWaiting(true); SendMessageComposer(new PurchasePhotoMessageComposer('')); return; case 'publish': - if (isWaiting) return; + if(isWaiting) return; setIsWaiting(true); SendMessageComposer(new PublishPhotoMessageComposer()); @@ -70,16 +70,16 @@ export const CameraWidgetCheckoutView: FC = props onCancelClick(); return; } - } + }; useEffect(() => { - if (!base64Url) return; + if(!base64Url) return; GetRoomEngine().saveBase64AsScreenshot(base64Url); }, [ base64Url ]); - if (!price) return null; + if(!price) return null; return ( @@ -156,4 +156,4 @@ export const CameraWidgetCheckoutView: FC = props ); -} +}; diff --git a/src/components/camera/views/CameraWidgetShowPhotoView.tsx b/src/components/camera/views/CameraWidgetShowPhotoView.tsx index d611687e..08d3a298 100644 --- a/src/components/camera/views/CameraWidgetShowPhotoView.tsx +++ b/src/components/camera/views/CameraWidgetShowPhotoView.tsx @@ -22,11 +22,11 @@ export const CameraWidgetShowPhotoView: FC = pro { let newIndex = (prevValue + 1); - if (newIndex >= currentPhotos.length) newIndex = 0; + if(newIndex >= currentPhotos.length) newIndex = 0; return newIndex; }); - } + }; const previous = () => { @@ -34,18 +34,18 @@ export const CameraWidgetShowPhotoView: FC = pro { let newIndex = (prevValue - 1); - if (newIndex < 0) newIndex = (currentPhotos.length - 1); + if(newIndex < 0) newIndex = (currentPhotos.length - 1); return newIndex; }); - } + }; useEffect(() => { setImageIndex(currentIndex); }, [ currentIndex ]); - if (!currentImage) return null; + if(!currentImage) return null; return ( @@ -68,4 +68,4 @@ export const CameraWidgetShowPhotoView: FC = pro } ); -} +}; diff --git a/src/components/camera/views/editor/CameraWidgetEditorView.tsx b/src/components/camera/views/editor/CameraWidgetEditorView.tsx index 4152808f..4c6a9c91 100644 --- a/src/components/camera/views/editor/CameraWidgetEditorView.tsx +++ b/src/components/camera/views/editor/CameraWidgetEditorView.tsx @@ -40,7 +40,7 @@ export const CameraWidgetEditorView: FC = props => const getEffectList = useCallback(() => { - if (currentTab === CameraEditorTabs.COLORMATRIX) + if(currentTab === CameraEditorTabs.COLORMATRIX) { return getColorMatrixEffects; } @@ -50,19 +50,19 @@ export const CameraWidgetEditorView: FC = props => const getSelectedEffectIndex = useCallback((name: string) => { - if (!name || !name.length || !selectedEffects || !selectedEffects.length) return -1; + if(!name || !name.length || !selectedEffects || !selectedEffects.length) return -1; return selectedEffects.findIndex(effect => (effect.effect.name === name)); - }, [ selectedEffects ]) + }, [ selectedEffects ]); const getCurrentEffectIndex = useMemo(() => { - return getSelectedEffectIndex(selectedEffectName) - }, [ selectedEffectName, getSelectedEffectIndex ]) + return getSelectedEffectIndex(selectedEffectName); + }, [ selectedEffectName, getSelectedEffectIndex ]); const getCurrentEffect = useMemo(() => { - if (!selectedEffectName) return null; + if(!selectedEffectName) return null; return (selectedEffects[getCurrentEffectIndex] || null); }, [ selectedEffectName, getCurrentEffectIndex, selectedEffects ]); @@ -71,7 +71,7 @@ export const CameraWidgetEditorView: FC = props => { const index = getCurrentEffectIndex; - if (index === -1) return; + if(index === -1) return; setSelectedEffects(prevValue => { @@ -86,7 +86,7 @@ export const CameraWidgetEditorView: FC = props => const processAction = useCallback((type: string, effectName: string = null) => { - switch (type) + switch(type) { case 'close': onClose(); @@ -103,11 +103,11 @@ export const CameraWidgetEditorView: FC = props => case 'select_effect': { let existingIndex = getSelectedEffectIndex(effectName); - if (existingIndex >= 0) return; + if(existingIndex >= 0) return; const effect = availableEffects.find(effect => (effect.name === effectName)); - if (!effect) return; + if(!effect) return; setSelectedEffects(prevValue => { @@ -120,7 +120,7 @@ export const CameraWidgetEditorView: FC = props => case 'remove_effect': { let existingIndex = getSelectedEffectIndex(effectName); - if (existingIndex === -1) return; + if(existingIndex === -1) return; setSelectedEffects(prevValue => { @@ -131,7 +131,7 @@ export const CameraWidgetEditorView: FC = props => return clone; }); - if (selectedEffectName === effectName) setSelectedEffectName(null); + if(selectedEffectName === effectName) setSelectedEffectName(null); return; } case 'clear_effects': @@ -143,7 +143,7 @@ export const CameraWidgetEditorView: FC = props => { const image = new Image(); - image.src = currentPictureUrl + image.src = currentPictureUrl; const newWindow = window.open(''); newWindow.document.write(image.outerHTML); @@ -191,7 +191,7 @@ export const CameraWidgetEditorView: FC = props => { TABS.map(tab => { - return processAction('change_tab', tab) }> + return processAction('change_tab', tab) }>; }) } @@ -242,4 +242,4 @@ export const CameraWidgetEditorView: FC = props =>
); -} +}; diff --git a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx index 3e13c3fa..cda9f198 100644 --- a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx +++ b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListItemView.tsx @@ -41,4 +41,4 @@ export const CameraWidgetEffectListItemView: FC ); -} +}; diff --git a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx index 6f43e223..a006a79f 100644 --- a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx +++ b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx @@ -24,8 +24,8 @@ export const CameraWidgetEffectListView: FC = p const thumbnailUrl = (thumbnails.find(thumbnail => (thumbnail.effectName === effect.name))); const isActive = (selectedEffects.findIndex(selectedEffect => (selectedEffect.effect.name === effect.name)) > -1); - return myLevel) } removeEffect={ () => processAction('remove_effect', effect.name) } selectEffect={ () => processAction('select_effect', effect.name) } thumbnailUrl={ ((thumbnailUrl && thumbnailUrl.thumbnailUrl) || null) } /> + return myLevel) } removeEffect={ () => processAction('remove_effect', effect.name) } selectEffect={ () => processAction('select_effect', effect.name) } thumbnailUrl={ ((thumbnailUrl && thumbnailUrl.thumbnailUrl) || null) } />; }) } ); -} +}; diff --git a/src/components/campaign/CalendarItemView.tsx b/src/components/campaign/CalendarItemView.tsx index 13083a45..234387aa 100644 --- a/src/components/campaign/CalendarItemView.tsx +++ b/src/components/campaign/CalendarItemView.tsx @@ -15,7 +15,7 @@ interface CalendarItemViewProps export const CalendarItemView: FC = props => { const { itemId = -1, state = null, product = null, active = false, onClick = null } = props; - + const getFurnitureIcon = (name: string) => { let furniData = GetSessionDataManager().getFloorItemDataByName(name); @@ -30,7 +30,7 @@ export const CalendarItemView: FC = props => } return url; - } + }; return ( onClick(itemId) }> @@ -50,4 +50,4 @@ export const CalendarItemView: FC = props => } ); -} +}; diff --git a/src/components/campaign/CalendarView.tsx b/src/components/campaign/CalendarView.tsx index ade88186..057d088e 100644 --- a/src/components/campaign/CalendarView.tsx +++ b/src/components/campaign/CalendarView.tsx @@ -26,20 +26,20 @@ export const CalendarView: FC = props => const getDayState = (day: number) => { - if (openedDays.includes(day)) return CalendarItemState.STATE_UNLOCKED; + if(openedDays.includes(day)) return CalendarItemState.STATE_UNLOCKED; - if (day > currentDay) return CalendarItemState.STATE_LOCKED_FUTURE; + if(day > currentDay) return CalendarItemState.STATE_LOCKED_FUTURE; - if (missedDays.includes(day)) return CalendarItemState.STATE_LOCKED_EXPIRED; + if(missedDays.includes(day)) return CalendarItemState.STATE_LOCKED_EXPIRED; return CalendarItemState.STATE_LOCKED_AVAILABLE; - } + }; const dayMessage = (day: number) => { const state = getDayState(day); - switch (state) + switch(state) { case CalendarItemState.STATE_UNLOCKED: return LocalizeText('campaign.calendar.info.unlocked'); @@ -50,51 +50,51 @@ export const CalendarView: FC = props => default: return LocalizeText('campaign.calendar.info.available.desktop'); } - } + }; const onClickNext = () => { const nextDay = (selectedDay + 1); - if (nextDay === numDays) return; + if(nextDay === numDays) return; setSelectedDay(nextDay); - if ((index + TOTAL_SHOWN_ITEMS) < (nextDay + 1)) setIndex(index + 1); - } + if((index + TOTAL_SHOWN_ITEMS) < (nextDay + 1)) setIndex(index + 1); + }; const onClickPrev = () => { const prevDay = (selectedDay - 1); - if (prevDay < 0) return; + if(prevDay < 0) return; setSelectedDay(prevDay); - if (index > prevDay) setIndex(index - 1); - } + if(index > prevDay) setIndex(index - 1); + }; const onClickItem = (item: number) => { - if (selectedDay === item) + if(selectedDay === item) { const state = getDayState(item); - if (state === CalendarItemState.STATE_LOCKED_AVAILABLE) openPackage(item, false); + if(state === CalendarItemState.STATE_LOCKED_AVAILABLE) openPackage(item, false); return; } setSelectedDay(item); - } + }; const forceOpen = () => { const id = selectedDay; const state = getDayState(id); - if (state !== CalendarItemState.STATE_UNLOCKED) openPackage(id, true); - } + if(state !== CalendarItemState.STATE_UNLOCKED) openPackage(id, true); + }; return ( @@ -140,5 +140,5 @@ export const CalendarView: FC = props => - ) -} + ); +}; diff --git a/src/components/campaign/CampaignView.tsx b/src/components/campaign/CampaignView.tsx index a2fd097c..76230f48 100644 --- a/src/components/campaign/CampaignView.tsx +++ b/src/components/campaign/CampaignView.tsx @@ -26,14 +26,14 @@ export const CampaignView: FC<{}> = props => { SendMessageComposer(new OpenCampaignCalendarDoorComposer(calendarData.campaignName, id)); } - } + }; useMessageEvent(CampaignCalendarDataMessageEvent, event => { const parser = event.getParser(); if(!parser) return; - + setCalendarData(parser.calendarData); }); @@ -47,19 +47,19 @@ export const CampaignView: FC<{}> = props => if(parser.doorOpened) { - setCalendarData(prev => + setCalendarData(prev => { const copy = prev.clone(); copy.openedDays.push(lastOpenAttempt); - + return copy; }); - + setReceivedProducts(prev => { const copy = new Map(prev); copy.set(lastAttempt, new CalendarItem(parser.productName, parser.customImage,parser.furnitureClassName)); - + return copy; }); } @@ -73,9 +73,9 @@ export const CampaignView: FC<{}> = props => linkReceived: (url: string) => { const value = url.split('/'); - + if(value.length < 2) return; - + switch(value[1]) { case 'calendar': @@ -93,9 +93,9 @@ export const CampaignView: FC<{}> = props => return ( <> - { (calendarData && isCalendarOpen) && + { (calendarData && isCalendarOpen) && setCalendarOpen(false) } /> } - ) -} + ); +}; diff --git a/src/components/catalog/CatalogView.tsx b/src/components/catalog/CatalogView.tsx index 4cb54553..d7ee89fc 100644 --- a/src/components/catalog/CatalogView.tsx +++ b/src/components/catalog/CatalogView.tsx @@ -20,9 +20,9 @@ export const CatalogView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setIsVisible(true); @@ -34,11 +34,11 @@ export const CatalogView: FC<{}> = props => setIsVisible(prevValue => !prevValue); return; case 'open': - if (parts.length > 2) + if(parts.length > 2) { - if (parts.length === 4) + if(parts.length === 4) { - switch (parts[2]) + switch(parts[2]) { case 'offerId': openPageByOfferId(parseInt(parts[3])); @@ -74,12 +74,12 @@ export const CatalogView: FC<{}> = props => { rootNode && (rootNode.children.length > 0) && rootNode.children.map(child => { - if (!child.isVisible) return null; + if(!child.isVisible) return null; return ( { - if (searchResult) setSearchResult(null); + if(searchResult) setSearchResult(null); activateNode(child); } } > @@ -108,4 +108,4 @@ export const CatalogView: FC<{}> = props => ); -} +}; diff --git a/src/components/catalog/views/CatalogPurchaseConfirmView.tsx b/src/components/catalog/views/CatalogPurchaseConfirmView.tsx index 30dcfc3b..84ce0860 100644 --- a/src/components/catalog/views/CatalogPurchaseConfirmView.tsx +++ b/src/components/catalog/views/CatalogPurchaseConfirmView.tsx @@ -7,4 +7,4 @@ export const CatalogPurchaseConfirmView: FC<{}> = props => return (
); -} +}; diff --git a/src/components/catalog/views/catalog-header/CatalogHeaderView.tsx b/src/components/catalog/views/catalog-header/CatalogHeaderView.tsx index 8a49fa06..09ec0893 100644 --- a/src/components/catalog/views/catalog-header/CatalogHeaderView.tsx +++ b/src/components/catalog/views/catalog-header/CatalogHeaderView.tsx @@ -17,9 +17,9 @@ export const CatalogHeaderView: FC = props => }, [ imageUrl ]); return
- + { currentTarget.src = GetConfigurationValue('catalog.asset.image.url').replace('%name%', 'catalog_header_roombuilder'); } } />
; -} +}; diff --git a/src/components/catalog/views/catalog-icon/CatalogIconView.tsx b/src/components/catalog/views/catalog-icon/CatalogIconView.tsx index 23760476..01786629 100644 --- a/src/components/catalog/views/catalog-icon/CatalogIconView.tsx +++ b/src/components/catalog/views/catalog-icon/CatalogIconView.tsx @@ -17,4 +17,4 @@ export const CatalogIconView: FC = props => }, [ icon ]); return ; -} +}; diff --git a/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx index 345d7474..87738d52 100644 --- a/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx +++ b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx @@ -15,11 +15,11 @@ export const CatalogRoomPreviewerView: FC<{ useUiEvent(CatalogPurchasedEvent.PURCHASE_SUCCESS, event => { if(!elementRef) return; - + const renderTexture = roomPreviewer.getRoomObjectCurrentImage(); if(!renderTexture) return; - + (async () => { const image = await TextureUtils.generateImage(renderTexture); @@ -44,4 +44,4 @@ export const CatalogRoomPreviewerView: FC<{ ); -} +}; diff --git a/src/components/catalog/views/gift/CatalogGiftView.tsx b/src/components/catalog/views/gift/CatalogGiftView.tsx index 1f415761..c027fba8 100644 --- a/src/components/catalog/views/gift/CatalogGiftView.tsx +++ b/src/components/catalog/views/gift/CatalogGiftView.tsx @@ -44,7 +44,7 @@ export const CatalogGiftView: FC<{}> = props => setIsAutocompleteVisible(false); setSuggestions([]); - if (colors.length) setSelectedColorId(colors[0].id); + if(colors.length) setSelectedColorId(colors[0].id); }, [ colors ]); const isBoxDefault = useMemo(() => @@ -54,16 +54,16 @@ export const CatalogGiftView: FC<{}> = props => const boxExtraData = useMemo(() => { - if (!giftConfiguration) return ''; + if(!giftConfiguration) return ''; return ((boxTypes[selectedBoxIndex] * 1000) + giftConfiguration.ribbonTypes[selectedRibbonIndex]).toString(); }, [ giftConfiguration, selectedBoxIndex, selectedRibbonIndex, boxTypes ]); const isColorable = useMemo(() => { - if (!giftConfiguration) return false; + if(!giftConfiguration) return false; - if (isBoxDefault) return false; + if(isBoxDefault) return false; const boxType = boxTypes[selectedBoxIndex]; @@ -73,7 +73,7 @@ export const CatalogGiftView: FC<{}> = props => const colourId = useMemo(() => { return isBoxDefault ? boxTypes[selectedBoxIndex] : selectedColorId; - }, [ isBoxDefault, boxTypes, selectedBoxIndex, selectedColorId ]) + }, [ isBoxDefault, boxTypes, selectedBoxIndex, selectedColorId ]); const allFriends = friends.filter((friend: MessengerFriend) => friend.id !== -1); @@ -83,7 +83,7 @@ export const CatalogGiftView: FC<{}> = props => let suggestions = []; - if (value.length > 0) + if(value.length > 0) { suggestions = allFriends.sort().filter((friend: MessengerFriend) => friend.name.includes(value)); } @@ -97,11 +97,11 @@ export const CatalogGiftView: FC<{}> = props => { setReceiverName(friendName); setIsAutocompleteVisible(false); - } + }; const handleAction = useCallback((action: string) => { - switch (action) + switch(action) { case 'prev_box': setSelectedBoxIndex(value => (value === 0 ? maxBoxIndex : value - 1)); @@ -116,7 +116,7 @@ export const CatalogGiftView: FC<{}> = props => setSelectedRibbonIndex(value => (value === maxRibbonIndex ? 0 : value + 1)); return; case 'buy': - if (!receiverName || (receiverName.length === 0)) + if(!receiverName || (receiverName.length === 0)) { setReceiverNotFound(true); return; @@ -133,7 +133,7 @@ export const CatalogGiftView: FC<{}> = props => CatalogPurchasedEvent.PURCHASE_SUCCESS, CatalogEvent.INIT_GIFT ], event => { - switch (event.type) + switch(event.type) { case CatalogPurchasedEvent.PURCHASE_SUCCESS: onClose(); @@ -158,7 +158,7 @@ export const CatalogGiftView: FC<{}> = props => const createBoxTypes = useCallback(() => { - if (!giftConfiguration) return; + if(!giftConfiguration) return; setBoxTypes(prev => { @@ -170,27 +170,27 @@ export const CatalogGiftView: FC<{}> = props => setMaxRibbonIndex(newPrev.length - 1); return newPrev; - }) - }, [ giftConfiguration ]) + }); + }, [ giftConfiguration ]); useEffect(() => { - if (!giftConfiguration) return; + if(!giftConfiguration) return; const newColors: { id: number, color: string }[] = []; - for (const colorId of giftConfiguration.stuffTypes) + for(const colorId of giftConfiguration.stuffTypes) { const giftData = GetSessionDataManager().getFloorItemData(colorId); - if (!giftData) continue; + if(!giftData) continue; - if (giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: ColorUtils.makeColorNumberHex(giftData.colors[0]) }); + if(giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: ColorUtils.makeColorNumberHex(giftData.colors[0]) }); } createBoxTypes(); - if (newColors.length) + if(newColors.length) { setSelectedColorId(newColors[0].id); setColors(newColors); @@ -199,12 +199,12 @@ export const CatalogGiftView: FC<{}> = props => useEffect(() => { - if (!isVisible) return; + if(!isVisible) return; createBoxTypes(); - }, [ createBoxTypes, isVisible ]) + }, [ createBoxTypes, isVisible ]); - if (!giftConfiguration || !giftConfiguration.isEnabled || !isVisible) return null; + if(!giftConfiguration || !giftConfiguration.isEnabled || !isVisible) return null; const boxName = 'catalog.gift_wrapping_new.box.' + (isBoxDefault ? 'default' : boxTypes[selectedBoxIndex]); const ribbonName = `catalog.gift_wrapping_new.ribbon.${ selectedRibbonIndex }`; diff --git a/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx b/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx index 8836b172..1bb4373b 100644 --- a/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx @@ -32,4 +32,4 @@ export const CatalogNavigationItemView: FC = pro } ); -} +}; diff --git a/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx b/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx index 7651ac2b..92923fdc 100644 --- a/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx @@ -11,15 +11,15 @@ export interface CatalogNavigationSetViewProps export const CatalogNavigationSetView: FC = props => { const { node = null, child = false } = props; - + return ( <> { node && (node.children.length > 0) && node.children.map((n, index) => { if(!n.isVisible) return null; - - return + + return ; }) } ); -} +}; diff --git a/src/components/catalog/views/navigation/CatalogNavigationView.tsx b/src/components/catalog/views/navigation/CatalogNavigationView.tsx index 7b1092bd..da5c850c 100644 --- a/src/components/catalog/views/navigation/CatalogNavigationView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationView.tsx @@ -31,4 +31,4 @@ export const CatalogNavigationView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/common/CatalogGridOfferView.tsx b/src/components/catalog/views/page/common/CatalogGridOfferView.tsx index cdd2db71..f99bbad0 100644 --- a/src/components/catalog/views/page/common/CatalogGridOfferView.tsx +++ b/src/components/catalog/views/page/common/CatalogGridOfferView.tsx @@ -44,7 +44,7 @@ export const CatalogGridOfferView: FC = props => requestOfferToMover(offer); return; } - } + }; const product = offer.product; @@ -56,4 +56,4 @@ export const CatalogGridOfferView: FC = props => } ); -} +}; diff --git a/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx b/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx index 92163cd5..c3469ecf 100644 --- a/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx +++ b/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx @@ -20,12 +20,12 @@ export const CatalogRedeemVoucherView: FC = props const redeemVoucher = () => { - if (!voucher || !voucher.length || isWaiting) return; + if(!voucher || !voucher.length || isWaiting) return; SendMessageComposer(new RedeemVoucherMessageComposer(voucher)); setIsWaiting(true); - } + }; useMessageEvent(VoucherRedeemOkMessageEvent, event => { @@ -33,7 +33,7 @@ export const CatalogRedeemVoucherView: FC = props let message = LocalizeText('catalog.alert.voucherredeem.ok.description'); - if (parser.productName) message = LocalizeText('catalog.alert.voucherredeem.ok.description.furni', [ 'productName', 'productDescription' ], [ parser.productName, parser.productDescription ]); + if(parser.productName) message = LocalizeText('catalog.alert.voucherredeem.ok.description.furni', [ 'productName', 'productDescription' ], [ parser.productName, parser.productDescription ]); simpleAlert(message, null, null, null, LocalizeText('catalog.alert.voucherredeem.ok.title')); @@ -64,4 +64,4 @@ export const CatalogRedeemVoucherView: FC = props ); -} +}; diff --git a/src/components/catalog/views/page/common/CatalogSearchView.tsx b/src/components/catalog/views/page/common/CatalogSearchView.tsx index 6b544130..dc3f34b6 100644 --- a/src/components/catalog/views/page/common/CatalogSearchView.tsx +++ b/src/components/catalog/views/page/common/CatalogSearchView.tsx @@ -15,7 +15,7 @@ export const CatalogSearchView: FC<{}> = props => { let search = searchValue?.toLocaleLowerCase().replace(' ', ''); - if (!search || !search.length) + if(!search || !search.length) { setSearchResult(null); @@ -26,24 +26,24 @@ export const CatalogSearchView: FC<{}> = props => { const furnitureDatas = GetSessionDataManager().getAllFurnitureData(); - if (!furnitureDatas || !furnitureDatas.length) return; + if(!furnitureDatas || !furnitureDatas.length) return; const foundFurniture: IFurnitureData[] = []; const foundFurniLines: string[] = []; - for (const furniture of furnitureDatas) + for(const furniture of furnitureDatas) { - if ((currentType === CatalogType.BUILDER) && !furniture.availableForBuildersClub) continue; + if((currentType === CatalogType.BUILDER) && !furniture.availableForBuildersClub) continue; - if ((currentType === CatalogType.NORMAL) && furniture.excludeDynamic) continue; + if((currentType === CatalogType.NORMAL) && furniture.excludeDynamic) continue; const searchValues = [ furniture.className, furniture.name, furniture.description ].join(' ').replace(/ /gi, '').toLowerCase(); - if ((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1)) + if((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1)) { - if ((furniture.furniLine !== '') && (foundFurniLines.indexOf(furniture.furniLine) < 0)) + if((furniture.furniLine !== '') && (foundFurniLines.indexOf(furniture.furniLine) < 0)) { - if (searchValues.indexOf(search) >= 0) foundFurniLines.push(furniture.furniLine); + if(searchValues.indexOf(search) >= 0) foundFurniLines.push(furniture.furniLine); } } else @@ -53,18 +53,18 @@ export const CatalogSearchView: FC<{}> = props => ...GetOfferNodes(offersToNodes, furniture.rentOfferId) ]; - if (foundNodes.length) + if(foundNodes.length) { - if (searchValues.indexOf(search) >= 0) foundFurniture.push(furniture); + if(searchValues.indexOf(search) >= 0) foundFurniture.push(furniture); - if (foundFurniture.length === 250) break; + if(foundFurniture.length === 250) break; } } } const offers: IPurchasableOffer[] = []; - for (const furniture of foundFurniture) offers.push(new FurnitureOffer(furniture)); + for(const furniture of foundFurniture) offers.push(new FurnitureOffer(furniture)); let nodes: ICatalogNode[] = []; @@ -103,4 +103,4 @@ export const CatalogSearchView: FC<{}> = props => } ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutBadgeDisplayView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutBadgeDisplayView.tsx index 26202694..224946ef 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutBadgeDisplayView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutBadgeDisplayView.tsx @@ -51,4 +51,4 @@ export const CatalogLayoutBadgeDisplayView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutColorGroupingView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutColorGroupingView.tsx index cb759c76..41d20145 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutColorGroupingView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutColorGroupingView.tsx @@ -27,49 +27,49 @@ export const CatalogLayoutColorGroupingView: FC { - if (((!(a.product.furnitureData.colorIndex)) || (!(b.product.furnitureData.colorIndex)))) + if(((!(a.product.furnitureData.colorIndex)) || (!(b.product.furnitureData.colorIndex)))) { return 1; } - if (a.product.furnitureData.colorIndex > b.product.furnitureData.colorIndex) + if(a.product.furnitureData.colorIndex > b.product.furnitureData.colorIndex) { return 1; } - if (a == b) + if(a == b) { return 0; } return -1; - } + }; const sortyByFurnitureClassName = (a: IPurchasableOffer, b: IPurchasableOffer) => { - if (a.product.furnitureData.className > b.product.furnitureData.className) + if(a.product.furnitureData.className > b.product.furnitureData.className) { return 1; } - if (a == b) + if(a == b) { return 0; } return -1; - } + }; const selectOffer = (offer: IPurchasableOffer) => { offer.activate(); setCurrentOffer(offer); - } + }; const selectColor = (colorIndex: number, productName: string) => { const fullName = `${ productName }*${ colorIndex }`; const index = page.offers.findIndex(offer => offer.product.furnitureData.fullName === fullName); - if (index > -1) + if(index > -1) { selectOffer(page.offers[index]); } - } + }; const offers = useMemo(() => { @@ -81,11 +81,11 @@ export const CatalogLayoutColorGroupingView: FC { - if (!offer.product) return; + if(!offer.product) return; const furniData = offer.product.furnitureData; - if (!furniData || !furniData.hasIndexedColor) + if(!furniData || !furniData.hasIndexedColor) { offers.push(offer); } @@ -94,31 +94,31 @@ export const CatalogLayoutColorGroupingView: FC ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx index f87eb6b3..4b86622e 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutDefaultView.tsx @@ -58,4 +58,4 @@ export const CatalogLayoutDefaultView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutGuildCustomFurniView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutGuildCustomFurniView.tsx index cd8eab78..20805ba0 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutGuildCustomFurniView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutGuildCustomFurniView.tsx @@ -45,4 +45,4 @@ export const CatalogLayouGuildCustomFurniView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutGuildForumView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutGuildForumView.tsx index 889fbe62..ed87f497 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutGuildForumView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutGuildForumView.tsx @@ -46,4 +46,4 @@ export const CatalogLayouGuildForumView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutGuildFrontpageView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutGuildFrontpageView.tsx index 38b2f2b5..44f66b82 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutGuildFrontpageView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutGuildFrontpageView.tsx @@ -10,7 +10,7 @@ import { CatalogLayoutProps } from './CatalogLayout.types'; export const CatalogLayouGuildFrontpageView: FC = props => { const { page = null } = props; - + return ( @@ -26,4 +26,4 @@ export const CatalogLayouGuildFrontpageView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutInfoLoyaltyView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutInfoLoyaltyView.tsx index 91b175fe..a2a6a629 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutInfoLoyaltyView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutInfoLoyaltyView.tsx @@ -12,4 +12,4 @@ export const CatalogLayoutInfoLoyaltyView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutPets2View.tsx b/src/components/catalog/views/page/layout/CatalogLayoutPets2View.tsx index 38ad284a..3498fe05 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutPets2View.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutPets2View.tsx @@ -4,5 +4,5 @@ import { CatalogLayoutPets3View } from './CatalogLayoutPets3View'; export const CatalogLayoutPets2View: FC = props => { - return -} + return ; +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutPets3View.tsx b/src/components/catalog/views/page/layout/CatalogLayoutPets3View.tsx index e084c180..8c2e0850 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutPets3View.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutPets3View.tsx @@ -22,4 +22,4 @@ export const CatalogLayoutPets3View: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutRoomAdsView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutRoomAdsView.tsx index 999db2c6..4a62f886 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutRoomAdsView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutRoomAdsView.tsx @@ -21,7 +21,7 @@ export const CatalogLayoutRoomAdsView: FC = props => useEffect(() => { - if (isExtended) + if(isExtended) { setRoomId(promoteInformation.data.flatId); setEventName(promoteInformation.data.eventName); @@ -41,7 +41,7 @@ export const CatalogLayoutRoomAdsView: FC = props => setCategoryId(1); setIsExtended(false); setIsVisible(false); - } + }; const purchaseAd = () => { @@ -54,13 +54,13 @@ export const CatalogLayoutRoomAdsView: FC = props => SendMessageComposer(new PurchaseRoomAdMessageComposer(pageId, offerId, flatId, name, extended, desc, catId)); resetData(); - } + }; useMessageEvent(RoomAdPurchaseInfoEvent, event => { const parser = event.getParser(); - if (!parser) return; + if(!parser) return; setAvailableRooms(parser.rooms); }); @@ -106,7 +106,7 @@ export const CatalogLayoutRoomAdsView: FC = props => ); -} +}; interface INavigatorCategory { diff --git a/src/components/catalog/views/page/layout/CatalogLayoutRoomBundleView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutRoomBundleView.tsx index fbaf30af..29fe1547 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutRoomBundleView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutRoomBundleView.tsx @@ -38,4 +38,4 @@ export const CatalogLayoutRoomBundleView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutSingleBundleView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutSingleBundleView.tsx index c8002577..616375da 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutSingleBundleView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutSingleBundleView.tsx @@ -38,4 +38,4 @@ export const CatalogLayoutSingleBundleView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutSoundMachineView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutSoundMachineView.tsx index d03bfaef..9b64fbd8 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutSoundMachineView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutSoundMachineView.tsx @@ -26,24 +26,24 @@ export const CatalogLayoutSoundMachineView: FC = props => { const parser = event.getParser(); - if (parser.officialSongId !== officialSongId) return; + if(parser.officialSongId !== officialSongId) return; setSongId(parser.songId); }); useEffect(() => { - if (!currentOffer) return; + if(!currentOffer) return; const product = currentOffer.product; - if (!product) return; + if(!product) return; - if (product.extraParam.length > 0) + if(product.extraParam.length > 0) { const id = parseInt(product.extraParam); - if (id > 0) + if(id > 0) { setSongId(id); } @@ -110,4 +110,4 @@ export const CatalogLayoutSoundMachineView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutSpacesView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutSpacesView.tsx index 471b0d10..32865cea 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutSpacesView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutSpacesView.tsx @@ -44,4 +44,4 @@ export const CatalogLayoutSpacesView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutTrophiesView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutTrophiesView.tsx index e2fad127..d228cfbb 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutTrophiesView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutTrophiesView.tsx @@ -15,7 +15,7 @@ export const CatalogLayoutTrophiesView: FC = props => useEffect(() => { - if (!currentOffer) return; + if(!currentOffer) return; setPurchaseOptions(prevValue => { @@ -53,4 +53,4 @@ export const CatalogLayoutTrophiesView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx index 7262343f..897fd589 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx @@ -42,7 +42,7 @@ export const CatalogLayoutVipBuyView: FC = props => if(offer.extraDays > 0) { if(offerText !== '') offerText += ' '; - + offerText += (' ' + LocalizeText('catalog.vip.item.header.days', [ 'num_days' ], [ offer.extraDays.toString() ])); } @@ -188,4 +188,4 @@ export const CatalogLayoutVipBuyView: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/GetCatalogLayout.tsx b/src/components/catalog/views/page/layout/GetCatalogLayout.tsx index ca609bcb..a9a03eef 100644 --- a/src/components/catalog/views/page/layout/GetCatalogLayout.tsx +++ b/src/components/catalog/views/page/layout/GetCatalogLayout.tsx @@ -31,7 +31,7 @@ export const GetCatalogLayout = (page: ICatalogPage, hideNavigation: () => void) switch(page.layoutCode) { case 'frontpage_featured': - return null + return null; case 'frontpage4': return ; case 'pets': @@ -77,4 +77,4 @@ export const GetCatalogLayout = (page: ICatalogPage, hideNavigation: () => void) default: return ; } -} +}; diff --git a/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx index a5153841..09427388 100644 --- a/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx +++ b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx @@ -34,4 +34,4 @@ export const CatalogLayoutFrontPageItemView: FC ); -} +}; diff --git a/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx index ffc420a5..a7e74b2d 100644 --- a/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx +++ b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx @@ -46,4 +46,4 @@ export const CatalogLayoutFrontpage4View: FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx index bfbe51e1..0fd9288f 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceItemView.tsx @@ -15,7 +15,7 @@ export const PUBLIC_OFFER = 2; export const CatalogLayoutMarketplaceItemView: FC = props => { const { offerData = null, type = PUBLIC_OFFER, onClick = null } = props; - + const getMarketplaceOfferTitle = useMemo(() => { if(!offerData) return ''; @@ -31,7 +31,7 @@ export const CatalogLayoutMarketplaceItemView: FC = pr if(offerData.status === MarketPlaceOfferState.SOLD) return LocalizeText('catalog.marketplace.offer.sold'); if(offerData.timeLeftMinutes <= 0) return LocalizeText('catalog.marketplace.offer.expired'); - + const time = Math.max(1, offerData.timeLeftMinutes); const hours = Math.floor(time / 60); const minutes = time - (hours * 60); @@ -80,4 +80,4 @@ export const CatalogLayoutMarketplaceItemView: FC = pr ); -} +}; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx index a78d40db..3e1f847c 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx @@ -28,7 +28,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop }); setCreditsWaiting(parser.creditsWaiting); - setOffers(offers); + setOffers(offers); }); useMessageEvent(MarketplaceCancelOfferResultEvent, event => @@ -51,7 +51,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop { return offers.filter(value => (value.status === MarketPlaceOfferState.SOLD)); }, [ offers ]); - + const redeemSoldOffers = useCallback(() => { setOffers(prevValue => @@ -59,8 +59,8 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop const idsToDelete = soldOffers.map(value => value.offerId); return prevValue.filter(value => (idsToDelete.indexOf(value.offerId) === -1)); - }) - + }); + SendMessageComposer(new RedeemMarketplaceOfferCreditsMessageComposer()); }, [ soldOffers ]); @@ -99,4 +99,4 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop ); -} +}; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx index 454c380e..b95d9485 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx @@ -27,12 +27,12 @@ export const CatalogLayoutMarketplacePublicItemsView: FC { setLastSearch(options); - SendMessageComposer(new GetMarketplaceOffersMessageComposer(options.minPrice, options.maxPrice, options.query, options.type)) + SendMessageComposer(new GetMarketplaceOffersMessageComposer(options.minPrice, options.maxPrice, options.query, options.type)); }, []); const getSortTypes = useMemo(() => { - switch (searchType) + switch(searchType) { case MarketplaceSearchType.BY_ACTIVITY: return SORT_TYPES_ACTIVITY; @@ -46,7 +46,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC { - if (offerData.price > getCurrencyAmount(-1)) + if(offerData.price > getCurrencyAmount(-1)) { simpleAlert(LocalizeText('catalog.alert.notenough.credits.description'), NotificationAlertType.DEFAULT, null, null, LocalizeText('catalog.alert.notenough.title')); return; @@ -65,7 +65,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC(); parser.offers.forEach(entry => @@ -83,9 +83,9 @@ export const CatalogLayoutMarketplacePublicItemsView: FC ); -} +}; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceSearchFormView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceSearchFormView.tsx index 9270ced0..63dde4b1 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceSearchFormView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceSearchFormView.tsx @@ -22,7 +22,7 @@ export const SearchFormView: FC = props => { setSortType(sortType); - if ((searchType === MarketplaceSearchType.BY_ACTIVITY) || (searchType === MarketplaceSearchType.BY_VALUE)) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType }); + if((searchType === MarketplaceSearchType.BY_ACTIVITY) || (searchType === MarketplaceSearchType.BY_VALUE)) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType }); }, [ onSearch, searchType ]); const onClickSearch = useCallback(() => @@ -30,18 +30,18 @@ export const SearchFormView: FC = props => const minPrice = ((min > 0) ? min : -1); const maxPrice = ((max > 0) ? max : -1); - onSearch({ minPrice: minPrice, maxPrice: maxPrice, type: sortType, query: searchQuery }) + onSearch({ minPrice: minPrice, maxPrice: maxPrice, type: sortType, query: searchQuery }); }, [ max, min, onSearch, searchQuery, sortType ]); - useEffect(() => + useEffect(() => { - if (!sortTypes || !sortTypes.length) return; + if(!sortTypes || !sortTypes.length) return; const sortType = sortTypes[0]; setSortType(sortType); - if (searchType === MarketplaceSearchType.BY_ACTIVITY || MarketplaceSearchType.BY_VALUE === searchType) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType }); + if(searchType === MarketplaceSearchType.BY_ACTIVITY || MarketplaceSearchType.BY_VALUE === searchType) onSearch({ minPrice: -1, maxPrice: -1, query: '', type: sortType }); }, [ onSearch, searchType, sortTypes ]); return ( @@ -83,4 +83,4 @@ export const SearchFormView: FC = props => } ); -} +}; diff --git a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx index a7f8ca47..03551438 100644 --- a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx @@ -21,10 +21,10 @@ export const MarketplacePostOfferView: FC<{}> = props => const newValue = parseInt(price); - if (isNaN(newValue) || (newValue === askingPrice)) return; + if(isNaN(newValue) || (newValue === askingPrice)) return; setAskingPrice(parseInt(price)); - } + }; useMessageEvent(MarketplaceConfigurationEvent, event => { @@ -44,19 +44,19 @@ export const MarketplacePostOfferView: FC<{}> = props => useEffect(() => { - if (!item || marketplaceConfiguration) return; + if(!item || marketplaceConfiguration) return; SendMessageComposer(new GetMarketplaceConfigurationMessageComposer()); }, [ item, marketplaceConfiguration ]); useEffect(() => { - if (!item) return; + if(!item) return; return () => setAskingPrice(0); }, [ item ]); - if (!marketplaceConfiguration || !item) return null; + if(!marketplaceConfiguration || !item) return null; const getFurniTitle = (item ? LocalizeText(item.isWallItem ? 'wallItem.name.' + item.type : 'roomItem.name.' + item.type) : ''); const getFurniDescription = (item ? LocalizeText(item.isWallItem ? 'wallItem.desc.' + item.type : 'roomItem.desc.' + item.type) : ''); @@ -65,18 +65,18 @@ export const MarketplacePostOfferView: FC<{}> = props => const postItem = () => { - if (!item || (askingPrice < marketplaceConfiguration.minimumPrice)) return; + if(!item || (askingPrice < marketplaceConfiguration.minimumPrice)) return; showConfirm(LocalizeText('inventory.marketplace.confirm_offer.info', [ 'furniname', 'price' ], [ getFurniTitle, askingPrice.toString() ]), () => { SendMessageComposer(new MakeOfferMessageComposer(askingPrice, item.isWallItem ? 2 : 1, item.id)); setItem(null); }, - () => + () => { - setItem(null) + setItem(null); }, null, null, LocalizeText('inventory.marketplace.confirm_offer.title')); - } + }; return ( @@ -120,5 +120,5 @@ export const MarketplacePostOfferView: FC<{}> = props => - ) -} + ); +}; diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx index f54a5abe..7e60d96d 100644 --- a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx @@ -28,36 +28,36 @@ export const CatalogLayoutPetView: FC = props => const getColor = useMemo(() => { - if (!sellableColors.length || (selectedColorIndex === -1)) return 0xFFFFFF; + if(!sellableColors.length || (selectedColorIndex === -1)) return 0xFFFFFF; return sellableColors[selectedColorIndex][0]; }, [ sellableColors, selectedColorIndex ]); const petBreedName = useMemo(() => { - if ((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return ''; + if((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return ''; return LocalizeText(`pet.breed.${ petIndex }.${ sellablePalettes[selectedPaletteIndex].breedId }`); }, [ petIndex, sellablePalettes, selectedPaletteIndex ]); const petPurchaseString = useMemo(() => { - if (!sellablePalettes.length || (selectedPaletteIndex === -1)) return ''; + if(!sellablePalettes.length || (selectedPaletteIndex === -1)) return ''; const paletteId = sellablePalettes[selectedPaletteIndex].paletteId; let color = 0xFFFFFF; - if (petIndex <= 7) + if(petIndex <= 7) { - if (selectedColorIndex === -1) return ''; + if(selectedColorIndex === -1) return ''; color = sellableColors[selectedColorIndex][0]; } let colorString = color.toString(16).toUpperCase(); - while (colorString.length < 6) colorString = ('0' + colorString); + while(colorString.length < 6) colorString = ('0' + colorString); return `${ paletteId }\n${ colorString }`; }, [ sellablePalettes, selectedPaletteIndex, petIndex, sellableColors, selectedColorIndex ]); @@ -66,7 +66,7 @@ export const CatalogLayoutPetView: FC = props => { let key: string = ''; - switch (approvalResult) + switch(approvalResult) { case 1: key = 'catalog.alert.petname.long'; @@ -82,21 +82,21 @@ export const CatalogLayoutPetView: FC = props => break; } - if (!key || !key.length) return ''; + if(!key || !key.length) return ''; return LocalizeText(key); }, [ approvalResult ]); const purchasePet = useCallback(() => { - if (approvalResult === -1) + if(approvalResult === -1) { SendMessageComposer(new ApproveNameMessageComposer(petName, 1)); return; } - if (approvalResult === 0) + if(approvalResult === 0) { SendMessageComposer(new PurchaseFromCatalogComposer(page.pageId, currentOffer.offerId, `${ petName }\n${ petPurchaseString }`, 1)); @@ -110,13 +110,13 @@ export const CatalogLayoutPetView: FC = props => setApprovalResult(parser.result); - if (parser.result === 0) purchasePet(); + if(parser.result === 0) purchasePet(); else DispatchUiEvent(new CatalogPurchaseFailureEvent(-1)); }); useEffect(() => { - if (!page || !page.offers.length) return; + if(!page || !page.offers.length) return; const offer = page.offers[0]; @@ -127,23 +127,23 @@ export const CatalogLayoutPetView: FC = props => useEffect(() => { - if (!currentOffer) return; + if(!currentOffer) return; const productData = currentOffer.product.productData; - if (!productData) return; + if(!productData) return; - if (petPalettes) + if(petPalettes) { - for (const paletteData of petPalettes) + for(const paletteData of petPalettes) { - if (paletteData.breed !== productData.type) continue; + if(paletteData.breed !== productData.type) continue; const palettes: SellablePetPaletteData[] = []; - for (const palette of paletteData.palettes) + for(const palette of paletteData.palettes) { - if (!palette.sellable) continue; + if(!palette.sellable) continue; palettes.push(palette); } @@ -163,7 +163,7 @@ export const CatalogLayoutPetView: FC = props => useEffect(() => { - if (petIndex === -1) return; + if(petIndex === -1) return; const colors = GetPetAvailableColors(petIndex, sellablePalettes); @@ -173,15 +173,15 @@ export const CatalogLayoutPetView: FC = props => useEffect(() => { - if (!roomPreviewer) return; + if(!roomPreviewer) return; roomPreviewer.reset(false); - if ((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return; + if((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return; let petFigureString = `${ petIndex } ${ sellablePalettes[selectedPaletteIndex].paletteId }`; - if (petIndex <= 7) petFigureString += ` ${ getColor.toString(16) }`; + if(petIndex <= 7) petFigureString += ` ${ getColor.toString(16) }`; roomPreviewer.addPetIntoRoom(petFigureString); }, [ roomPreviewer, petIndex, sellablePalettes, selectedPaletteIndex, getColor ]); @@ -191,7 +191,7 @@ export const CatalogLayoutPetView: FC = props => setApprovalResult(-1); }, [ petName ]); - if (!currentOffer) return null; + if(!currentOffer) return null; return ( @@ -240,4 +240,4 @@ export const CatalogLayoutPetView: FC = props => ); -} +}; 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 f3bd0d6a..02daa037 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx @@ -12,7 +12,7 @@ export const CatalogLayoutVipGiftsView: FC = props => const { catalogOptions = null, setCatalogOptions = null } = useCatalog(); const { clubGifts = null } = catalogOptions; const { showConfirm = null } = useNotification(); - + const giftsAvailable = useCallback(() => { if(!clubGifts) return ''; @@ -41,16 +41,16 @@ export const CatalogLayoutVipGiftsView: FC = props => }, null); }, [ setCatalogOptions, showConfirm ]); - const sortGifts = useMemo(() => + const sortGifts = useMemo(() => { - let gifts = clubGifts.offers.sort((a,b) => + let gifts = clubGifts.offers.sort((a,b) => { return clubGifts.getOfferExtraData(a.offerId).daysRequired - clubGifts.getOfferExtraData(b.offerId).daysRequired; - }) + }); return gifts; },[ clubGifts ]); - - + + return ( <> { giftsAvailable() } @@ -58,5 +58,5 @@ export const CatalogLayoutVipGiftsView: FC = props => { (clubGifts.offers.length > 0) && sortGifts.map(offer => 0)) } offer={ offer } onSelect={ selectGift }/>) } - ) -} + ); +}; diff --git a/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx b/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx index c54c5b40..4ca0c41e 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx @@ -14,7 +14,7 @@ export interface VipGiftItemViewProps export const VipGiftItem : FC = props => { const { offer = null, isAvailable = false, daysRequired = 0, onSelect = null } = props; - + const getImageUrlForOffer = useCallback( () => { if(!offer || !offer.products.length) return ''; @@ -23,7 +23,7 @@ export const VipGiftItem : FC = props => return ProductImageUtility.getProductImageUrl(productData.productType, productData.furniClassId, productData.extraParam); }, [ offer ]); - + const getItemTitle = useCallback(() => { if(!offer || !offer.products.length) return ''; @@ -46,7 +46,7 @@ export const VipGiftItem : FC = props => return LocalizeText(localizationKey); }, [ offer ]); - const getMonthsRequired = useCallback(() => + const getMonthsRequired = useCallback(() => { return Math.floor(daysRequired / 31); },[ daysRequired ]); @@ -60,4 +60,4 @@ export const VipGiftItem : FC = props => ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogAddOnBadgeWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogAddOnBadgeWidgetView.tsx index 38892cea..fd3b652f 100644 --- a/src/components/catalog/views/page/widgets/CatalogAddOnBadgeWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogAddOnBadgeWidgetView.tsx @@ -15,4 +15,4 @@ export const CatalogAddOnBadgeWidgetView: FC = if(!currentOffer || !currentOffer.badgeCode || !currentOffer.badgeCode.length) return null; return ; -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx index 04891dde..625b39f4 100644 --- a/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx @@ -66,11 +66,11 @@ export const CatalogBadgeSelectorWidgetView: FC 0) && badgeCodes.map((badgeCode, index) => { return ( - setCurrentBadgeCode(badgeCode) }> + setCurrentBadgeCode(badgeCode) }> ); }) } ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx index c234f3fa..0257aeda 100644 --- a/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx @@ -26,4 +26,4 @@ export const CatalogBundleGridWidgetView: FC = { children } ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogFirstProductSelectorWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogFirstProductSelectorWidgetView.tsx index a0d71033..855a1757 100644 --- a/src/components/catalog/views/page/widgets/CatalogFirstProductSelectorWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogFirstProductSelectorWidgetView.tsx @@ -13,4 +13,4 @@ export const CatalogFirstProductSelectorWidgetView: FC<{}> = props => }, [ currentPage, setCurrentOffer ]); return null; -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogGuildBadgeWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogGuildBadgeWidgetView.tsx index db893ad3..d56958e6 100644 --- a/src/components/catalog/views/page/widgets/CatalogGuildBadgeWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogGuildBadgeWidgetView.tsx @@ -28,4 +28,4 @@ export const CatalogGuildBadgeWidgetView: FC = if(!badgeCode) return null; return ; -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogGuildSelectorWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogGuildSelectorWidgetView.tsx index 89c9f674..15c60a0d 100644 --- a/src/components/catalog/views/page/widgets/CatalogGuildSelectorWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogGuildSelectorWidgetView.tsx @@ -12,11 +12,11 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props => const previewStuffData = useMemo(() => { - if (!groups || !groups.length) return null; + if(!groups || !groups.length) return null; const group = groups[selectedGroupIndex]; - if (!group) return null; + if(!group) return null; const stuffData = new StringDataType(); @@ -27,7 +27,7 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props => useEffect(() => { - if (!currentOffer) return; + if(!currentOffer) return; setPurchaseOptions(prevValue => { @@ -46,7 +46,7 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props => SendMessageComposer(new CatalogGroupsComposer()); }, []); - if (!groups || !groups.length) + if(!groups || !groups.length) { return (
@@ -72,4 +72,4 @@ export const CatalogGuildSelectorWidgetView: FC<{}> = props =>
); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx index 8b0ecb06..247af605 100644 --- a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx @@ -27,7 +27,7 @@ export const CatalogItemGridWidgetView: FC = pro offer.activate(); if(offer.isLazy) return; - + setCurrentOffer(offer); if(offer.product && (offer.product.productType === ProductTypeEnum.WALL)) @@ -35,13 +35,13 @@ export const CatalogItemGridWidgetView: FC = pro setPurchaseOptions(prevValue => { const newValue = { ...prevValue }; - + newValue.extraData = (offer.product.extraParam || null); - + return newValue; }); } - } + }; return ( @@ -49,4 +49,4 @@ export const CatalogItemGridWidgetView: FC = pro { children } ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogLimitedItemWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogLimitedItemWidgetView.tsx index 439acbf2..b2c85e85 100644 --- a/src/components/catalog/views/page/widgets/CatalogLimitedItemWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogLimitedItemWidgetView.tsx @@ -7,11 +7,11 @@ export const CatalogLimitedItemWidgetView: FC = props => { const { currentOffer = null } = useCatalog(); - if (!currentOffer || (currentOffer.pricingModel !== Offer.PRICING_MODEL_SINGLE) || !currentOffer.product.isUniqueLimitedItem) return null; + if(!currentOffer || (currentOffer.pricingModel !== Offer.PRICING_MODEL_SINGLE) || !currentOffer.product.isUniqueLimitedItem) return null; return (
); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogPriceDisplayWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogPriceDisplayWidgetView.tsx index 57afda23..bb3f314b 100644 --- a/src/components/catalog/views/page/widgets/CatalogPriceDisplayWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogPriceDisplayWidgetView.tsx @@ -34,4 +34,4 @@ export const CatalogPriceDisplayWidgetView: FC } ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx index 37523ce1..25cf610e 100644 --- a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx @@ -47,7 +47,7 @@ export const CatalogPurchaseWidgetView: FC = pro const isLimitedSoldOut = useMemo(() => { if(!currentOffer) return false; - + if(purchaseOptions.extraParamRequired && (!purchaseOptions.extraData || !purchaseOptions.extraData.length)) return false; if(currentOffer.pricingModel === Offer.PRICING_MODEL_SINGLE) @@ -97,7 +97,7 @@ export const CatalogPurchaseWidgetView: FC = pro // } SendMessageComposer(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, purchaseOptions.extraData, purchaseOptions.quantity)); - } + }; useEffect(() => { @@ -118,7 +118,7 @@ export const CatalogPurchaseWidgetView: FC = pro return () => { if(timeout) clearTimeout(timeout); - } + }; }, [ purchaseState ]); if(!currentOffer) return null; @@ -150,7 +150,7 @@ export const CatalogPurchaseWidgetView: FC = pro default: return ; } - } + }; return ( <> @@ -161,4 +161,4 @@ export const CatalogPurchaseWidgetView: FC = pro } ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogSimplePriceWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSimplePriceWidgetView.tsx index 38e5483b..bd824112 100644 --- a/src/components/catalog/views/page/widgets/CatalogSimplePriceWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSimplePriceWidgetView.tsx @@ -11,4 +11,4 @@ export const CatalogSimplePriceWidgetView: FC<{}> = props => ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogSingleViewWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSingleViewWidgetView.tsx index c62535d9..c517acd7 100644 --- a/src/components/catalog/views/page/widgets/CatalogSingleViewWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSingleViewWidgetView.tsx @@ -4,4 +4,4 @@ import { CatalogFirstProductSelectorWidgetView } from './CatalogFirstProductSele export const CatalogSingleViewWidgetView: FC<{}> = props => { return ; -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx index 5c9badfe..31aa6a3b 100644 --- a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx @@ -22,7 +22,7 @@ export const CatalogSpacesWidgetView: FC = props = const setSelectedOffer = (offer: IPurchasableOffer) => { - if (!offer) return; + if(!offer) return; setSelectedOfferForGroup(prevValue => { @@ -32,25 +32,25 @@ export const CatalogSpacesWidgetView: FC = props = return newValue; }); - } + }; useEffect(() => { - if (!currentPage) return; + if(!currentPage) return; const groupedOffers: IPurchasableOffer[][] = [ [], [], [] ]; - for (const offer of currentPage.offers) + for(const offer of currentPage.offers) { - if ((offer.pricingModel !== Offer.PRICING_MODEL_SINGLE) && (offer.pricingModel !== Offer.PRICING_MODEL_MULTI)) continue; + if((offer.pricingModel !== Offer.PRICING_MODEL_SINGLE) && (offer.pricingModel !== Offer.PRICING_MODEL_MULTI)) continue; const product = offer.product; - if (!product || ((product.productType !== ProductTypeEnum.WALL) && (product.productType !== ProductTypeEnum.FLOOR)) || !product.furnitureData) continue; + if(!product || ((product.productType !== ProductTypeEnum.WALL) && (product.productType !== ProductTypeEnum.FLOOR)) || !product.furnitureData) continue; const className = product.furnitureData.className; - switch (className) + switch(className) { case 'floor': groupedOffers[0].push(offer); @@ -71,7 +71,7 @@ export const CatalogSpacesWidgetView: FC = props = useEffect(() => { - if ((selectedGroupIndex === -1) || !selectedOfferForGroup) return; + if((selectedGroupIndex === -1) || !selectedOfferForGroup) return; setCurrentOffer(selectedOfferForGroup[selectedGroupIndex]); @@ -79,7 +79,7 @@ export const CatalogSpacesWidgetView: FC = props = useEffect(() => { - if ((selectedGroupIndex === -1) || !selectedOfferForGroup || !currentOffer) return; + if((selectedGroupIndex === -1) || !selectedOfferForGroup || !currentOffer) return; setPurchaseOptions(prevValue => { @@ -94,10 +94,10 @@ export const CatalogSpacesWidgetView: FC = props = useEffect(() => { - if (elementRef && elementRef.current) elementRef.current.scrollTop = 0; + if(elementRef && elementRef.current) elementRef.current.scrollTop = 0; }, [ selectedGroupIndex ]); - if (!groupedOffers || (selectedGroupIndex === -1)) return null; + if(!groupedOffers || (selectedGroupIndex === -1)) return null; const offers = groupedOffers[selectedGroupIndex]; @@ -112,4 +112,4 @@ export const CatalogSpacesWidgetView: FC = props = ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogSpinnerWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSpinnerWidgetView.tsx index 351ba67e..bf416294 100644 --- a/src/components/catalog/views/page/widgets/CatalogSpinnerWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSpinnerWidgetView.tsx @@ -14,12 +14,12 @@ export const CatalogSpinnerWidgetView: FC<{}> = props => const updateQuantity = (value: number) => { - if (isNaN(value)) value = 1; + if(isNaN(value)) value = 1; value = Math.max(value, MIN_VALUE); value = Math.min(value, MAX_VALUE); - if (value === quantity) return; + if(value === quantity) return; setPurchaseOptions(prevValue => { @@ -29,9 +29,9 @@ export const CatalogSpinnerWidgetView: FC<{}> = props => return newValue; }); - } + }; - if (!currentOffer || !currentOffer.bundlePurchaseAllowed) return null; + if(!currentOffer || !currentOffer.bundlePurchaseAllowed) return null; return ( <> @@ -43,4 +43,4 @@ export const CatalogSpinnerWidgetView: FC<{}> = props => ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogTotalPriceWidget.tsx b/src/components/catalog/views/page/widgets/CatalogTotalPriceWidget.tsx index b3f935ae..365bdf6f 100644 --- a/src/components/catalog/views/page/widgets/CatalogTotalPriceWidget.tsx +++ b/src/components/catalog/views/page/widgets/CatalogTotalPriceWidget.tsx @@ -17,4 +17,4 @@ export const CatalogTotalPriceWidget: FC = pr ); -} +}; diff --git a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx index a3bc555e..d64854ee 100644 --- a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx @@ -37,7 +37,7 @@ export const CatalogViewProductWidgetView: FC<{}> = props => const figureString = GetAvatarRenderManager().getFigureStringWithFigureIds(GetSessionDataManager().figure, GetSessionDataManager().gender, figureSets); - roomPreviewer.addAvatarIntoRoom(figureString, product.productClassId) + roomPreviewer.addAvatarIntoRoom(figureString, product.productClassId); } else { @@ -94,6 +94,6 @@ export const CatalogViewProductWidgetView: FC<{}> = props => ); } - + return ; -} +}; diff --git a/src/components/catalog/views/targeted-offer/OfferBubbleView.tsx b/src/components/catalog/views/targeted-offer/OfferBubbleView.tsx index db5eff5c..170aeec2 100644 --- a/src/components/catalog/views/targeted-offer/OfferBubbleView.tsx +++ b/src/components/catalog/views/targeted-offer/OfferBubbleView.tsx @@ -7,10 +7,10 @@ export const OfferBubbleView = (props: { offer: TargetedOfferData, setOpen: Disp { const { offer = null, setOpen = null } = props; - if (!offer) return; + if(!offer) return; return setOpen(true) } onClose={ null }>
{ offer.title } ; -} +}; diff --git a/src/components/catalog/views/targeted-offer/OfferView.tsx b/src/components/catalog/views/targeted-offer/OfferView.tsx index 312cf630..eb8ceadc 100644 --- a/src/components/catalog/views/targeted-offer/OfferView.tsx +++ b/src/components/catalog/views/targeted-offer/OfferView.tsx @@ -1,7 +1,7 @@ import { GetTargetedOfferComposer, TargetedOfferData, TargetedOfferEvent } from '@nitrots/nitro-renderer'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { SendMessageComposer } from '../../../../api'; -import { useMessageEvent, UseMountEffect } from '../../../../hooks'; +import { useMessageEvent } from '../../../../hooks'; import { OfferBubbleView } from './OfferBubbleView'; import { OfferWindowView } from './OfferWindowView'; @@ -14,19 +14,19 @@ export const OfferView = () => { let parser = evt.getParser(); - if (!parser) return; + if(!parser) return; setOffer(parser.data); }); - UseMountEffect(() => + useEffect(() => { SendMessageComposer(new GetTargetedOfferComposer()); - }) + }, []); + + if(!offer) return; - if (!offer) return; - return <> { opened ? : } - -} + ; +}; diff --git a/src/components/catalog/views/targeted-offer/OfferWindowView.tsx b/src/components/catalog/views/targeted-offer/OfferWindowView.tsx index 5eba1e5d..e3052edc 100644 --- a/src/components/catalog/views/targeted-offer/OfferWindowView.tsx +++ b/src/components/catalog/views/targeted-offer/OfferWindowView.tsx @@ -18,30 +18,30 @@ export const OfferWindowView = (props: { offer: TargetedOfferData, setOpen: Disp let points = false; let limit = false; - if (offer.priceInCredits > 0) credits = getCurrencyAmount(-1) >= offer.priceInCredits; + if(offer.priceInCredits > 0) credits = getCurrencyAmount(-1) >= offer.priceInCredits; - if (offer.priceInActivityPoints > 0) points = getCurrencyAmount(offer.activityPointType) >= offer.priceInActivityPoints; + if(offer.priceInActivityPoints > 0) points = getCurrencyAmount(offer.activityPointType) >= offer.priceInActivityPoints; else points = true; - if (offer.purchaseLimit > 0) limit = true; + if(offer.purchaseLimit > 0) limit = true; return (credits && points && limit); - }, [ offer, getCurrencyAmount ]) + }, [ offer, getCurrencyAmount ]); const expirationTime = () => { - let expirationTime = Math.max(0, (offer.expirationTime - Date.now()) / 1000) + let expirationTime = Math.max(0, (offer.expirationTime - Date.now()) / 1000); return FriendlyTime.format(expirationTime); - } + }; const buyOffer = () => { SendMessageComposer(new PurchaseTargetedOfferComposer(offer.id, amount)); SendMessageComposer(new GetTargetedOfferComposer()); - } + }; - if (!offer) return; + if(!offer) return; return setOpen(false) } /> @@ -82,4 +82,4 @@ export const OfferWindowView = (props: { offer: TargetedOfferData, setOpen: Disp ; -} +}; diff --git a/src/components/chat-history/ChatHistoryView.tsx b/src/components/chat-history/ChatHistoryView.tsx index 230de18f..cd094343 100644 --- a/src/components/chat-history/ChatHistoryView.tsx +++ b/src/components/chat-history/ChatHistoryView.tsx @@ -12,9 +12,9 @@ export const ChatHistoryView: FC<{}> = props => const { chatHistory = [] } = useChatHistory(); const elementRef = useRef(null); - const filteredChatHistory = useMemo(() => + const filteredChatHistory = useMemo(() => { - if (searchText.length === 0) return chatHistory; + if(searchText.length === 0) return chatHistory; let text = searchText.toLowerCase(); @@ -23,7 +23,7 @@ export const ChatHistoryView: FC<{}> = props => useEffect(() => { - if (elementRef && elementRef.current && isVisible) elementRef.current.scrollTop = elementRef.current.scrollHeight; + if(elementRef && elementRef.current && isVisible) elementRef.current.scrollTop = elementRef.current.scrollHeight; }, [ isVisible ]); useEffect(() => @@ -33,9 +33,9 @@ export const ChatHistoryView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setIsVisible(true); @@ -56,7 +56,7 @@ export const ChatHistoryView: FC<{}> = props => return () => RemoveLinkEventTracker(linkTracker); }, []); - if (!isVisible) return null; + if(!isVisible) return null; return ( @@ -89,9 +89,9 @@ export const ChatHistoryView: FC<{}> = props => { row.name } } - ) + ); } } rows={ filteredChatHistory } scrollToBottom={ true } /> ); -} +}; diff --git a/src/components/floorplan-editor/FloorplanEditorView.tsx b/src/components/floorplan-editor/FloorplanEditorView.tsx index 2e84e298..83ea8cd5 100644 --- a/src/components/floorplan-editor/FloorplanEditorView.tsx +++ b/src/components/floorplan-editor/FloorplanEditorView.tsx @@ -43,7 +43,7 @@ export const FloorplanEditorView: FC<{}> = props => convertNumbersForSaving(visualizationSettings.thicknessFloor), (visualizationSettings.wallHeight - 1) )); - } + }; const revertChanges = () => { @@ -52,7 +52,7 @@ export const FloorplanEditorView: FC<{}> = props => FloorplanEditor.instance.doorLocation = { x: originalFloorplanSettings.entryPoint[0], y: originalFloorplanSettings.entryPoint[1] }; FloorplanEditor.instance.setTilemap(originalFloorplanSettings.tilemap, originalFloorplanSettings.reservedTiles); FloorplanEditor.instance.renderTiles(); - } + }; useNitroEvent(RoomEngineEvent.DISPOSED, event => setIsVisible(false)); @@ -112,9 +112,9 @@ export const FloorplanEditorView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; - switch (parts[1]) + switch(parts[1]) { case 'show': setIsVisible(true); @@ -157,4 +157,4 @@ export const FloorplanEditorView: FC<{}> = props => setImportExportVisible(false) } /> } ); -} +}; diff --git a/src/components/floorplan-editor/common/FloorplanEditor.ts b/src/components/floorplan-editor/common/FloorplanEditor.ts index b23a0704..3384093c 100644 --- a/src/components/floorplan-editor/common/FloorplanEditor.ts +++ b/src/components/floorplan-editor/common/FloorplanEditor.ts @@ -49,7 +49,7 @@ export class FloorplanEditor this._actionSettings = new ActionSettings(); } - public onPointerRelease(): void + public onPointerRelease(): void { this._isPointerDown = false; } @@ -61,14 +61,14 @@ export class FloorplanEditor const location = { x: event.offsetX, y: event.offsetY }; this._isPointerDown = true; - + this.tileHitDetection(location, true); } public onPointerMove(event: PointerEvent): void { if(!this._isPointerDown) return; - + const location = { x: event.offsetX, y: event.offsetY }; this.tileHitDetection(location, false); @@ -95,7 +95,7 @@ export class FloorplanEditor const dy = Math.abs(mousePositionY - centreY); const solution = (dx / (width * 0.5) + dy / (height * 0.5) <= 1);//todo: improve this - + if(solution) { if(this._isPointerDown) @@ -104,14 +104,14 @@ export class FloorplanEditor { this.onClick(x, y); } - + else if(this._lastUsedTile.x !== x || this._lastUsedTile.y !== y) { this._lastUsedTile.x = x; this._lastUsedTile.y = y; this.onClick(x, y); } - + } return true; } diff --git a/src/components/floorplan-editor/common/Utils.ts b/src/components/floorplan-editor/common/Utils.ts index 841b1938..dcce8ea5 100644 --- a/src/components/floorplan-editor/common/Utils.ts +++ b/src/components/floorplan-editor/common/Utils.ts @@ -8,17 +8,17 @@ export const getScreenPositionForTile = (x: number, y: number): [number , number positionX = positionX + 1024; // center the map in the canvas return [ positionX, positionY ]; -} +}; export const getTileFromScreenPosition = (x: number, y: number): [number, number] => { const translatedX = x - 1024; // after centering translation - + const realX = ((translatedX /(TILE_SIZE / 2)) + (y / (TILE_SIZE / 4))) / 2; const realY = ((y /(TILE_SIZE / 4)) - (translatedX / (TILE_SIZE / 2))) / 2; return [ realX, realY ]; -} +}; export const convertNumbersForSaving = (value: number): number => { @@ -35,7 +35,7 @@ export const convertNumbersForSaving = (value: number): number => return 0; } -} +}; export const convertSettingToNumber = (value: number): number => { @@ -50,4 +50,4 @@ export const convertSettingToNumber = (value: number): number => default: return 2; } -} +}; diff --git a/src/components/floorplan-editor/views/FloorplanCanvasView.tsx b/src/components/floorplan-editor/views/FloorplanCanvasView.tsx index 775211d7..3428a015 100644 --- a/src/components/floorplan-editor/views/FloorplanCanvasView.tsx +++ b/src/components/floorplan-editor/views/FloorplanCanvasView.tsx @@ -67,9 +67,9 @@ export const FloorplanCanvasView: FC = props => { const element = elementRef.current; - if (!element) return; + if(!element) return; - switch (scrollDirection) + switch(scrollDirection) { case 'up': element.scrollBy({ top: -10 }); @@ -84,13 +84,13 @@ export const FloorplanCanvasView: FC = props => element.scrollBy({ left: 10 }); break; } - } + }; const onPointerEvent = (event: PointerEvent) => { event.preventDefault(); - switch (event.type) + switch(event.type) { case 'pointerout': case 'pointerup': @@ -103,7 +103,7 @@ export const FloorplanCanvasView: FC = props => FloorplanEditor.instance.onPointerMove(event); break; } - } + }; useEffect(() => { @@ -118,14 +118,14 @@ export const FloorplanCanvasView: FC = props => thicknessWall: originalFloorplanSettings.thicknessWall, thicknessFloor: originalFloorplanSettings.thicknessFloor, entryPointDir: prevValue.entryPointDir - } + }; }); - } + }; }, [ originalFloorplanSettings.thicknessFloor, originalFloorplanSettings.thicknessWall, originalFloorplanSettings.wallHeight, setVisualizationSettings ]); useEffect(() => { - if (!entryTileReceived || !occupiedTilesReceived) return; + if(!entryTileReceived || !occupiedTilesReceived) return; FloorplanEditor.instance.renderTiles(); }, [ entryTileReceived, occupiedTilesReceived ]); @@ -137,7 +137,7 @@ export const FloorplanCanvasView: FC = props => const currentElement = elementRef.current; - if (!currentElement) return; + if(!currentElement) return; currentElement.appendChild(FloorplanEditor.instance.renderer.canvas); @@ -149,9 +149,9 @@ export const FloorplanCanvasView: FC = props => currentElement.addEventListener('pointermove', onPointerEvent); - return () => + return () => { - if (currentElement) + if(currentElement) { currentElement.removeEventListener('pointerup', onPointerEvent); @@ -161,7 +161,7 @@ export const FloorplanCanvasView: FC = props => currentElement.removeEventListener('pointermove', onPointerEvent); } - } + }; }, []); const isSmallScreen = () => window.innerWidth < 768; @@ -196,4 +196,4 @@ export const FloorplanCanvasView: FC = props => { children } ); -} +}; diff --git a/src/components/floorplan-editor/views/FloorplanImportExportView.tsx b/src/components/floorplan-editor/views/FloorplanImportExportView.tsx index b1a9b2e3..918133d8 100644 --- a/src/components/floorplan-editor/views/FloorplanImportExportView.tsx +++ b/src/components/floorplan-editor/views/FloorplanImportExportView.tsx @@ -1,8 +1,7 @@ import { UpdateFloorPropertiesMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import { LocalizeText, SendMessageComposer } from '../../../api'; import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../common'; -import { UseMountEffect } from '../../../hooks'; import { useFloorplanEditorContext } from '../FloorplanEditorContext'; import { ConvertTileMapToString } from '../common/ConvertMapToString'; import { convertNumbersForSaving } from '../common/Utils'; @@ -29,12 +28,13 @@ export const FloorplanImportExportView: FC = pro convertNumbersForSaving(originalFloorplanSettings.thicknessFloor), originalFloorplanSettings.wallHeight - 1 )); - } + }; - UseMountEffect(() => + useEffect(() => { + // changed from UseMountEffect setMap(ConvertTileMapToString(originalFloorplanSettings.tilemap)); - }); + }, []); return ( @@ -52,4 +52,4 @@ export const FloorplanImportExportView: FC = pro ); -} +}; diff --git a/src/components/floorplan-editor/views/FloorplanOptionsView.tsx b/src/components/floorplan-editor/views/FloorplanOptionsView.tsx index b3f3063d..25012722 100644 --- a/src/components/floorplan-editor/views/FloorplanOptionsView.tsx +++ b/src/components/floorplan-editor/views/FloorplanOptionsView.tsx @@ -24,7 +24,7 @@ export const FloorplanOptionsView: FC<{}> = props => setFloorAction(action); FloorplanEditor.instance.actionSettings.currentAction = action; - } + }; const changeDoorDirection = () => { @@ -32,7 +32,7 @@ export const FloorplanOptionsView: FC<{}> = props => { const newValue = { ...prevValue }; - if (newValue.entryPointDir < 7) + if(newValue.entryPointDir < 7) { ++newValue.entryPointDir; } @@ -43,18 +43,18 @@ export const FloorplanOptionsView: FC<{}> = props => return newValue; }); - } + }; const onFloorHeightChange = (value: number) => { - if (isNaN(value) || (value <= 0)) value = 0; + if(isNaN(value) || (value <= 0)) value = 0; - if (value > 26) value = 26; + if(value > 26) value = 26; setFloorHeight(value); FloorplanEditor.instance.actionSettings.currentHeight = value.toString(36); - } + }; const onFloorThicknessChange = (value: number) => { @@ -66,7 +66,7 @@ export const FloorplanOptionsView: FC<{}> = props => return newValue; }); - } + }; const onWallThicknessChange = (value: number) => { @@ -78,13 +78,13 @@ export const FloorplanOptionsView: FC<{}> = props => return newValue; }); - } + }; const onWallHeightChange = (value: number) => { - if (isNaN(value) || (value <= 0)) value = MIN_WALL_HEIGHT; + if(isNaN(value) || (value <= 0)) value = MIN_WALL_HEIGHT; - if (value > MAX_WALL_HEIGHT) value = MAX_WALL_HEIGHT; + if(value > MAX_WALL_HEIGHT) value = MAX_WALL_HEIGHT; setVisualizationSettings(prevValue => { @@ -94,25 +94,25 @@ export const FloorplanOptionsView: FC<{}> = props => return newValue; }); - } + }; const increaseWallHeight = () => { let height = (visualizationSettings.wallHeight + 1); - if (height > MAX_WALL_HEIGHT) height = MAX_WALL_HEIGHT; + if(height > MAX_WALL_HEIGHT) height = MAX_WALL_HEIGHT; onWallHeightChange(height); - } + }; const decreaseWallHeight = () => { let height = (visualizationSettings.wallHeight - 1); - if (height <= 0) height = MIN_WALL_HEIGHT; + if(height <= 0) height = MIN_WALL_HEIGHT; onWallHeightChange(height); - } + }; return (
@@ -186,4 +186,4 @@ export const FloorplanOptionsView: FC<{}> = props =>
); -} +}; diff --git a/src/components/friends/FriendsView.tsx b/src/components/friends/FriendsView.tsx index 608c0210..e29b9f8d 100644 --- a/src/components/friends/FriendsView.tsx +++ b/src/components/friends/FriendsView.tsx @@ -18,4 +18,4 @@ export const FriendsView: FC<{}> = props => ); -} +}; diff --git a/src/components/friends/views/friends-bar/FriendBarItemView.tsx b/src/components/friends/views/friends-bar/FriendBarItemView.tsx index 4def9ab6..ccc46add 100644 --- a/src/components/friends/views/friends-bar/FriendBarItemView.tsx +++ b/src/components/friends/views/friends-bar/FriendBarItemView.tsx @@ -17,20 +17,20 @@ export const FriendBarItemView: FC<{ friend: MessengerFriend }> = props => { const element = elementRef.current; - if (!element) return; + if(!element) return; - if ((event.target !== element) && !element.contains((event.target as Node))) + if((event.target !== element) && !element.contains((event.target as Node))) { setVisible(false); } - } + }; document.addEventListener(MouseEventType.MOUSE_CLICK, onClick); return () => document.removeEventListener(MouseEventType.MOUSE_CLICK, onClick); }, []); - if (!friend) + if(!friend) { return (
} ); -} +}; diff --git a/src/components/friends/views/friends-bar/FriendsBarView.tsx b/src/components/friends/views/friends-bar/FriendsBarView.tsx index 69f0d817..663f2f07 100644 --- a/src/components/friends/views/friends-bar/FriendsBarView.tsx +++ b/src/components/friends/views/friends-bar/FriendsBarView.tsx @@ -23,4 +23,4 @@ export const FriendBarView: FC<{ onlineFriends: MessengerFriend[] }> = props => ); -} +}; diff --git a/src/components/friends/views/friends-list/FriendsListSearchView.tsx b/src/components/friends/views/friends-list/FriendsListSearchView.tsx index c90063dd..fd53481b 100644 --- a/src/components/friends/views/friends-list/FriendsListSearchView.tsx +++ b/src/components/friends/views/friends-list/FriendsListSearchView.tsx @@ -27,11 +27,11 @@ export const FriendsSearchView: FC = props => useEffect(() => { - if (!searchValue || !searchValue.length) return; + if(!searchValue || !searchValue.length) return; const timeout = setTimeout(() => { - if (!searchValue || !searchValue.length) return; + if(!searchValue || !searchValue.length) return; SendMessageComposer(new HabboSearchComposer(searchValue)); }, 500); @@ -65,7 +65,7 @@ export const FriendsSearchView: FC = props =>
OpenMessengerChat(result.avatarId) } /> }
- ) + ); }) } } @@ -92,7 +92,7 @@ export const FriendsSearchView: FC = props =>
requestFriend(result.avatarId, result.avatarName) } /> }
- ) + ); }) } } @@ -100,4 +100,4 @@ export const FriendsSearchView: FC = props => ); -} +}; diff --git a/src/components/friends/views/friends-list/FriendsListView.tsx b/src/components/friends/views/friends-list/FriendsListView.tsx index 3de2dd46..ef30f23d 100644 --- a/src/components/friends/views/friends-list/FriendsListView.tsx +++ b/src/components/friends/views/friends-list/FriendsListView.tsx @@ -49,7 +49,7 @@ export const FriendsListView: FC<{}> = props => if(existingUserIdIndex > -1) { - newValue.splice(existingUserIdIndex, 1) + newValue.splice(existingUserIdIndex, 1); } else { @@ -63,11 +63,11 @@ export const FriendsListView: FC<{}> = props => const sendRoomInvite = (message: string) => { if(!selectedFriendsIds.length || !message || !message.length || (message.length > 255)) return; - + SendMessageComposer(new SendRoomInviteComposer(message, selectedFriendsIds)); setShowRoomInvite(false); - } + }; const removeSelectedFriends = () => { @@ -81,7 +81,7 @@ export const FriendsListView: FC<{}> = props => }); setShowRemoveFriendsConfirmation(false); - } + }; useEffect(() => { @@ -91,7 +91,7 @@ export const FriendsListView: FC<{}> = props => const parts = url.split('/'); if(parts.length < 2) return; - + switch(parts[1]) { case 'show': @@ -138,12 +138,12 @@ export const FriendsListView: FC<{}> = props => - } + } { showRoomInvite && setShowRoomInvite(false) } /> } - { showRemoveFriendsConfirmation && + { showRemoveFriendsConfirmation && setShowRemoveFriendsConfirmation(false) } /> } ); diff --git a/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupItemView.tsx b/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupItemView.tsx index d57638ce..50964608 100644 --- a/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupItemView.tsx +++ b/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupItemView.tsx @@ -14,30 +14,30 @@ export const FriendsListGroupItemView: FC<{ friend: MessengerFriend, selected: b event.stopPropagation(); followFriend(friend); - } + }; const openMessengerChat = (event: MouseEvent) => { event.stopPropagation(); - + OpenMessengerChat(friend.id); - } + }; const openRelationship = (event: MouseEvent) => { event.stopPropagation(); setIsRelationshipOpen(true); - } + }; const clickUpdateRelationship = (event: MouseEvent, type: number) => { event.stopPropagation(); updateRelationship(friend, type); - + setIsRelationshipOpen(false); - } + }; const getCurrentRelationshipName = () => { @@ -50,7 +50,7 @@ export const FriendsListGroupItemView: FC<{ friend: MessengerFriend, selected: b case MessengerFriend.RELATIONSHIP_BOBBA: return 'bobba'; default: return 'none'; } - } + }; if(!friend) return null; @@ -82,4 +82,4 @@ export const FriendsListGroupItemView: FC<{ friend: MessengerFriend, selected: b ); -} +}; diff --git a/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupView.tsx b/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupView.tsx index c593003a..ffd4cde8 100644 --- a/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupView.tsx +++ b/src/components/friends/views/friends-list/friends-list-group/FriendsListGroupView.tsx @@ -18,6 +18,6 @@ export const FriendsListGroupView: FC = props => return ( <> { list.map((item, index) => = 0) } selectFriend={ selectFriend } />) } - + ); -} +}; diff --git a/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestItemView.tsx b/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestItemView.tsx index e0ac050d..c06840e0 100644 --- a/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestItemView.tsx +++ b/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestItemView.tsx @@ -22,4 +22,4 @@ export const FriendsListRequestItemView: FC<{ request: MessengerRequest }> = pro ); -} +}; diff --git a/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestView.tsx b/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestView.tsx index b50605dc..686b32da 100644 --- a/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestView.tsx +++ b/src/components/friends/views/friends-list/friends-list-request/FriendsListRequestView.tsx @@ -26,4 +26,4 @@ export const FriendsListRequestView: FC = props { children } ); -} +}; diff --git a/src/components/friends/views/messenger/FriendsMessengerView.tsx b/src/components/friends/views/messenger/FriendsMessengerView.tsx index 7a961274..354ddd5b 100644 --- a/src/components/friends/views/messenger/FriendsMessengerView.tsx +++ b/src/components/friends/views/messenger/FriendsMessengerView.tsx @@ -21,19 +21,19 @@ export const FriendsMessengerView: FC<{}> = props => const send = () => { - if (!activeThread || !messageText.length) return; + if(!activeThread || !messageText.length) return; sendMessage(activeThread, GetSessionDataManager().userId, messageText); setMessageText(''); - } + }; const onKeyDown = (event: KeyboardEvent) => { - if (event.key !== 'Enter') return; + if(event.key !== 'Enter') return; send(); - } + }; useEffect(() => { @@ -42,16 +42,16 @@ export const FriendsMessengerView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length === 2) + if(parts.length === 2) { - if (parts[1] === 'open') + if(parts[1] === 'open') { setIsVisible(true); return; } - if (parts[1] === 'toggle') + if(parts[1] === 'toggle') { setIsVisible(prevValue => !prevValue); @@ -60,7 +60,7 @@ export const FriendsMessengerView: FC<{}> = props => const thread = getMessageThread(parseInt(parts[1])); - if (!thread) return; + if(!thread) return; setActiveThreadId(thread.threadId); setIsVisible(true); @@ -76,35 +76,35 @@ export const FriendsMessengerView: FC<{}> = props => useEffect(() => { - if (!isVisible || !activeThread) return; + if(!isVisible || !activeThread) return; messagesBox.current.scrollTop = messagesBox.current.scrollHeight; }, [ isVisible, activeThread ]); useEffect(() => { - if (isVisible && !activeThread) + if(isVisible && !activeThread) { - if (lastThreadId > 0) + if(lastThreadId > 0) { setActiveThreadId(lastThreadId); } else { - if (visibleThreads.length > 0) setActiveThreadId(visibleThreads[0].threadId); + if(visibleThreads.length > 0) setActiveThreadId(visibleThreads[0].threadId); } return; } - if (!isVisible && activeThread) + if(!isVisible && activeThread) { setLastThreadId(activeThread.threadId); setActiveThreadId(-1); } }, [ isVisible, activeThread, lastThreadId, visibleThreads, setActiveThreadId ]); - if (!isVisible) return null; + if(!isVisible) return null; return ( @@ -175,4 +175,4 @@ export const FriendsMessengerView: FC<{}> = props => ); -} +}; diff --git a/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadGroup.tsx b/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadGroup.tsx index c0bc00e4..a6c35b4f 100644 --- a/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadGroup.tsx +++ b/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadGroup.tsx @@ -11,18 +11,18 @@ export const FriendsMessengerThreadGroup: FC<{ thread: MessengerThread, group: M const isOwnChat = useMemo(() => { - if (!thread || !group) return false; + if(!thread || !group) return false; - if ((group.type === MessengerGroupType.PRIVATE_CHAT) && (group.userId === GetSessionDataManager().userId)) return true; + if((group.type === MessengerGroupType.PRIVATE_CHAT) && (group.userId === GetSessionDataManager().userId)) return true; - if (groupChatData && group.chats.length && (groupChatData.userId === GetSessionDataManager().userId)) return true; + if(groupChatData && group.chats.length && (groupChatData.userId === GetSessionDataManager().userId)) return true; return false; }, [ thread, group, groupChatData ]); - if (!thread || !group) return null; + if(!thread || !group) return null; - if (!group.userId) + if(!group.userId) { return ( <> @@ -70,4 +70,4 @@ export const FriendsMessengerThreadGroup: FC<{ thread: MessengerThread, group: M } ); -} +}; diff --git a/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadView.tsx b/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadView.tsx index 8a059d63..86369979 100644 --- a/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadView.tsx +++ b/src/components/friends/views/messenger/messenger-thread/FriendsMessengerThreadView.tsx @@ -13,4 +13,4 @@ export const FriendsMessengerThreadView: FC<{ thread: MessengerThread }> = props { (thread.groups.length > 0) && thread.groups.map((group, index) => ) } ); -} +}; diff --git a/src/components/game-center/GameCenterView.tsx b/src/components/game-center/GameCenterView.tsx index 6059628f..3b398d5a 100644 --- a/src/components/game-center/GameCenterView.tsx +++ b/src/components/game-center/GameCenterView.tsx @@ -6,23 +6,23 @@ import { GameListView } from './views/GameListView'; import { GameStageView } from './views/GameStageView'; import { GameView } from './views/GameView'; -export const GameCenterView = () => +export const GameCenterView = () => { - const{ isVisible, setIsVisible, games, accountStatus } = useGameCenter(); + const { isVisible, setIsVisible, games, accountStatus } = useGameCenter(); useEffect(() => { const toggleGameCenter = () => { setIsVisible(prev => !prev); - } + }; const linkTracker: ILinkEventTracker = { linkReceived: (url: string) => { const value = url.split('/'); - - switch(value[1]) + + switch(value[1]) { case 'toggle': toggleGameCenter(); @@ -38,12 +38,12 @@ export const GameCenterView = () => }, [ setIsVisible ]); if(!isVisible || !games || !accountStatus) return; - + return - -} + ; +}; diff --git a/src/components/game-center/views/GameListView.tsx b/src/components/game-center/views/GameListView.tsx index cd7c3247..a6cced91 100644 --- a/src/components/game-center/views/GameListView.tsx +++ b/src/components/game-center/views/GameListView.tsx @@ -2,23 +2,23 @@ import { GameConfigurationData } from '@nitrots/nitro-renderer'; import { LocalizeText } from '../../../api'; import { useGameCenter } from '../../../hooks'; -export const GameListView = () => +export const GameListView = () => { const { games, selectedGame, setSelectedGame } = useGameCenter(); - const getClasses = (game: GameConfigurationData) => + const getClasses = (game: GameConfigurationData) => { let classes = [ 'game-icon' ]; - if (selectedGame === game) classes.push('selected'); + if(selectedGame === game) classes.push('selected'); return classes.join(' '); - } + }; - const getIconImage = (game: GameConfigurationData): string => + const getIconImage = (game: GameConfigurationData): string => { - return `url(${ game.assetUrl }${ game.gameNameId }_icon.png)` - } + return `url(${ game.assetUrl }${ game.gameNameId }_icon.png)`; + }; return
{ LocalizeText('gamecenter.game_list_title') } @@ -27,5 +27,5 @@ export const GameListView = () =>
setSelectedGame(game) } /> ) }
-
-} + ; +}; diff --git a/src/components/game-center/views/GameStageView.tsx b/src/components/game-center/views/GameStageView.tsx index c6288a12..06cd25f0 100644 --- a/src/components/game-center/views/GameStageView.tsx +++ b/src/components/game-center/views/GameStageView.tsx @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react'; import { SendMessageComposer } from '../../../api'; import { useGameCenter } from '../../../hooks'; -export const GameStageView = () => +export const GameStageView = () => { const { gameURL, setGameURL } = useGameCenter(); const [ loadTimes, setLoadTimes ] = useState(0); @@ -11,7 +11,7 @@ export const GameStageView = () => useEffect(() => { - if (!ref || ref && !ref.current) return; + if(!ref || ref && !ref.current) return; setLoadTimes(0); @@ -21,10 +21,10 @@ export const GameStageView = () => frame.classList.add('game-center-stage'); frame.classList.add('h-full'); - frame.onload = () => + frame.onload = () => { - setLoadTimes(prev => prev += 1) - } + setLoadTimes(prev => prev += 1); + }; ref.current.innerHTML = ''; ref.current.appendChild(frame); @@ -33,14 +33,14 @@ export const GameStageView = () => useEffect(() => { - if (loadTimes > 1) + if(loadTimes > 1) { setGameURL(null); SendMessageComposer(new Game2ExitGameMessageComposer()); } - }, [ loadTimes, setGameURL ]) + }, [ loadTimes, setGameURL ]); - if (!gameURL) return null; + if(!gameURL) return null; - return
-} + return
; +}; diff --git a/src/components/game-center/views/GameView.tsx b/src/components/game-center/views/GameView.tsx index 18ae34d5..c5d3561a 100644 --- a/src/components/game-center/views/GameView.tsx +++ b/src/components/game-center/views/GameView.tsx @@ -4,38 +4,38 @@ import { ColorUtils, LocalizeText, SendMessageComposer } from '../../../api'; import { Button, Flex, LayoutItemCountView, Text } from '../../../common'; import { useGameCenter } from '../../../hooks'; -export const GameView = () => +export const GameView = () => { const { selectedGame, accountStatus } = useGameCenter(); useEffect(()=> { - if(selectedGame) + if(selectedGame) { SendMessageComposer(new GetGameStatusMessageComposer(selectedGame.gameId)); SendMessageComposer(new Game2GetAccountGameStatusMessageComposer(selectedGame.gameId)); } - },[ selectedGame ]) + },[ selectedGame ]); - const getBgColour = (): string => + const getBgColour = (): string => { - return ColorUtils.uintHexColor(selectedGame.bgColor) - } + return ColorUtils.uintHexColor(selectedGame.bgColor); + }; - const getBgImage = (): string => + const getBgImage = (): string => { - return `url(${ selectedGame.assetUrl }${ selectedGame.gameNameId }_theme.png)` - } + return `url(${ selectedGame.assetUrl }${ selectedGame.gameNameId }_theme.png)`; + }; - const getColor = () => + const getColor = () => { return ColorUtils.uintHexColor(selectedGame.textColor); - } + }; - const onPlay = () => + const onPlay = () => { SendMessageComposer(new JoinQueueMessageComposer(selectedGame.gameId)); - } + }; return @@ -44,12 +44,12 @@ export const GameView = () => { (accountStatus.hasUnlimitedGames || accountStatus.freeGamesLeft > 0) && <> } { LocalizeText(`gamecenter.${ selectedGame.gameNameId }.description_content`) }
- -} + ; +}; diff --git a/src/components/groups/GroupsView.tsx b/src/components/groups/GroupsView.tsx index a8a000b2..03998613 100644 --- a/src/components/groups/GroupsView.tsx +++ b/src/components/groups/GroupsView.tsx @@ -26,9 +26,9 @@ export const GroupsView: FC<{}> = props => linkReceived: (url: string) => { const parts = url.split('/'); - + if(parts.length < 2) return; - + switch(parts[1]) { case 'create': @@ -36,7 +36,7 @@ export const GroupsView: FC<{}> = props => return; case 'manage': if(!parts[2]) return; - + setCreatorVisible(false); SendMessageComposer(new GroupSettingsComposer(Number(parts[2]))); return; @@ -49,7 +49,7 @@ export const GroupsView: FC<{}> = props => return () => RemoveLinkEventTracker(linkTracker); }, []); - + return ( <> { isCreatorVisible && diff --git a/src/components/groups/views/GroupBadgeCreatorView.tsx b/src/components/groups/views/GroupBadgeCreatorView.tsx index df3dd602..3f2e905b 100644 --- a/src/components/groups/views/GroupBadgeCreatorView.tsx +++ b/src/components/groups/views/GroupBadgeCreatorView.tsx @@ -26,10 +26,10 @@ export const GroupBadgeCreatorView: FC = props => setBadgeParts(newBadgeParts); - if (property === 'key') setSelectedIndex(-1); - } + if(property === 'key') setSelectedIndex(-1); + }; - if (!badgeParts || !badgeParts.length) return null; + if(!badgeParts || !badgeParts.length) return null; return ( <> @@ -49,13 +49,13 @@ export const GroupBadgeCreatorView: FC = props => { POSITIONS.map((position, posIndex) => { - return
setPartProperty(index, 'position', position) } /> + return
setPartProperty(index, 'position', position) } />; }) } } { (groupCustomize.badgePartColors.length > 0) && groupCustomize.badgePartColors.map((item, colorIndex) => { - return
setPartProperty(index, 'color', (colorIndex + 1)) } /> + return
setPartProperty(index, 'color', (colorIndex + 1)) } />; }) } @@ -80,4 +80,4 @@ export const GroupBadgeCreatorView: FC = props => } ); -} +}; diff --git a/src/components/groups/views/GroupCreatorView.tsx b/src/components/groups/views/GroupCreatorView.tsx index 7ac97873..ee113eac 100644 --- a/src/components/groups/views/GroupCreatorView.tsx +++ b/src/components/groups/views/GroupCreatorView.tsx @@ -29,18 +29,18 @@ export const GroupCreatorView: FC = props => setCloseAction(null); setGroupData(null); - if (onClose) onClose(); - } + if(onClose) onClose(); + }; const buyGroup = () => { - if (!groupData) return; + if(!groupData) return; const badge = []; groupData.groupBadgeParts.forEach(part => { - if (part.code) + if(part.code) { badge.push(part.key); badge.push(part.color); @@ -49,16 +49,16 @@ export const GroupCreatorView: FC = props => }); SendMessageComposer(new GroupBuyComposer(groupData.groupName, groupData.groupDescription, groupData.groupHomeroomId, groupData.groupColors[0], groupData.groupColors[1], badge)); - } + }; const previousStep = () => { - if (closeAction && closeAction.action) + if(closeAction && closeAction.action) { - if (!closeAction.action()) return; + if(!closeAction.action()) return; } - if (currentTab === 1) + if(currentTab === 1) { onClose(); @@ -66,16 +66,16 @@ export const GroupCreatorView: FC = props => } setCurrentTab(value => value - 1); - } + }; const nextStep = () => { - if (closeAction && closeAction.action) + if(closeAction && closeAction.action) { - if (!closeAction.action()) return; + if(!closeAction.action()) return; } - if (currentTab === 4) + if(currentTab === 4) { buyGroup(); @@ -83,7 +83,7 @@ export const GroupCreatorView: FC = props => } setCurrentTab(value => (value === 4 ? value : value + 1)); - } + }; useMessageEvent(GroupBuyDataEvent, event => { @@ -115,7 +115,7 @@ export const GroupCreatorView: FC = props => SendMessageComposer(new GroupBuyDataComposer()); }, [ setGroupData ]); - if (!groupData) return null; + if(!groupData) return null; return ( diff --git a/src/components/groups/views/GroupInformationView.tsx b/src/components/groups/views/GroupInformationView.tsx index 027c7446..d2f8a805 100644 --- a/src/components/groups/views/GroupInformationView.tsx +++ b/src/components/groups/views/GroupInformationView.tsx @@ -28,41 +28,41 @@ export const GroupInformationView: FC = props => { SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId)); - if (onClose) onClose(); + if(onClose) onClose(); }, null); - } + }; const getRoleIcon = () => { - if (groupInformation.membershipType === GroupMembershipType.NOT_MEMBER || groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return null; + if(groupInformation.membershipType === GroupMembershipType.NOT_MEMBER || groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return null; - if (isRealOwner) return ; + if(isRealOwner) return ; - if (groupInformation.isAdmin) return ; + if(groupInformation.isAdmin) return ; return ; - } + }; const getButtonText = () => { - if (isRealOwner) return 'group.youareowner'; + if(isRealOwner) return 'group.youareowner'; - if (groupInformation.type === GroupType.PRIVATE && groupInformation.membershipType !== GroupMembershipType.MEMBER) return ''; + if(groupInformation.type === GroupType.PRIVATE && groupInformation.membershipType !== GroupMembershipType.MEMBER) return ''; - if (groupInformation.membershipType === GroupMembershipType.MEMBER) return 'group.leave'; + if(groupInformation.membershipType === GroupMembershipType.MEMBER) return 'group.leave'; - if ((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.REGULAR) return 'group.join'; + if((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.REGULAR) return 'group.join'; - if (groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return 'group.membershippending'; + if(groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return 'group.membershippending'; - if ((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.EXCLUSIVE) return 'group.requestmembership'; - } + if((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.EXCLUSIVE) return 'group.requestmembership'; + }; const handleButtonClick = () => { - if ((groupInformation.type === GroupType.PRIVATE) && (groupInformation.membershipType === GroupMembershipType.NOT_MEMBER)) return; + if((groupInformation.type === GroupType.PRIVATE) && (groupInformation.membershipType === GroupMembershipType.NOT_MEMBER)) return; - if (groupInformation.membershipType === GroupMembershipType.MEMBER) + if(groupInformation.membershipType === GroupMembershipType.MEMBER) { leaveGroup(); @@ -70,11 +70,11 @@ export const GroupInformationView: FC = props => } joinGroup(); - } + }; const handleAction = (action: string) => { - switch (action) + switch(action) { case 'members': GetGroupMembers(groupInformation.id); @@ -95,9 +95,9 @@ export const GroupInformationView: FC = props => CreateLinkEvent('navigator/search/groups'); break; } - } + }; - if (!groupInformation) return null; + if(!groupInformation) return null; return ( diff --git a/src/components/groups/views/GroupManagerView.tsx b/src/components/groups/views/GroupManagerView.tsx index 08ac0ec9..b8336ab7 100644 --- a/src/components/groups/views/GroupManagerView.tsx +++ b/src/components/groups/views/GroupManagerView.tsx @@ -26,14 +26,14 @@ export const GroupManagerView: FC<{}> = props => }); setGroupData(null); - } + }; const changeTab = (tab: number) => { if(closeAction && closeAction.action) closeAction.action(); setCurrentTab(tab); - } + }; useMessageEvent(GroupInformationEvent, event => { @@ -83,7 +83,7 @@ export const GroupManagerView: FC<{}> = props => }); if(!groupData || (groupData.groupId <= 0)) return null; - + return ( diff --git a/src/components/groups/views/GroupMembersView.tsx b/src/components/groups/views/GroupMembersView.tsx index 5dda10c3..af4d9ee8 100644 --- a/src/components/groups/views/GroupMembersView.tsx +++ b/src/components/groups/views/GroupMembersView.tsx @@ -19,49 +19,49 @@ export const GroupMembersView: FC<{}> = props => const getRankDescription = (member: GroupMemberParser) => { - if (member.rank === GroupRank.OWNER) return 'group.members.owner'; + if(member.rank === GroupRank.OWNER) return 'group.members.owner'; - if (membersData.admin) + if(membersData.admin) { - if (member.rank === GroupRank.ADMIN) return 'group.members.removerights'; + if(member.rank === GroupRank.ADMIN) return 'group.members.removerights'; - if (member.rank === GroupRank.MEMBER) return 'group.members.giverights'; + if(member.rank === GroupRank.MEMBER) return 'group.members.giverights'; } return ''; - } + }; const refreshMembers = useCallback(() => { - if ((groupId === -1) || (levelId === -1) || (pageId === -1)) return; + if((groupId === -1) || (levelId === -1) || (pageId === -1)) return; SendMessageComposer(new GroupMembersComposer(groupId, pageId, searchQuery, levelId)); }, [ groupId, levelId, pageId, searchQuery ]); const toggleAdmin = (member: GroupMemberParser) => { - if (!membersData.admin || (member.rank === GroupRank.OWNER)) return; + if(!membersData.admin || (member.rank === GroupRank.OWNER)) return; - if (member.rank !== GroupRank.ADMIN) SendMessageComposer(new GroupAdminGiveComposer(membersData.groupId, member.id)); + if(member.rank !== GroupRank.ADMIN) SendMessageComposer(new GroupAdminGiveComposer(membersData.groupId, member.id)); else SendMessageComposer(new GroupAdminTakeComposer(membersData.groupId, member.id)); refreshMembers(); - } + }; const acceptMembership = (member: GroupMemberParser) => { - if (!membersData.admin || (member.rank !== GroupRank.REQUESTED)) return; + if(!membersData.admin || (member.rank !== GroupRank.REQUESTED)) return; SendMessageComposer(new GroupMembershipAcceptComposer(membersData.groupId, member.id)); refreshMembers(); - } + }; const removeMemberOrDeclineMembership = (member: GroupMemberParser) => { - if (!membersData.admin) return; + if(!membersData.admin) return; - if (member.rank === GroupRank.REQUESTED) + if(member.rank === GroupRank.REQUESTED) { SendMessageComposer(new GroupMembershipDeclineComposer(membersData.groupId, member.id)); @@ -72,7 +72,7 @@ export const GroupMembersView: FC<{}> = props => setRemovingMemberName(member.name); SendMessageComposer(new GroupConfirmRemoveMemberComposer(membersData.groupId, member.id)); - } + }; useMessageEvent(GroupMembersEvent, event => { @@ -104,7 +104,7 @@ export const GroupMembersView: FC<{}> = props => { const parts = url.split('/'); - if (parts.length < 2) return; + if(parts.length < 2) return; const groupId = (parseInt(parts[1]) || -1); const levelId = (parseInt(parts[2]) || 3); @@ -128,14 +128,14 @@ export const GroupMembersView: FC<{}> = props => useEffect(() => { - if ((groupId === -1) || (levelId === -1) || (pageId === -1)) return; + if((groupId === -1) || (levelId === -1) || (pageId === -1)) return; SendMessageComposer(new GroupMembersComposer(groupId, pageId, searchQuery, levelId)); }, [ groupId, levelId, pageId, searchQuery ]); useEffect(() => { - if (groupId === -1) return; + if(groupId === -1) return; setLevelId(-1); setMembersData(null); @@ -144,7 +144,7 @@ export const GroupMembersView: FC<{}> = props => setRemovingMemberName(null); }, [ groupId ]); - if ((groupId === -1) || !membersData) return null; + if((groupId === -1) || !membersData) return null; return ( diff --git a/src/components/groups/views/GroupRoomInformationView.tsx b/src/components/groups/views/GroupRoomInformationView.tsx index aa134fc1..7be8a924 100644 --- a/src/components/groups/views/GroupRoomInformationView.tsx +++ b/src/components/groups/views/GroupRoomInformationView.tsx @@ -28,9 +28,9 @@ export const GroupRoomInformationView: FC<{}> = props => { const parser = event.getParser(); - if (!parser.roomEnter) return; + if(!parser.roomEnter) return; - if (parser.data.habboGroupId > 0) + if(parser.data.habboGroupId > 0) { setExpectedGroupId(parser.data.habboGroupId); SendMessageComposer(new GroupInformationComposer(parser.data.habboGroupId, false)); @@ -46,7 +46,7 @@ export const GroupRoomInformationView: FC<{}> = props => { const parser = event.getParser(); - if (!groupInformation || ((parser.groupId !== groupInformation.id) && (parser.groupId !== expectedGroupId))) return; + if(!groupInformation || ((parser.groupId !== groupInformation.id) && (parser.groupId !== expectedGroupId))) return; setExpectedGroupId(0); setGroupInformation(null); @@ -56,7 +56,7 @@ export const GroupRoomInformationView: FC<{}> = props => { const parser = event.getParser(); - if (parser.id !== expectedGroupId) return; + if(parser.id !== expectedGroupId) return; setGroupInformation(parser); }); @@ -67,32 +67,32 @@ export const GroupRoomInformationView: FC<{}> = props => { SendMessageComposer(new GroupRemoveMemberComposer(groupInformation.id, GetSessionDataManager().userId)); }, null); - } + }; const isRealOwner = (groupInformation && (groupInformation.ownerName === GetSessionDataManager().userName)); const getButtonText = () => { - if (isRealOwner) return 'group.manage'; + if(isRealOwner) return 'group.manage'; - if (groupInformation.type === GroupType.PRIVATE) return ''; + if(groupInformation.type === GroupType.PRIVATE) return ''; - if (groupInformation.membershipType === GroupMembershipType.MEMBER) return 'group.leave'; + if(groupInformation.membershipType === GroupMembershipType.MEMBER) return 'group.leave'; - if ((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.REGULAR) return 'group.join'; + if((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.REGULAR) return 'group.join'; - if (groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return 'group.membershippending'; + if(groupInformation.membershipType === GroupMembershipType.REQUEST_PENDING) return 'group.membershippending'; - if ((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.EXCLUSIVE) return 'group.requestmembership'; - } + if((groupInformation.membershipType === GroupMembershipType.NOT_MEMBER) && groupInformation.type === GroupType.EXCLUSIVE) return 'group.requestmembership'; + }; const handleButtonClick = () => { - if (isRealOwner) return GetGroupManager(groupInformation.id); + if(isRealOwner) return GetGroupManager(groupInformation.id); - if ((groupInformation.type === GroupType.PRIVATE) && (groupInformation.membershipType === GroupMembershipType.NOT_MEMBER)) return; + if((groupInformation.type === GroupType.PRIVATE) && (groupInformation.membershipType === GroupMembershipType.NOT_MEMBER)) return; - if (groupInformation.membershipType === GroupMembershipType.MEMBER) + if(groupInformation.membershipType === GroupMembershipType.MEMBER) { leaveGroup(); @@ -100,9 +100,9 @@ export const GroupRoomInformationView: FC<{}> = props => } TryJoinGroup(groupInformation.id); - } + }; - if (!groupInformation) return null; + if(!groupInformation) return null; return (
diff --git a/src/components/groups/views/tabs/GroupTabBadgeView.tsx b/src/components/groups/views/tabs/GroupTabBadgeView.tsx index 374c2fb5..33c3cd34 100644 --- a/src/components/groups/views/tabs/GroupTabBadgeView.tsx +++ b/src/components/groups/views/tabs/GroupTabBadgeView.tsx @@ -28,7 +28,7 @@ export const GroupTabBadgeView: FC = props => badgeParts.forEach(part => (part.code && (badgeCode += part.code))); return badgeCode; - } + }; const saveBadge = useCallback(() => { @@ -55,12 +55,12 @@ export const GroupTabBadgeView: FC = props => badgeParts.forEach(part => { if(!part.code) return; - + badge.push(part.key); badge.push(part.color); badge.push(part.position); }); - + SendMessageComposer(new GroupSaveBadgeComposer(groupData.groupId, badge)); return true; @@ -69,7 +69,7 @@ export const GroupTabBadgeView: FC = props => useEffect(() => { if(groupData.groupBadgeParts) return; - + const badgeParts = [ new GroupBadgePart(GroupBadgePart.BASE, groupCustomize.badgeBases[0].id, groupCustomize.badgePartColors[0].id), new GroupBadgePart(GroupBadgePart.SYMBOL, 0, groupCustomize.badgePartColors[0].id), @@ -94,7 +94,7 @@ export const GroupTabBadgeView: FC = props => return; } - + setBadgeParts(groupData.groupBadgeParts); }, [ groupData ]); @@ -104,7 +104,7 @@ export const GroupTabBadgeView: FC = props => return () => setCloseAction(null); }, [ setCloseAction, saveBadge ]); - + return ( diff --git a/src/components/groups/views/tabs/GroupTabColorsView.tsx b/src/components/groups/views/tabs/GroupTabColorsView.tsx index 6fa9b35a..37a7fbfe 100644 --- a/src/components/groups/views/tabs/GroupTabColorsView.tsx +++ b/src/components/groups/views/tabs/GroupTabColorsView.tsx @@ -20,10 +20,10 @@ export const GroupTabColorsView: FC = props => const getGroupColor = (colorIndex: number) => { - if (colorIndex === 0) return groupCustomize.groupColorsA.find(color => (color.id === colors[colorIndex])).color; + if(colorIndex === 0) return groupCustomize.groupColorsA.find(color => (color.id === colors[colorIndex])).color; return groupCustomize.groupColorsB.find(color => (color.id === colors[colorIndex])).color; - } + }; const selectColor = (colorIndex: number, colorId: number) => { @@ -35,15 +35,15 @@ export const GroupTabColorsView: FC = props => return newColors; }); - } + }; const saveColors = useCallback(() => { - if (!groupData || !colors || !colors.length) return false; + if(!groupData || !colors || !colors.length) return false; - if (groupData.groupColors === colors) return true; + if(groupData.groupColors === colors) return true; - if (groupData.groupId <= 0) + if(groupData.groupId <= 0) { setGroupData(prevValue => { @@ -64,7 +64,7 @@ export const GroupTabColorsView: FC = props => useEffect(() => { - if (!groupCustomize.groupColorsA || !groupCustomize.groupColorsB || groupData.groupColors) return; + if(!groupCustomize.groupColorsA || !groupCustomize.groupColorsB || groupData.groupColors) return; const groupColors = [ groupCustomize.groupColorsA[0].id, groupCustomize.groupColorsB[0].id ]; @@ -76,7 +76,7 @@ export const GroupTabColorsView: FC = props => useEffect(() => { - if (groupData.groupId <= 0) + if(groupData.groupId <= 0) { setColors(groupData.groupColors ? [ ...groupData.groupColors ] : null); @@ -93,7 +93,7 @@ export const GroupTabColorsView: FC = props => return () => setCloseAction(null); }, [ setCloseAction, saveColors ]); - if (!colors) return null; + if(!colors) return null; return ( @@ -110,7 +110,7 @@ export const GroupTabColorsView: FC = props => { groupData.groupColors && groupCustomize.groupColorsA && groupCustomize.groupColorsA.map((item, index) => { - return
selectColor(0, item.id) }>
+ return
selectColor(0, item.id) }>
; }) }
@@ -119,7 +119,7 @@ export const GroupTabColorsView: FC = props => { groupData.groupColors && groupCustomize.groupColorsB && groupCustomize.groupColorsB.map((item, index) => { - return
selectColor(1, item.id) }>
+ return
selectColor(1, item.id) }>
; }) }
diff --git a/src/components/groups/views/tabs/GroupTabCreatorConfirmationView.tsx b/src/components/groups/views/tabs/GroupTabCreatorConfirmationView.tsx index 67859079..9c76e250 100644 --- a/src/components/groups/views/tabs/GroupTabCreatorConfirmationView.tsx +++ b/src/components/groups/views/tabs/GroupTabCreatorConfirmationView.tsx @@ -17,23 +17,23 @@ export const GroupTabCreatorConfirmationView: FC { - if (!groupData || !groupData.groupBadgeParts || !groupData.groupBadgeParts.length) return ''; + if(!groupData || !groupData.groupBadgeParts || !groupData.groupBadgeParts.length) return ''; let badgeCode = ''; groupData.groupBadgeParts.forEach(part => (part.code && (badgeCode += part.code))); return badgeCode; - } + }; const getGroupColor = (colorIndex: number) => { - if (colorIndex === 0) return groupCustomize.groupColorsA.find(c => c.id === groupData.groupColors[colorIndex]).color; + if(colorIndex === 0) return groupCustomize.groupColorsA.find(c => c.id === groupData.groupColors[colorIndex]).color; return groupCustomize.groupColorsB.find(c => c.id === groupData.groupColors[colorIndex]).color; - } + }; - if (!groupData) return null; + if(!groupData) return null; return ( diff --git a/src/components/groups/views/tabs/GroupTabIdentityView.tsx b/src/components/groups/views/tabs/GroupTabIdentityView.tsx index 3c5ffc2d..11e3e96e 100644 --- a/src/components/groups/views/tabs/GroupTabIdentityView.tsx +++ b/src/components/groups/views/tabs/GroupTabIdentityView.tsx @@ -1,51 +1,81 @@ -import { CreateLinkEvent, GroupDeleteComposer, GroupSaveInformationComposer } from '@nitrots/nitro-renderer'; -import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; +import +{ + CreateLinkEvent, + GroupDeleteComposer, + GroupSaveInformationComposer, +} from '@nitrots/nitro-renderer'; +import +{ + Dispatch, + FC, + SetStateAction, + useCallback, + useEffect, + useState, +} from 'react'; import { IGroupData, LocalizeText, SendMessageComposer } from '../../../../api'; import { Button, Column, Text } from '../../../../common'; import { useNotification } from '../../../../hooks'; import { NitroInput } from '../../../../layout'; -interface GroupTabIdentityViewProps -{ +interface GroupTabIdentityViewProps { groupData: IGroupData; setGroupData: Dispatch>; setCloseAction: Dispatch boolean }>>; onClose: () => void; isCreator?: boolean; - availableRooms?: { id: number, name: string }[]; + availableRooms?: { id: number; name: string }[]; } -export const GroupTabIdentityView: FC = props => +export const GroupTabIdentityView: FC = (props) => { - const { groupData = null, setGroupData = null, setCloseAction = null, onClose = null, isCreator = false, availableRooms = [] } = props; - const [ groupName, setGroupName ] = useState(''); - const [ groupDescription, setGroupDescription ] = useState(''); - const [ groupHomeroomId, setGroupHomeroomId ] = useState(-1); + const { + groupData = null, + setGroupData = null, + setCloseAction = null, + onClose = null, + isCreator = false, + availableRooms = [], + } = props; + const [groupName, setGroupName] = useState(''); + const [groupDescription, setGroupDescription] = useState(''); + const [groupHomeroomId, setGroupHomeroomId] = useState(-1); const { showConfirm = null } = useNotification(); const deleteGroup = () => { - if (!groupData || (groupData.groupId <= 0)) return; + if(!groupData || groupData.groupId <= 0) return; - showConfirm(LocalizeText('group.deleteconfirm.desc'), () => - { - SendMessageComposer(new GroupDeleteComposer(groupData.groupId)); + showConfirm( + LocalizeText('group.deleteconfirm.desc'), + () => + { + SendMessageComposer(new GroupDeleteComposer(groupData.groupId)); - if (onClose) onClose(); - }, null, null, null, LocalizeText('group.deleteconfirm.title')); - } + if(onClose) onClose(); + }, + null, + null, + null, + LocalizeText('group.deleteconfirm.title') + ); + }; const saveIdentity = useCallback(() => { - if (!groupData || !groupName || !groupName.length) return false; + if(!groupData || !groupName || !groupName.length) return false; - if ((groupName === groupData.groupName) && (groupDescription === groupData.groupDescription)) return true; + if( + groupName === groupData.groupName && + groupDescription === groupData.groupDescription + ) + return true; - if (groupData.groupId <= 0) + if(groupData.groupId <= 0) { - if (groupHomeroomId <= 0) return false; + if(groupHomeroomId <= 0) return false; - setGroupData(prevValue => + setGroupData((prevValue) => { const newValue = { ...prevValue }; @@ -59,59 +89,115 @@ export const GroupTabIdentityView: FC = props => return true; } - SendMessageComposer(new GroupSaveInformationComposer(groupData.groupId, groupName, (groupDescription || ''))); + SendMessageComposer( + new GroupSaveInformationComposer( + groupData.groupId, + groupName, + groupDescription || '' + ) + ); return true; - }, [ groupData, groupName, groupDescription, groupHomeroomId, setGroupData ]); + }, [groupData, groupName, groupDescription, groupHomeroomId, setGroupData]); useEffect(() => { setGroupName(groupData.groupName || ''); setGroupDescription(groupData.groupDescription || ''); setGroupHomeroomId(groupData.groupHomeroomId); - }, [ groupData ]); + }, [groupData]); useEffect(() => { setCloseAction({ action: saveIdentity }); return () => setCloseAction(null); - }, [ setCloseAction, saveIdentity ]); + }, [setCloseAction, saveIdentity]); - if (!groupData) return null; + if(!groupData) return null; return (
- { LocalizeText('group.edit.name') } - setGroupName(event.target.value) } /> + + {LocalizeText('group.edit.name')} + + setGroupName(event.target.value)} + />
- { LocalizeText('group.edit.desc') } -