diff --git a/src/views/notification-center/common/ProductImageUtility.ts b/src/api/common/ProductImageUtility.ts similarity index 93% rename from src/views/notification-center/common/ProductImageUtility.ts rename to src/api/common/ProductImageUtility.ts index 378194e8..3dfd5ef7 100644 --- a/src/views/notification-center/common/ProductImageUtility.ts +++ b/src/api/common/ProductImageUtility.ts @@ -1,6 +1,6 @@ import { CatalogPageMessageProductData } from '@nitrots/nitro-renderer'; -import { GetRoomEngine } from '../../../api'; -import { FurniCategory } from '../../../components/catalog/common/FurniCategory'; +import { GetRoomEngine } from '..'; +import { FurniCategory } from '../../components/catalog/common/FurniCategory'; export class ProductImageUtility { diff --git a/src/api/common/index.ts b/src/api/common/index.ts new file mode 100644 index 00000000..8fa51bfb --- /dev/null +++ b/src/api/common/index.ts @@ -0,0 +1 @@ +export * from './ProductImageUtility'; diff --git a/src/api/index.ts b/src/api/index.ts index 0b87703a..f44592e6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,7 +1,17 @@ +export * from './common'; export * from './core'; export * from './friends'; export * from './groups'; export * from './navigator'; export * from './nitro'; +export * from './nitro/avatar'; +export * from './nitro/camera'; +export * from './nitro/room'; +export * from './nitro/room/widgets'; +export * from './nitro/room/widgets/events'; +export * from './nitro/room/widgets/handlers'; +export * from './nitro/room/widgets/messages'; +export * from './nitro/session'; +export * from './notification'; export * from './user'; export * from './utils'; diff --git a/src/api/nitro/room/widgets/handlers/RoomWidgetChatInputHandler.ts b/src/api/nitro/room/widgets/handlers/RoomWidgetChatInputHandler.ts index 48e30ca6..b606474e 100644 --- a/src/api/nitro/room/widgets/handlers/RoomWidgetChatInputHandler.ts +++ b/src/api/nitro/room/widgets/handlers/RoomWidgetChatInputHandler.ts @@ -1,9 +1,8 @@ import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomWidgetEnum, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer'; import { GetConfiguration, GetNitroInstance, SendMessageComposer } from '../../..'; -import { GetRoomEngine, GetSessionDataManager, LocalizeText } from '../../../..'; +import { GetRoomEngine, GetSessionDataManager, LocalizeText, NotificationUtilities } from '../../../..'; import { FloorplanEditorEvent } from '../../../../../events/floorplan-editor/FloorplanEditorEvent'; import { DispatchUiEvent } from '../../../../../hooks'; -import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events'; import { RoomWidgetChatMessage, RoomWidgetChatSelectAvatarMessage, RoomWidgetChatTypingMessage, RoomWidgetMessage, RoomWidgetRequestWidgetMessage } from '../messages'; import { RoomWidgetHandler } from './RoomWidgetHandler'; diff --git a/src/views/notification-center/common/NotificationAlertItem.ts b/src/api/notification/NotificationAlertItem.ts similarity index 100% rename from src/views/notification-center/common/NotificationAlertItem.ts rename to src/api/notification/NotificationAlertItem.ts diff --git a/src/views/notification-center/common/NotificationAlertType.ts b/src/api/notification/NotificationAlertType.ts similarity index 100% rename from src/views/notification-center/common/NotificationAlertType.ts rename to src/api/notification/NotificationAlertType.ts diff --git a/src/views/notification-center/common/NotificationBubbleItem.ts b/src/api/notification/NotificationBubbleItem.ts similarity index 100% rename from src/views/notification-center/common/NotificationBubbleItem.ts rename to src/api/notification/NotificationBubbleItem.ts diff --git a/src/views/notification-center/common/NotificationBubbleType.ts b/src/api/notification/NotificationBubbleType.ts similarity index 100% rename from src/views/notification-center/common/NotificationBubbleType.ts rename to src/api/notification/NotificationBubbleType.ts diff --git a/src/views/notification-center/common/NotificationConfirmItem.ts b/src/api/notification/NotificationConfirmItem.ts similarity index 100% rename from src/views/notification-center/common/NotificationConfirmItem.ts rename to src/api/notification/NotificationConfirmItem.ts diff --git a/src/views/notification-center/common/NotificationConfirmType.ts b/src/api/notification/NotificationConfirmType.ts similarity index 100% rename from src/views/notification-center/common/NotificationConfirmType.ts rename to src/api/notification/NotificationConfirmType.ts diff --git a/src/views/notification-center/common/NotificationUtilities.ts b/src/api/notification/NotificationUtilities.ts similarity index 96% rename from src/views/notification-center/common/NotificationUtilities.ts rename to src/api/notification/NotificationUtilities.ts index f7ecd990..6620da82 100644 --- a/src/views/notification-center/common/NotificationUtilities.ts +++ b/src/api/notification/NotificationUtilities.ts @@ -1,9 +1,9 @@ import { HabboWebTools, RoomEnterEffect } from '@nitrots/nitro-renderer'; -import { CreateLinkEvent, GetConfiguration, GetNitroInstance, LocalizeText } from '../../../api'; -import { CatalogPageName } from '../../../components/catalog/common/CatalogPageName'; -import { NotificationAlertEvent, NotificationConfirmEvent } from '../../../events'; -import { NotificationBubbleEvent } from '../../../events/notification-center/NotificationBubbleEvent'; -import { DispatchUiEvent } from '../../../hooks'; +import { CreateLinkEvent, GetConfiguration, GetNitroInstance, LocalizeText } from '..'; +import { CatalogPageName } from '../../components/catalog/common/CatalogPageName'; +import { NotificationAlertEvent, NotificationConfirmEvent } from '../../events'; +import { NotificationBubbleEvent } from '../../events/notification-center/NotificationBubbleEvent'; +import { DispatchUiEvent } from '../../hooks'; import { NotificationAlertType } from './NotificationAlertType'; import { NotificationBubbleType } from './NotificationBubbleType'; @@ -79,6 +79,8 @@ export class NotificationUtilities const linkUrl = this.getNotificationPart(options, type, 'linkUrl', false); const image = this.getNotificationImageUrl(options, type); + console.log(image, LocalizeText(image)); + if(options.get('display') === 'BUBBLE') { this.showSingleBubble(LocalizeText(message), NotificationBubbleType.INFO, LocalizeText(image), linkUrl); diff --git a/src/api/notification/index.ts b/src/api/notification/index.ts new file mode 100644 index 00000000..6489b87f --- /dev/null +++ b/src/api/notification/index.ts @@ -0,0 +1,7 @@ +export * from './NotificationAlertItem'; +export * from './NotificationAlertType'; +export * from './NotificationBubbleItem'; +export * from './NotificationBubbleType'; +export * from './NotificationConfirmItem'; +export * from './NotificationConfirmType'; +export * from './NotificationUtilities'; diff --git a/src/common/index.scss b/src/common/index.scss index 78935910..95283d24 100644 --- a/src/common/index.scss +++ b/src/common/index.scss @@ -207,7 +207,6 @@ background-color: rgba($dark,.95); box-shadow: inset 0px 5px lighten(rgba($dark,.6),2.5), inset 0 -4px darken(rgba($dark,.6),4); font-size: $font-size-sm; - margin-bottom: 5px; .bubble-image-container { min-width: 50px; diff --git a/src/common/layout/LayoutNotificationAlertView.tsx b/src/common/layout/LayoutNotificationAlertView.tsx index c0483487..3e11b0da 100644 --- a/src/common/layout/LayoutNotificationAlertView.tsx +++ b/src/common/layout/LayoutNotificationAlertView.tsx @@ -1,7 +1,7 @@ import { FC, useMemo } from 'react'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroCardViewProps } from '../card'; -interface LayoutNotificationAlertViewProps extends NitroCardViewProps +export interface LayoutNotificationAlertViewProps extends NitroCardViewProps { title: string; close: () => void; @@ -23,7 +23,7 @@ export const LayoutNotificationAlertView: FC = return ( - + { children } diff --git a/src/components/camera/views/capture/CameraWidgetCaptureView.tsx b/src/components/camera/views/capture/CameraWidgetCaptureView.tsx index 4a4fb03b..a7f16f60 100644 --- a/src/components/camera/views/capture/CameraWidgetCaptureView.tsx +++ b/src/components/camera/views/capture/CameraWidgetCaptureView.tsx @@ -1,9 +1,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { NitroRectangle, TextureUtils } from '@nitrots/nitro-renderer'; import { FC, useCallback, useRef } from 'react'; -import { GetRoomEngine, GetRoomSession, LocalizeText, PlaySound, SoundNames } from '../../../../api'; +import { GetRoomEngine, GetRoomSession, LocalizeText, NotificationUtilities, PlaySound, SoundNames } from '../../../../api'; import { Column, DraggableWindow, Flex } from '../../../../common'; -import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { useCameraWidgetContext } from '../../CameraWidgetContext'; import { CameraPicture } from '../../common/CameraPicture'; diff --git a/src/components/catalog/CatalogMessageHandler.tsx b/src/components/catalog/CatalogMessageHandler.tsx index ce829a33..9de5b0ce 100644 --- a/src/components/catalog/CatalogMessageHandler.tsx +++ b/src/components/catalog/CatalogMessageHandler.tsx @@ -1,11 +1,9 @@ import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceConfigurationEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent'; import { FC, useCallback } from 'react'; -import { GetFurnitureData, GetProductDataForLocalization, LocalizeText } from '../../api'; +import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api'; import { CatalogGiftReceiverNotFoundEvent, CatalogNameResultEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogSetExtraPurchaseParameterEvent } from '../../events'; import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks'; -import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { useCatalogContext } from './CatalogContext'; import { CatalogNode } from './common/CatalogNode'; import { CatalogPetPalette } from './common/CatalogPetPalette'; diff --git a/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx b/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx index 472e4762..ba3dfdd8 100644 --- a/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx +++ b/src/components/catalog/views/page/common/CatalogRedeemVoucherView.tsx @@ -1,10 +1,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { RedeemVoucherMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../../api'; +import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../api'; import { Button, Flex } from '../../../../../common'; import { BatchUpdates, UseMessageEventHook } from '../../../../../hooks'; -import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; export interface CatalogRedeemVoucherViewProps { diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx index c4176472..710d422a 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx @@ -1,10 +1,8 @@ import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageComposer, MarketplaceCancelOfferResultEvent, MarketplaceOwnOffersEvent, RedeemMarketplaceOfferCreditsMessageComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useMemo, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../../../api'; +import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { Button, Column, Text } from '../../../../../../common'; import { BatchUpdates, UseMessageEventHook, UseMountEffect } from '../../../../../../hooks'; -import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutMarketplaceItemView, OWN_OFFER } from './CatalogLayoutMarketplaceItemView'; import { MarketplaceOfferData } from './common/MarketplaceOfferData'; diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx index 7c2eab4d..8079ef9f 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx @@ -1,10 +1,8 @@ import { BuyMarketplaceOfferMessageComposer, GetMarketplaceOffersMessageComposer, MarketplaceBuyOfferResultEvent, MarketPlaceOffersEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useMemo, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../../../api'; +import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { Button, ButtonGroup, Column, Text } from '../../../../../../common'; import { BatchUpdates, UseMessageEventHook } from '../../../../../../hooks'; -import { NotificationAlertType } from '../../../../../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { GetCurrencyAmount } from '../../../../../purse/common/CurrencyHelper'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutMarketplaceItemView, PUBLIC_OFFER } from './CatalogLayoutMarketplaceItemView'; diff --git a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx index b9a7c859..5634b618 100644 --- a/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/MarketplacePostOfferView.tsx @@ -1,10 +1,9 @@ import { ImageResult, MakeOfferMessageComposer, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../../../api'; +import { GetRoomEngine, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { Base, Button, Column, Grid, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../../common'; import { CatalogPostMarketplaceOfferEvent } from '../../../../../../events'; import { BatchUpdates, UseUiEvent } from '../../../../../../hooks'; -import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { FurnitureItem } from '../../../../../inventory/common/FurnitureItem'; import { useCatalogContext } from '../../../../CatalogContext'; 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 dc44f975..c60e807d 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx @@ -1,8 +1,7 @@ import { SelectClubGiftComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../../../api'; +import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../../api'; import { AutoGrid, Text } from '../../../../../../common'; -import { NotificationUtilities } from '../../../../../../views/notification-center/common/NotificationUtilities'; import { useCatalogContext } from '../../../../CatalogContext'; import { CatalogLayoutProps } from '../CatalogLayout.types'; import { VipGiftItem } from './VipGiftItemView'; 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 61e683ac..fdd9cdb7 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/VipGiftItemView.tsx @@ -1,11 +1,7 @@ import { CatalogPageMessageOfferData } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { LocalizeText } from '../../../../../../api'; -import { Button } from '../../../../../../common/Button'; -import { LayoutGridItem } from '../../../../../../common/layout/LayoutGridItem'; -import { LayoutImage } from '../../../../../../common/layout/LayoutImage'; -import { Text } from '../../../../../../common/Text'; -import { ProductImageUtility } from '../../../../../../views/notification-center/common/ProductImageUtility'; +import { LocalizeText, ProductImageUtility } from '../../../../../../api'; +import { Button, LayoutGridItem, LayoutImage, Text } from '../../../../../../common'; export interface VipGiftItemViewProps { diff --git a/src/components/groups/views/GroupInformationView.tsx b/src/components/groups/views/GroupInformationView.tsx index 582b52e1..d15a2779 100644 --- a/src/components/groups/views/GroupInformationView.tsx +++ b/src/components/groups/views/GroupInformationView.tsx @@ -1,8 +1,7 @@ import { GroupInformationParser, GroupRemoveMemberComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { CreateLinkEvent, GetGroupManager, GetGroupMembers, GetSessionDataManager, LocalizeText, SendMessageComposer, TryJoinGroup, TryVisitRoom } from '../../../api'; +import { CreateLinkEvent, GetGroupManager, GetGroupMembers, GetSessionDataManager, LocalizeText, NotificationUtilities, SendMessageComposer, TryJoinGroup, TryVisitRoom } from '../../../api'; import { Button, Column, Flex, Grid, LayoutBadgeImageView, Text } from '../../../common'; -import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { CatalogPageName } from '../../catalog/common/CatalogPageName'; import { GroupMembershipType } from '../common/GroupMembershipType'; import { GroupType } from '../common/GroupType'; diff --git a/src/components/groups/views/GroupMembersView.tsx b/src/components/groups/views/GroupMembersView.tsx index 13fa17a2..5bafa369 100644 --- a/src/components/groups/views/GroupMembersView.tsx +++ b/src/components/groups/views/GroupMembersView.tsx @@ -1,10 +1,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { GroupAdminGiveComposer, GroupAdminTakeComposer, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupMemberParser, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembersParser, GroupRank, GroupRemoveMemberComposer, ILinkEventTracker } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; -import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../../api'; +import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, NotificationUtilities, RemoveLinkEventTracker, SendMessageComposer } from '../../../api'; import { Base, Button, Column, Flex, Grid, LayoutAvatarImageView, LayoutBadgeImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common'; import { BatchUpdates, UseMessageEventHook } from '../../../hooks'; -import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; export const GroupMembersView: FC<{}> = props => { diff --git a/src/components/groups/views/GroupRoomInformationView.tsx b/src/components/groups/views/GroupRoomInformationView.tsx index b111c5df..4e000569 100644 --- a/src/components/groups/views/GroupRoomInformationView.tsx +++ b/src/components/groups/views/GroupRoomInformationView.tsx @@ -1,10 +1,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { DesktopViewEvent, GetGuestRoomResultEvent, GroupInformationComposer, GroupInformationEvent, GroupInformationParser, GroupRemoveMemberComposer, HabboGroupDeactivatedMessageEvent, RoomEntryInfoMessageEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; -import { GetGroupInformation, GetGroupManager, GetSessionDataManager, LocalizeText, SendMessageComposer, TryJoinGroup } from '../../../api'; +import { GetGroupInformation, GetGroupManager, GetSessionDataManager, LocalizeText, NotificationUtilities, SendMessageComposer, TryJoinGroup } from '../../../api'; import { Base, Button, Column, Flex, LayoutBadgeImageView, Text } from '../../../common'; import { UseMessageEventHook } from '../../../hooks'; -import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { GroupMembershipType } from '../common/GroupMembershipType'; import { GroupType } from '../common/GroupType'; diff --git a/src/components/groups/views/tabs/GroupTabIdentityView.tsx b/src/components/groups/views/tabs/GroupTabIdentityView.tsx index a4c39719..24f1af33 100644 --- a/src/components/groups/views/tabs/GroupTabIdentityView.tsx +++ b/src/components/groups/views/tabs/GroupTabIdentityView.tsx @@ -1,9 +1,8 @@ import { GroupDeleteComposer, GroupSaveInformationComposer } from '@nitrots/nitro-renderer'; import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; -import { CreateLinkEvent, LocalizeText, SendMessageComposer } from '../../../../api'; +import { CreateLinkEvent, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../api'; import { Base, Button, Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { IGroupData } from '../../common/IGroupData'; interface GroupTabIdentityViewProps diff --git a/src/components/help/HelpMessageHandler.tsx b/src/components/help/HelpMessageHandler.tsx index 3f538542..c28dbd96 100644 --- a/src/components/help/HelpMessageHandler.tsx +++ b/src/components/help/HelpMessageHandler.tsx @@ -1,9 +1,7 @@ import { CallForHelpResultMessageEvent, GetPendingCallsForHelpMessageComposer, IssueCloseNotificationMessageEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../api'; +import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../api'; import { UseMessageEventHook } from '../../hooks'; -import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { CallForHelpResult } from './common/CallForHelpResult'; import { GetCloseReasonKey } from './common/GetCloseReasonKey'; diff --git a/src/components/index.scss b/src/components/index.scss index 8079c9b0..4346ea12 100644 --- a/src/components/index.scss +++ b/src/components/index.scss @@ -13,6 +13,7 @@ @import './loading/LoadingView'; @import './mod-tools/ModToolsView'; @import './navigator/NavigatorView'; +@import './notification-center/NotificationCenterView'; @import './purse/PurseView'; @import './right-side/RightSideView'; @import './room/RoomView'; diff --git a/src/components/inventory/InventoryMessageHandler.tsx b/src/components/inventory/InventoryMessageHandler.tsx index 26155cf3..c16d36db 100644 --- a/src/components/inventory/InventoryMessageHandler.tsx +++ b/src/components/inventory/InventoryMessageHandler.tsx @@ -1,11 +1,8 @@ import { AdvancedMap, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BotAddedToInventoryEvent, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, FurnitureListAddOrUpdateEvent, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent, PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestBadgesComposer, TradingAcceptEvent, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationEvent, TradingListItemEvent, TradingNotOpenEvent, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingYouAreNotAllowedEvent, UnseenItemsEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { GetLocalization, GetRoomSession, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../api'; -import { InventoryBadgesUpdatedEvent } from '../../events'; -import { InventoryBadgesRequestEvent } from '../../events/inventory/InventoryBadgesRequestEvent'; -import { DispatchUiEvent, UseUiEvent } from '../../hooks'; -import { UseMessageEventHook } from '../../hooks/messages/UseMessageEventHook'; -import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; +import { GetLocalization, GetRoomSession, GetSessionDataManager, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../api'; +import { InventoryBadgesRequestEvent, InventoryBadgesUpdatedEvent } from '../../events'; +import { DispatchUiEvent, UseMessageEventHook, UseUiEvent } from '../../hooks'; import { mergeFurniFragments } from './common/FurnitureUtilities'; import { mergePetFragments } from './common/PetUtilities'; import { TradeState } from './common/TradeState'; diff --git a/src/components/inventory/views/badge/InventoryBadgeView.tsx b/src/components/inventory/views/badge/InventoryBadgeView.tsx index b7701ede..8bf4f873 100644 --- a/src/components/inventory/views/badge/InventoryBadgeView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeView.tsx @@ -77,7 +77,7 @@ export const InventoryBadgeView: FC = props => { if(activeBadges.indexOf(code) >= 0) return null; - return + return }) } diff --git a/src/components/inventory/views/trade/InventoryTradeView.tsx b/src/components/inventory/views/trade/InventoryTradeView.tsx index 0acfba12..1b52dfd1 100644 --- a/src/components/inventory/views/trade/InventoryTradeView.tsx +++ b/src/components/inventory/views/trade/InventoryTradeView.tsx @@ -1,10 +1,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FurnitureListComposer, IObjectData, TradingAcceptComposer, TradingConfirmationComposer, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemRemoveComposer, TradingUnacceptComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../api'; +import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../api'; import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, Text } from '../../../../common'; -import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { FurniCategory } from '../../common/FurniCategory'; import { GroupItem } from '../../common/GroupItem'; import { IFurnitureItem } from '../../common/IFurnitureItem'; diff --git a/src/components/loading/LoadingView.tsx b/src/components/loading/LoadingView.tsx index ecf4fc75..bb3f953f 100644 --- a/src/components/loading/LoadingView.tsx +++ b/src/components/loading/LoadingView.tsx @@ -1,6 +1,6 @@ import { FC, useEffect, useState } from 'react'; +import { NotificationUtilities } from '../../api'; import { Base, Column } from '../../common'; -import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; interface LoadingViewProps { diff --git a/src/components/mod-tools/ModToolsMessageHandler.tsx b/src/components/mod-tools/ModToolsMessageHandler.tsx index e2b11619..efe77935 100644 --- a/src/components/mod-tools/ModToolsMessageHandler.tsx +++ b/src/components/mod-tools/ModToolsMessageHandler.tsx @@ -1,10 +1,8 @@ import { CfhSanctionMessageEvent, CfhTopicsInitEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorToolPreferencesEvent, RoomEngineEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { PlaySound, SoundNames } from '../../api'; +import { NotificationAlertType, NotificationUtilities, PlaySound, SoundNames } from '../../api'; import { ModToolsEvent, ModToolsOpenRoomChatlogEvent, ModToolsOpenRoomInfoEvent, ModToolsOpenUserChatlogEvent, ModToolsOpenUserInfoEvent } from '../../events'; import { UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks'; -import { NotificationAlertType } from '../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../views/notification-center/common/NotificationUtilities'; import { SetCfhCategories } from './common/GetCFHCategories'; import { useModToolsContext } from './ModToolsContext'; import { ModToolsActions } from './reducers/ModToolsReducer'; diff --git a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx index 514e4151..a2e564ce 100644 --- a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx +++ b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx @@ -1,9 +1,7 @@ import { CallForHelpTopicData, DefaultSanctionMessageComposer, ModAlertMessageComposer, ModBanMessageComposer, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModTradingLockMessageComposer } from '@nitrots/nitro-renderer'; import { FC, useMemo, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../api'; +import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../api'; import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; -import { NotificationAlertType } from '../../../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../views/notification-center/common/NotificationUtilities'; import { useModToolsContext } from '../../ModToolsContext'; import { ISelectedUser } from '../../utils/ISelectedUser'; import { ModActionDefinition } from '../../utils/ModActionDefinition'; diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx index 4f0d6738..4b48e1bb 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx @@ -1,9 +1,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { RoomDeleteComposer } from '@nitrots/nitro-renderer'; import { FC, useState } from 'react'; -import { LocalizeText, SendMessageComposer } from '../../../../../api'; +import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../api'; import { Base, Flex, Text } from '../../../../../common'; -import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; import { GetMaxVisitorsList } from '../../../common/RoomSettingsUtils'; import { useNavigatorContext } from '../../../NavigatorContext'; import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; diff --git a/src/views/notification-center/NotificationCenterMessageHandler.tsx b/src/components/notification-center/NotificationCenterMessageHandler.tsx similarity index 90% rename from src/views/notification-center/NotificationCenterMessageHandler.tsx rename to src/components/notification-center/NotificationCenterMessageHandler.tsx index 35507f62..9a8cf9c7 100644 --- a/src/views/notification-center/NotificationCenterMessageHandler.tsx +++ b/src/components/notification-center/NotificationCenterMessageHandler.tsx @@ -1,13 +1,9 @@ import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, HabboBroadcastMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, MaintenanceStatusMessageEvent, ModeratorCautionEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent, PetLevelNotificationEvent, PetReceivedMessageEvent, RespectReceivedEvent, RoomEnterEvent, UserBannedMessageEvent, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { GetConfiguration, GetRoomEngine, GetSessionDataManager, LocalizeBadgeName, LocalizeText } from '../../api'; +import { GetConfiguration, GetRoomEngine, GetSessionDataManager, LocalizeBadgeName, LocalizeText, NotificationBubbleType, NotificationUtilities, ProductImageUtility } from '../../api'; import { UseMessageEventHook } from '../../hooks'; -import { NotificationBubbleType } from './common/NotificationBubbleType'; -import { NotificationUtilities } from './common/NotificationUtilities'; -import { ProductImageUtility } from './common/ProductImageUtility'; -import { INotificationCenterMessageHandlerProps } from './NotificationCenterMessageHandler.types'; -export const NotificationCenterMessageHandler: FC = props => +export const NotificationCenterMessageHandler: FC<{}> = props => { const onRespectReceivedEvent = useCallback((event: RespectReceivedEvent) => { @@ -71,16 +67,9 @@ export const NotificationCenterMessageHandler: FC('currency.asset.icon.url', '').replace('%type%', parser.type.toString()); - switch(parser.type) - { - case 5: - imageUrl = GetConfiguration('currency.asset.icon.url', '').replace('%type%', parser.type.toString()); - break; - } - - NotificationUtilities.showSingleBubble(LocalizeText('notifications.text.loyalty.received', [ 'AMOUNT' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl); + NotificationUtilities.showSingleBubble(LocalizeText(`notifications.text.activitypoints.${ parser.type }`, [ 'AMOUNT' ], [ parser.amountChanged.toString() ]), NotificationBubbleType.INFO, imageUrl); }, []); UseMessageEventHook(ActivityPointNotificationMessageEvent, onActivityPointNotificationMessageEvent); @@ -199,6 +188,8 @@ export const NotificationCenterMessageHandler: FC = props => +export const NotificationCenterView: FC<{}> = props => { const [ alerts, setAlerts ] = useState([]); const [ bubbleAlerts, setBubbleAlerts ] = useState([]); @@ -142,9 +138,9 @@ export const NotificationCenterView: FC = props => return ( <> -
+ { getBubbleAlerts } -
+ { getConfirms } { getAlerts } diff --git a/src/views/notification-center/views/alert-layouts/GetAlertLayout.tsx b/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx similarity index 78% rename from src/views/notification-center/views/alert-layouts/GetAlertLayout.tsx rename to src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx index 2da8be43..10235956 100644 --- a/src/views/notification-center/views/alert-layouts/GetAlertLayout.tsx +++ b/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx @@ -1,5 +1,4 @@ -import { NotificationAlertItem } from '../../common/NotificationAlertItem'; -import { NotificationAlertType } from '../../common/NotificationAlertType'; +import { NotificationAlertItem, NotificationAlertType } from '../../../../api'; import { NotificationDefaultAlertView } from './NotificationDefaultAlertView'; import { NotificationEventAlertView } from './NotificationEventAlertView'; diff --git a/src/views/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts b/src/components/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts similarity index 59% rename from src/views/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts rename to src/components/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts index 57c77873..c83877ac 100644 --- a/src/views/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts +++ b/src/components/notification-center/views/alert-layouts/NotificationAlertLayoutView.types.ts @@ -1,4 +1,4 @@ -import { NotificationAlertItem } from '../../common/NotificationAlertItem'; +import { NotificationAlertItem } from '../../../../api'; export interface NotificationAlertLayoutViewProps { diff --git a/src/views/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx b/src/components/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx similarity index 55% rename from src/views/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx rename to src/components/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx index 3b88e35a..eef9f5fd 100644 --- a/src/views/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx +++ b/src/components/notification-center/views/alert-layouts/NotificationDefaultAlertView.tsx @@ -1,7 +1,6 @@ import { DetailsHTMLAttributes, FC, useCallback } from 'react'; -import { LocalizeText } from '../../../../api'; -import { LayoutNotificationAlertView } from '../../../../common'; -import { NotificationUtilities } from '../../common/NotificationUtilities'; +import { LocalizeText, NotificationUtilities } from '../../../../api'; +import { Base, Button, Column, LayoutNotificationAlertView } from '../../../../common'; import { NotificationAlertLayoutViewProps } from './NotificationAlertLayoutView.types'; interface NotificationDefaultAlertViewProps extends NotificationAlertLayoutViewProps, DetailsHTMLAttributes @@ -26,15 +25,13 @@ export const NotificationDefaultAlertView: FC { const htmlText = message.replace(/\r\n|\r|\n/g, '
'); - return ( -
- ); + return ; }) } -
- -
- { item.clickUrl && item.clickUrl.length && - } + + + { item.clickUrl && item.clickUrl.length && + } + ); } diff --git a/src/views/notification-center/views/alert-layouts/NotificationEventAlertView.tsx b/src/components/notification-center/views/alert-layouts/NotificationEventAlertView.tsx similarity index 91% rename from src/views/notification-center/views/alert-layouts/NotificationEventAlertView.tsx rename to src/components/notification-center/views/alert-layouts/NotificationEventAlertView.tsx index 2c1ff640..a6c039d6 100644 --- a/src/views/notification-center/views/alert-layouts/NotificationEventAlertView.tsx +++ b/src/components/notification-center/views/alert-layouts/NotificationEventAlertView.tsx @@ -1,7 +1,6 @@ import { DetailsHTMLAttributes, FC, useCallback } from 'react'; -import { LocalizeText } from '../../../../api'; +import { LocalizeText, NotificationUtilities } from '../../../../api'; import { LayoutNotificationAlertView } from '../../../../common'; -import { NotificationUtilities } from '../../common/NotificationUtilities'; import { NotificationAlertLayoutViewProps } from './NotificationAlertLayoutView.types'; interface NotificationEventAlertViewProps extends NotificationAlertLayoutViewProps, DetailsHTMLAttributes diff --git a/src/views/notification-center/views/bubble-layouts/GetBubbleLayout.tsx b/src/components/notification-center/views/bubble-layouts/GetBubbleLayout.tsx similarity index 78% rename from src/views/notification-center/views/bubble-layouts/GetBubbleLayout.tsx rename to src/components/notification-center/views/bubble-layouts/GetBubbleLayout.tsx index 7ede0121..6293f442 100644 --- a/src/views/notification-center/views/bubble-layouts/GetBubbleLayout.tsx +++ b/src/components/notification-center/views/bubble-layouts/GetBubbleLayout.tsx @@ -1,5 +1,4 @@ -import { NotificationBubbleItem } from '../../common/NotificationBubbleItem'; -import { NotificationBubbleType } from '../../common/NotificationBubbleType'; +import { NotificationBubbleItem, NotificationBubbleType } from '../../../../api'; import { NotificationClubGiftBubbleView } from './NotificationClubGiftBubbleView'; import { NotificationDefaultBubbleView } from './NotificationDefaultBubbleView'; diff --git a/src/views/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts b/src/components/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts similarity index 59% rename from src/views/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts rename to src/components/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts index 5f9c81d6..096924c2 100644 --- a/src/views/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts +++ b/src/components/notification-center/views/bubble-layouts/NotificationBubbleLayoutView.types.ts @@ -1,4 +1,4 @@ -import { NotificationBubbleItem } from '../../common/NotificationBubbleItem'; +import { NotificationBubbleItem } from '../../../../api'; export interface NotificationBubbleLayoutViewProps { diff --git a/src/views/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx b/src/components/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx similarity index 91% rename from src/views/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx rename to src/components/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx index 1df87c86..dc2adaf7 100644 --- a/src/views/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx +++ b/src/components/notification-center/views/bubble-layouts/NotificationClubGiftBubbleView.tsx @@ -1,7 +1,6 @@ import { FC } from 'react'; -import { LocalizeText } from '../../../../api'; +import { LocalizeText, NotificationUtilities } from '../../../../api'; import { LayoutCurrencyIcon, LayoutNotificationBubbleView } from '../../../../common'; -import { NotificationUtilities } from '../../common/NotificationUtilities'; import { NotificationBubbleLayoutViewProps } from './NotificationBubbleLayoutView.types'; export const NotificationClubGiftBubbleView: FC = props => diff --git a/src/views/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx b/src/components/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx similarity index 51% rename from src/views/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx rename to src/components/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx index 5a591530..68f23193 100644 --- a/src/views/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx +++ b/src/components/notification-center/views/bubble-layouts/NotificationDefaultBubbleView.tsx @@ -1,5 +1,5 @@ import { DetailsHTMLAttributes, FC } from 'react'; -import { LayoutNotificationBubbleView } from '../../../../common'; +import { Flex, LayoutNotificationBubbleView, Text } from '../../../../common'; import { NotificationBubbleLayoutViewProps } from './NotificationBubbleLayoutView.types'; interface NotificationDefaultBubbleViewProps extends NotificationBubbleLayoutViewProps, DetailsHTMLAttributes @@ -12,9 +12,12 @@ export const NotificationDefaultBubbleView: FC - { (item.iconUrl && item.iconUrl.length) && } - { item.message } + + + { (item.iconUrl && item.iconUrl.length) && + } + + { item.message } ); } diff --git a/src/views/notification-center/views/confirm-layouts/GetConfirmLayout.tsx b/src/components/notification-center/views/confirm-layouts/GetConfirmLayout.tsx similarity index 82% rename from src/views/notification-center/views/confirm-layouts/GetConfirmLayout.tsx rename to src/components/notification-center/views/confirm-layouts/GetConfirmLayout.tsx index 5698561d..c2e97d77 100644 --- a/src/views/notification-center/views/confirm-layouts/GetConfirmLayout.tsx +++ b/src/components/notification-center/views/confirm-layouts/GetConfirmLayout.tsx @@ -1,4 +1,4 @@ -import { NotificationConfirmItem } from '../../common/NotificationConfirmItem'; +import { NotificationConfirmItem } from '../../../../api'; import { NotificationDefaultConfirmView } from './NotificationDefaultConfirmView'; export const GetConfirmLayout = (item: NotificationConfirmItem, close: () => void) => diff --git a/src/views/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts b/src/components/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts similarity index 58% rename from src/views/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts rename to src/components/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts index fbddeb27..d03dc45b 100644 --- a/src/views/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts +++ b/src/components/notification-center/views/confirm-layouts/NotificationConfirmLayoutView.types.ts @@ -1,4 +1,4 @@ -import { NotificationConfirmItem } from '../../common/NotificationConfirmItem'; +import { NotificationConfirmItem } from '../../../../api'; export interface NotificationConfirmLayoutViewProps { diff --git a/src/views/notification-center/views/confirm-layouts/NotificationDefaultConfirmView.tsx b/src/components/notification-center/views/confirm-layouts/NotificationDefaultConfirmView.tsx similarity index 100% rename from src/views/notification-center/views/confirm-layouts/NotificationDefaultConfirmView.tsx rename to src/components/notification-center/views/confirm-layouts/NotificationDefaultConfirmView.tsx diff --git a/src/components/right-side/RightSideView.tsx b/src/components/right-side/RightSideView.tsx index 21d2271b..c94e5179 100644 --- a/src/components/right-side/RightSideView.tsx +++ b/src/components/right-side/RightSideView.tsx @@ -1,7 +1,7 @@ import { FC } from 'react'; import { Column } from '../../common'; -import { NotificationCenterView } from '../../views/notification-center/NotificationCenterView'; import { GroupRoomInformationView } from '../groups/views/GroupRoomInformationView'; +import { NotificationCenterView } from '../notification-center/NotificationCenterView'; import { PurseView } from '../purse/PurseView'; export const RightSideView: FC<{}> = props => diff --git a/src/components/room/widgets/RoomWidgetsView.tsx b/src/components/room/widgets/RoomWidgetsView.tsx index 9316e4a2..c8bea4a2 100644 --- a/src/components/room/widgets/RoomWidgetsView.tsx +++ b/src/components/room/widgets/RoomWidgetsView.tsx @@ -1,10 +1,8 @@ import { RoomEngineEvent, RoomEngineObjectEvent, RoomEngineRoomAdEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomId, RoomObjectCategory, RoomObjectOperationType, RoomObjectVariable, RoomSessionChatEvent, RoomSessionDanceEvent, RoomSessionDimmerPresetsEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionEvent, RoomSessionFriendRequestEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionPollEvent, RoomSessionPresentEvent, RoomSessionUserBadgesEvent, RoomSessionUserFigureUpdateEvent, RoomSessionWordQuizEvent, RoomZoomEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; -import { CanManipulateFurniture, GetRoomEngine, GetSessionDataManager, IsFurnitureSelectionDisabled, LocalizeText, ProcessRoomObjectOperation, RoomWidgetFurniToWidgetMessage, RoomWidgetUpdateRoomEngineEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../api'; +import { CanManipulateFurniture, GetRoomEngine, GetSessionDataManager, IsFurnitureSelectionDisabled, LocalizeText, NotificationAlertType, NotificationUtilities, ProcessRoomObjectOperation, RoomWidgetFurniToWidgetMessage, RoomWidgetUpdateRoomEngineEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../api'; import { FriendRequestEvent } from '../../../events'; import { UseRoomEngineEvent, UseRoomSessionManagerEvent, UseUiEvent } from '../../../hooks'; -import { NotificationAlertType } from '../../../views/notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../views/notification-center/common/NotificationUtilities'; import { useRoomContext } from '../RoomContext'; import { AvatarInfoWidgetView } from './avatar-info/AvatarInfoWidgetView'; import { ChatInputView } from './chat-input/ChatInputView'; diff --git a/src/views/Styles.scss b/src/views/Styles.scss index cdc76322..76a2a4f3 100644 --- a/src/views/Styles.scss +++ b/src/views/Styles.scss @@ -1,5 +1,4 @@ @import "./shared/Shared"; @import "./hotel-view/HotelView"; -@import "./notification-center/NotificationCenterView"; @import "./nitropedia/NitropediaView"; @import "./hc-center/HcCenterView.scss"; diff --git a/src/views/hc-center/HcCenterView.tsx b/src/views/hc-center/HcCenterView.tsx index ba899712..e3babadb 100644 --- a/src/views/hc-center/HcCenterView.tsx +++ b/src/views/hc-center/HcCenterView.tsx @@ -2,7 +2,7 @@ import { BadgesEvent, ClubGiftInfoEvent, FigureUpdateEvent, FriendlyTime, GetClu import { FC, useCallback, useEffect, useState } from 'react'; import { OverlayTrigger, Popover } from 'react-bootstrap'; import { AddEventLinkTracker, CreateLinkEvent, GetConfiguration, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api'; -import { LayoutAvatarImageView, LayoutBadgeImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; +import { Base, Button, Column, Flex, LayoutAvatarImageView, LayoutBadgeImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common'; import { HcCenterEvent } from '../../events'; import { UseMessageEventHook, UseUiEvent } from '../../hooks'; import { BadgeResolver } from './util/BadgeResolver'; @@ -11,17 +11,131 @@ import { ClubStatus } from './util/ClubStatus'; export const HcCenterView: FC<{}> = props => { - const [isVisible, setIsVisible] = useState(false); - const [userFigure, setUserFigure] = useState(null); - const [kickbackData, setKickbackData] = useState(null); - const [clubDays, setClubDays] = useState(0); - const [pastClubDays, setPastClubDays] = useState(0); - const [clubPeriods, setPastClubPeriods] = useState(0); - const [minsTillExpire, setMinsTillExpire] = useState(0); - const [clubStatus, setClubStatus] = useState(ClubStatus.NONE); - const [unclaimedGifts, setUnclaimedGifts] = useState(0); + const [ isVisible, setIsVisible ] = useState(false); + const [ userFigure, setUserFigure ] = useState(null); + const [ kickbackData, setKickbackData ] = useState(null); + const [ clubDays, setClubDays ] = useState(0); + const [ pastClubDays, setPastClubDays ] = useState(0); + const [ clubPeriods, setPastClubPeriods ] = useState(0); + const [ minsTillExpire, setMinsTillExpire ] = useState(0); + const [ clubStatus, setClubStatus ] = useState(ClubStatus.NONE); + const [ unclaimedGifts, setUnclaimedGifts ] = useState(0); + const [ badgeCode, setBadgeCode ] = useState(BadgeResolver.default_badge); - const [badgeCode, setBadgeCode] = useState(BadgeResolver.default_badge); + const getClubText = () => + { + const totalDays = ((clubPeriods * 31) + clubDays); + const minutesUntilExpiration = minsTillExpire; + + if(clubStatus !== ClubStatus.ACTIVE) + { + return LocalizeText('purse.clubdays.zero.amount.text'); + } + + if((minutesUntilExpiration > -1) && (minutesUntilExpiration < (60 * 24))) + { + return FriendlyTime.shortFormat(minutesUntilExpiration * 60); + } + + return FriendlyTime.shortFormat(totalDays * 86400); + } + + const getInfoText = () => + { + switch(clubStatus) + { + case ClubStatus.ACTIVE: + return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'timeleft', 'joindate', 'streakduration' ], [ getClubText(), kickbackData.firstSubscriptionDate, FriendlyTime.shortFormat(kickbackData.currentHcStreak * 86400) ]); + case ClubStatus.EXPIRED: + return LocalizeText(`hccenter.status.${ clubStatus }.info`, [ 'joindate' ], [ kickbackData.firstSubscriptionDate ]); + default: + return LocalizeText(`hccenter.status.${ clubStatus }.info`); + } + } + + const getHcPaydayTime = () => + { + if(kickbackData.timeUntilPayday < 60) return LocalizeText('hccenter.special.time.soon'); + return FriendlyTime.shortFormat(kickbackData.timeUntilPayday * 60); + } + + const getHcPaydayAmount = () => + { + return LocalizeText('hccenter.special.sum', [ 'credits' ], [ (kickbackData.creditRewardForStreakBonus + kickbackData.creditRewardForMonthlySpent).toString() ]); + } + + const onUserInfoEvent = useCallback((event: UserInfoEvent) => + { + const parser = event.getParser(); + + setUserFigure(parser.userInfo.figure); + }, []); + + UseMessageEventHook(UserInfoEvent, onUserInfoEvent); + + const onUserFigureEvent = useCallback((event: FigureUpdateEvent) => + { + const parser = event.getParser(); + + setUserFigure(parser.figure); + }, []); + + UseMessageEventHook(FigureUpdateEvent, onUserFigureEvent); + + const onHcCenterEvent = useCallback((event: HcCenterEvent) => + { + switch(event.type) + { + case HcCenterEvent.TOGGLE_HC_CENTER: + setIsVisible(!isVisible); + break; + } + }, [isVisible]); + + UseUiEvent(HcCenterEvent.TOGGLE_HC_CENTER, onHcCenterEvent); + + const onClubGiftInfoEvent = useCallback((event: ClubGiftInfoEvent) => + { + const parser = event.getParser(); + + setUnclaimedGifts(parser.giftsAvailable); + }, []); + + UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent); + + const onScrSendKickbackInfo = useCallback((event: ScrSendKickbackInfoMessageEvent) => + { + const parser = event.getParser(); + + setKickbackData(parser.data); + }, []); + + UseMessageEventHook(ScrSendKickbackInfoMessageEvent, onScrSendKickbackInfo); + + const onBadges = useCallback((event: BadgesEvent) => + { + const parser = event.getParser(); + + setBadgeCode(BadgeResolver.getClubBadge(parser.getAllBadgeCodes())); + }, []); + + UseMessageEventHook(BadgesEvent, onBadges); + + const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) => + { + const parser = event.getParser(); + + const productName = parser.productName; + + if((productName !== 'club_habbo') && (productName !== 'habbo_club')) return; + + setClubDays(Math.max(0, parser.daysToPeriodEnd)); + setPastClubPeriods(Math.max(0, parser.periodsSubscribedAhead)); + setPastClubDays(Math.max(0, parser.pastClubDays)); + setMinsTillExpire(Math.max(0, parser.minutesUntilExpiration)); + }, []); + + UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent); const linkReceived = useCallback((url: string) => { @@ -57,57 +171,22 @@ export const HcCenterView: FC<{}> = props => return () => RemoveLinkEventTracker(linkTracker); }, [ linkReceived]); - const onUserInfoEvent = useCallback((event: UserInfoEvent) => + useEffect(() => { - const parser = event.getParser(); - setUserFigure(parser.userInfo.figure); - }, []); - - const onUserFigureEvent = useCallback((event: FigureUpdateEvent) => - { - const parser = event.getParser(); - setUserFigure(parser.figure); - }, []); - - UseMessageEventHook(UserInfoEvent, onUserInfoEvent); - UseMessageEventHook(FigureUpdateEvent, onUserFigureEvent); - - const onHcCenterEvent = useCallback((event: HcCenterEvent) => - { - switch(event.type) + if(clubDays > 0) { - case HcCenterEvent.TOGGLE_HC_CENTER: - setIsVisible(!isVisible); - break; + setClubStatus(ClubStatus.ACTIVE); + + return; } - }, [isVisible]); - UseUiEvent(HcCenterEvent.TOGGLE_HC_CENTER, onHcCenterEvent); + if(pastClubDays > 0) + { + setClubStatus(ClubStatus.EXPIRED); - const onClubGiftInfoEvent = useCallback((event: ClubGiftInfoEvent) => - { - const parser = event.getParser(); - - setUnclaimedGifts(parser.giftsAvailable); - }, []); - - const onScrSendKickbackInfo = useCallback((event: ScrSendKickbackInfoMessageEvent) => - { - const parser = event.getParser(); - - setKickbackData(parser.data) - }, []); - - const onBadges = useCallback((event: BadgesEvent) => - { - const parser = event.getParser(); - - setBadgeCode(BadgeResolver.getClubBadge(parser.getAllBadgeCodes())); - }, []) - - UseMessageEventHook(ClubGiftInfoEvent, onClubGiftInfoEvent); - UseMessageEventHook(ScrSendKickbackInfoMessageEvent, onScrSendKickbackInfo); - UseMessageEventHook(BadgesEvent, onBadges); + return; + } + }, [ clubDays, pastClubDays ]); useEffect(() => { @@ -116,74 +195,6 @@ export const HcCenterView: FC<{}> = props => SendMessageComposer(new RequestBadgesComposer()); }, []); - const onUserSubscriptionEvent = useCallback((event: UserSubscriptionEvent) => - { - const parser = event.getParser(); - - const productName = parser.productName; - - if((productName !== 'club_habbo') && (productName !== 'habbo_club')) return; - - setClubDays(Math.max(0, parser.daysToPeriodEnd)); - setPastClubPeriods(Math.max(0, parser.periodsSubscribedAhead)); - setPastClubDays(Math.max(0, parser.pastClubDays)); - setMinsTillExpire(Math.max(0, parser.minutesUntilExpiration)); - }, []); - - useEffect(() => - { - if(clubDays > 0) return setClubStatus(ClubStatus.ACTIVE) - if(pastClubDays > 0) return setClubStatus(ClubStatus.EXPIRED); - - }, [clubDays, pastClubDays]); - - UseMessageEventHook(UserSubscriptionEvent, onUserSubscriptionEvent); - - const getClubText = useCallback(() => - { - const totalDays = ((clubPeriods * 31) + clubDays); - const minutesUntilExpiration = minsTillExpire; - - if(clubStatus !== ClubStatus.ACTIVE) - { - return LocalizeText('purse.clubdays.zero.amount.text'); - } - else if((minutesUntilExpiration > -1) && (minutesUntilExpiration < (60 * 24))) - { - return FriendlyTime.shortFormat(minutesUntilExpiration * 60); - } - else - { - return FriendlyTime.shortFormat(totalDays * 86400); - } - }, [clubStatus, clubDays, clubPeriods, minsTillExpire]); - - const getInfoText = useCallback(() => - { - switch(clubStatus) - { - case ClubStatus.ACTIVE: - return LocalizeText('hccenter.status.' + clubStatus + '.info', - ['timeleft', 'joindate', 'streakduration'], - [getClubText(), kickbackData.firstSubscriptionDate, FriendlyTime.shortFormat(kickbackData.currentHcStreak * 86400)]); - case ClubStatus.EXPIRED: - return LocalizeText('hccenter.status.' + clubStatus + '.info', ['joindate'], [kickbackData.firstSubscriptionDate]) - default: - return LocalizeText('hccenter.status.' + clubStatus + '.info'); - } - }, [clubStatus, kickbackData, getClubText]); - - const getHcPaydayTime = useCallback(() => - { - if(kickbackData.timeUntilPayday < 60) return LocalizeText('hccenter.special.time.soon'); - return FriendlyTime.shortFormat(kickbackData.timeUntilPayday * 60); - }, [kickbackData]); - - const getHcPaydayAmount = useCallback(() => - { - return LocalizeText('hccenter.special.sum', ['credits'], [(kickbackData.creditRewardForStreakBonus + kickbackData.creditRewardForMonthlySpent).toString()]) - }, [kickbackData]) - if(!isVisible) return null; const popover = ( @@ -205,31 +216,35 @@ export const HcCenterView: FC<{}> = props => return ( - setIsVisible(false)} /> -
-
- -
- -
-
+ setIsVisible(false) } /> + + +
+ + + + + + + + -
+ -
-
{LocalizeText('hccenter.status.' + clubStatus)}
-
-
-
- {GetConfiguration('hc.center')['payday.info'] && -
-
+ + { LocalizeText('hccenter.status.' + clubStatus) } + + + + { GetConfiguration('hc.center')['payday.info'] && + +

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

{LocalizeText('hccenter.special.info')}
{ CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }}>{LocalizeText('hccenter.special.infolink')}
-
+
{LocalizeText('hccenter.special.time.title')}
@@ -250,7 +265,7 @@ export const HcCenterView: FC<{}> = props =>
}
-
+
} {GetConfiguration('hc.center')['gift.info'] &&
diff --git a/src/views/nitropedia/NitropediaView.tsx b/src/views/nitropedia/NitropediaView.tsx index 438ec353..3b0001ac 100644 --- a/src/views/nitropedia/NitropediaView.tsx +++ b/src/views/nitropedia/NitropediaView.tsx @@ -1,8 +1,7 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useRef, useState } from 'react'; -import { AddEventLinkTracker, GetConfiguration, RemoveLinkEventTracker } from '../../api'; +import { AddEventLinkTracker, GetConfiguration, NotificationUtilities, RemoveLinkEventTracker } from '../../api'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; -import { NotificationUtilities } from '../notification-center/common/NotificationUtilities'; const newLineRegex = /\n\r|\n|\r/mg; export const NitropediaView: FC<{}> = props => @@ -39,7 +38,9 @@ export const NitropediaView: FC<{}> = props => if(event.target instanceof HTMLAnchorElement) { event.preventDefault(); + const link = event.target.href; + NotificationUtilities.openUrl(link); } diff --git a/src/views/notification-center/NotificationCenterMessageHandler.types.ts b/src/views/notification-center/NotificationCenterMessageHandler.types.ts deleted file mode 100644 index cc46035b..00000000 --- a/src/views/notification-center/NotificationCenterMessageHandler.types.ts +++ /dev/null @@ -1,2 +0,0 @@ -export interface INotificationCenterMessageHandlerProps -{} diff --git a/src/views/notification-center/NotificationCenterView.types.ts b/src/views/notification-center/NotificationCenterView.types.ts deleted file mode 100644 index f5eabb63..00000000 --- a/src/views/notification-center/NotificationCenterView.types.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface NotificationCenterViewProps -{ - -} - -export class NotificationViewProps -{ - inTray?: boolean = false; - onButtonClick: (action: string) => void; -}