diff --git a/.env b/.env deleted file mode 100644 index 1f084131..00000000 --- a/.env +++ /dev/null @@ -1,7 +0,0 @@ -BROWSER=none -GENERATE_SOURCEMAP=false -REACT_APP_CONFIG_URLS=/renderer-config.json,/ui-config.json -REACT_APP_SOCKET_URL=wss://ws.nitrots.co:2096 -REACT_APP_ASSET_URL=https://assets.nitrodev.co -REACT_APP_IMAGE_LIBRARY_URL=https://swf.nitrots.co/c_images/ -REACT_APP_HOF_FURNI_URL=https://swf.nitrots.co/dcr/hof_furni diff --git a/.gitignore b/.gitignore index c346b941..aa65aeba 100644 --- a/.gitignore +++ b/.gitignore @@ -26,5 +26,6 @@ Thumbs.db # Nitro /build *.zip -/public/renderer-config.json -/public/ui-config.json +.env +public/renderer-config.json +public/ui-config.json diff --git a/package.json b/package.json index 4c6e6f14..820aa9c3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "craco start", "build": "craco --max_old_space_size=8048 build", - "build:prod": "npx browserslist@latest --update-db && yarn remove @nitrots/nitro-renderer && yarn add git+https://git@git.krews.org/nitro/nitro-renderer#dev && yarn install && yarn build", + "build:prod": "npx browserslist@latest --update-db && yarn install && yarn build", "test": "craco test", "eject": "react-scripts eject" }, diff --git a/public/ui-config.json.example b/public/ui-config.json.example index 230f865f..70135a75 100644 --- a/public/ui-config.json.example +++ b/public/ui-config.json.example @@ -1,11 +1,11 @@ { "image.library.notifications.url": "${image.library.url}notifications/%image%.png", "achievements.images.url": "${image.library.url}Quests/%image%.png", - "camera.url": "CAMERA_PHOTOS_URL", - "thumbnails.url": "CAMERA_ROOM_THUMBNAILS/%thumbnail%.png", - "url.prefix": "URL", + "camera.url": "https://camera.com", + "thumbnails.url": "https://camera.com/thumbnail/%thumbnail%.png", + "url.prefix": "https://website.com", "floorplan.tile.url": "${asset.url}/floorplan-editor/tiles.json", - "habbopages.url": "URL/", + "habbopages.url": "https://website.com/habbopages/", "chat.viewer.height.percentage": 0.40, "widget.dimmer.colorwheel": false, "hotelview": { @@ -44,8 +44,7 @@ "system.currency.types": [ -1, 0, - 5, - 101 + 5 ], "hc.center": { "benefits.info": true, diff --git a/src/App.tsx b/src/App.tsx index 59094326..7ebb30d8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -126,12 +126,11 @@ export const App: FC<{}> = props => return (
-
-
{ (!isReady || isError) && } +
); } diff --git a/src/assets/styles/bootstrap/forms/_form-check.scss b/src/assets/styles/bootstrap/forms/_form-check.scss index 6321b410..402c5954 100644 --- a/src/assets/styles/bootstrap/forms/_form-check.scss +++ b/src/assets/styles/bootstrap/forms/_form-check.scss @@ -17,7 +17,7 @@ .form-check-input { width: $form-check-input-width; height: $form-check-input-width; - margin-top: ($line-height-base - $form-check-input-width) * .5; // line-height minus check height + //margin-top: ($line-height-base - $form-check-input-width) * .5; // line-height minus check height vertical-align: top; background-color: $form-check-input-bg; background-repeat: no-repeat; diff --git a/src/components/catalog/CatalogMessageHandler.tsx b/src/components/catalog/CatalogMessageHandler.tsx index 960af30d..5a0b024c 100644 --- a/src/components/catalog/CatalogMessageHandler.tsx +++ b/src/components/catalog/CatalogMessageHandler.tsx @@ -1,4 +1,4 @@ -import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceConfigurationEvent, MarketplaceMakeOfferResult, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, SellablePetPalettesMessageEvent, UserSubscriptionEvent } from '@nitrots/nitro-renderer'; +import { ApproveNameMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, MarketplaceConfigurationEvent, MarketplaceMakeOfferResult, 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 { LocalizeText } from '../../api'; @@ -203,6 +203,20 @@ export const CatalogMessageHandler: FC<{}> = props => }); }, [dispatchCatalogState]); + const onClubGiftInfoEvent = useCallback((event: ClubGiftInfoEvent) => + { + const parser = event.getParser(); + + if(!parser) return; + + dispatchCatalogState({ + type: CatalogActions.SET_CLUB_GIFTS, + payload: { + clubGifts: parser + } + }); + }, [dispatchCatalogState]); + CreateMessageHook(CatalogPagesListEvent, onCatalogPagesListEvent); CreateMessageHook(CatalogPageMessageEvent, onCatalogPageMessageEvent); CreateMessageHook(PurchaseOKMessageEvent, onPurchaseOKMessageEvent); @@ -218,6 +232,7 @@ export const CatalogMessageHandler: FC<{}> = props => CreateMessageHook(UserSubscriptionEvent, onUserSubscriptionEvent); CreateMessageHook(CatalogPublishedMessageEvent, onCatalogPublishedMessageEvent); CreateMessageHook(GiftWrappingConfigurationEvent, onGiftWrappingConfigurationEvent); + CreateMessageHook(ClubGiftInfoEvent, onClubGiftInfoEvent); CreateMessageHook(MarketplaceMakeOfferResult, onMarketplaceMakeOfferResult); CreateMessageHook(MarketplaceConfigurationEvent, onMarketplaceConfigurationEvent); diff --git a/src/components/catalog/CatalogView.tsx b/src/components/catalog/CatalogView.tsx index abde5ff8..6cb4ceeb 100644 --- a/src/components/catalog/CatalogView.tsx +++ b/src/components/catalog/CatalogView.tsx @@ -1,4 +1,4 @@ -import { GetCatalogIndexComposer, GetCatalogPageComposer, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer'; +import { GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetMarketplaceConfigurationMessageComposer, ILinkEventTracker, INodeData, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useReducer, useState } from 'react'; import { AddEventLinkTracker, GetRoomEngine, LocalizeText, RemoveLinkEventTracker } from '../../api'; import { CREDITS, PlaySound } from '../../api/utils/PlaySound'; @@ -195,6 +195,7 @@ export const CatalogView: FC<{}> = props => { SendMessageHook(new GetMarketplaceConfigurationMessageComposer()); SendMessageHook(new GetGiftWrappingConfigurationComposer()); + SendMessageHook(new GetClubGiftInfo()); }); const currentNavigationPage = ((searchResult && searchResult.page) || currentTab); diff --git a/src/components/catalog/common/views/page/layout/color-grouping/CatalogLayoutColorGroupingView.tsx b/src/components/catalog/common/views/page/layout/color-grouping/CatalogLayoutColorGroupingView.tsx new file mode 100644 index 00000000..45307324 --- /dev/null +++ b/src/components/catalog/common/views/page/layout/color-grouping/CatalogLayoutColorGroupingView.tsx @@ -0,0 +1,91 @@ +import { CatalogPageMessageOfferData, IFurnitureData } from '@nitrots/nitro-renderer'; +import { FC, useMemo, useState } from 'react'; +import { GetSessionDataManager } from '../../../../../../api'; +import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { ProductTypeEnum } from '../../../../common/ProductTypeEnum'; +import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; + +export interface CatalogLayoutColorGroupViewProps extends CatalogLayoutProps +{ + +} + +export const CatalogLayoutColorGroupingView : FC = props => +{ + const { roomPreviewer = null, pageParser = null } = props; + const [ colorableItems, setColorableItems ] = useState>(new Map()); + + const offers = useMemo(() => + { + const offers: CatalogPageMessageOfferData[] = []; + const addedColorableItems = new Map(); + + pageParser.offers.forEach(offer => + { + const product = offer.products[0]; + if(!product) return; + + let furniData: IFurnitureData = null; + + if(product.productType === ProductTypeEnum.FLOOR) + { + furniData = GetSessionDataManager().getFloorItemData(product.furniClassId); + } + else if(product.productType === ProductTypeEnum.WALL) + { + furniData = GetSessionDataManager().getWallItemData(product.furniClassId); + } + + if(((!(furniData)) || ((furniData.fullName.indexOf('*') === -1)))) + { + offers.push(offer); + } + else + { + const name = furniData.fullName.split('*')[0]; + const colorIndex = parseInt(furniData.fullName.split('*')[1]); + + if(!colorableItems[name]) + { + colorableItems[name] = []; + } + + let selectedColor = 0; + if(furniData.colors) + { + for(let color of furniData.colors) + { + if(color !== 0xFFFFFF) + { + selectedColor = color; + } + } + if(colorableItems[name].indexOf(selectedColor) === -1) + { + colorableItems[name][colorIndex] = selectedColor; + } + } + + if(!addedColorableItems.has(name)) + { + offers.push(offer); + addedColorableItems.set(name, true); + } + } + }); + console.log(colorableItems); + return offers; + }, [colorableItems, pageParser.offers]); + + return ( + + + + + + + + + ); +} diff --git a/src/components/catalog/common/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx b/src/components/catalog/common/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx new file mode 100644 index 00000000..be60d347 --- /dev/null +++ b/src/components/catalog/common/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx @@ -0,0 +1,73 @@ +import { SelectClubGiftComposer } from '@nitrots/nitro-renderer'; +import { FC, useCallback } from 'react'; +import { LocalizeText } from '../../../../../../api'; +import { SendMessageHook } from '../../../../../../hooks'; +import { NitroCardGridView } from '../../../../../../layout'; +import { NitroLayoutBase } from '../../../../../../layout/base'; +import { NotificationUtilities } from '../../../../../notification-center/common/NotificationUtilities'; +import { useCatalogContext } from '../../../../context/CatalogContext'; +import { CatalogActions } from '../../../../reducers/CatalogReducer'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; +import { VipGiftItem } from './gift-item/VipGiftItemView'; + +export interface CatalogLayoutVipGiftsViewProps extends CatalogLayoutProps +{ + +} + +export const CatalogLayoutVipGiftsView: FC = props => +{ + const { catalogState, dispatchCatalogState } = useCatalogContext(); + + const giftsAvailable = useCallback(() => + { + const clubGifts = catalogState.clubGifts; + + if(!clubGifts) return ''; + + if(clubGifts.giftsAvailable > 0) + { + return LocalizeText('catalog.club_gift.available', ['amount'], [clubGifts.giftsAvailable.toString()]); + } + + if(clubGifts.daysUntilNextGift > 0) + { + return LocalizeText('catalog.club_gift.days_until_next', ['days'], [clubGifts.daysUntilNextGift.toString()]); + } + + if(catalogState.subscriptionInfo.isVip) + { + return LocalizeText('catalog.club_gift.not_available'); + } + + return LocalizeText('catalog.club_gift.no_club'); + + }, [catalogState.clubGifts, catalogState.subscriptionInfo.isVip]); + + const selectGift = useCallback((localizationId: string) => + { + NotificationUtilities.confirm(LocalizeText('catalog.club_gift.confirm'), () => + { + SendMessageHook(new SelectClubGiftComposer(localizationId)); + const prev = catalogState.clubGifts; + + prev.giftsAvailable--; + + dispatchCatalogState({ + type: CatalogActions.SET_CLUB_GIFTS, + payload: { + clubGifts: prev + } + }); + }, null); + }, [catalogState.clubGifts, dispatchCatalogState]); + + return ( + <> + {giftsAvailable()} + + { catalogState.clubGifts && catalogState.clubGifts.offers.map( (offer, index) => 0} onSelect={selectGift}/>)} + + + ) +} diff --git a/src/components/catalog/common/views/page/layout/vip-gifts/gift-item/VipGiftItemView.tsx b/src/components/catalog/common/views/page/layout/vip-gifts/gift-item/VipGiftItemView.tsx new file mode 100644 index 00000000..2bb32ba0 --- /dev/null +++ b/src/components/catalog/common/views/page/layout/vip-gifts/gift-item/VipGiftItemView.tsx @@ -0,0 +1,61 @@ +import { CatalogPageMessageOfferData } from '@nitrots/nitro-renderer'; +import { FC, useCallback } from 'react'; +import { LocalizeText } from '../../../../../../../api'; +import { NitroCardGridItemView } from '../../../../../../../layout'; +import { ProductImageUtility } from '../../../../../../notification-center/common/ProductImageUtility'; + +export interface VipGiftItemViewProps +{ + offer: CatalogPageMessageOfferData; + isAvailable: boolean; + onSelect(localizationId: string): void; +} + +export const VipGiftItem : FC = props => +{ + const { offer = null, isAvailable = false, onSelect = null } = props; + + const getImageUrlForOffer = useCallback( () => + { + if(!offer || !offer.products.length) return ''; + + const productData = offer.products[0]; + + return ProductImageUtility.getProductImageUrl(productData.productType, productData.furniClassId, productData.extraParam); + }, [offer]); + + const getItemTitle = useCallback(() => + { + if(!offer || !offer.products.length) return ''; + + const productData = offer.products[0]; + + const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.name.' + productData.furniClassId : 'roomItem.name.' + productData.furniClassId; + + return LocalizeText(localizationKey); + }, [offer]); + + const getItemDesc = useCallback( () => + { + if(!offer || !offer.products.length) return ''; + + const productData = offer.products[0]; + + const localizationKey = ProductImageUtility.getProductCategory(productData.productType, productData.furniClassId) === 2 ? 'wallItem.desc.' + productData.furniClassId : 'roomItem.desc.' + productData.furniClassId ; + + return LocalizeText(localizationKey); + }, [offer]); + + return ( + + +
+
{getItemTitle()}
+
{getItemDesc()}
+
+
+ +
+
+ ) +} diff --git a/src/components/catalog/reducers/CatalogReducer.tsx b/src/components/catalog/reducers/CatalogReducer.tsx index 87eba150..9747147d 100644 --- a/src/components/catalog/reducers/CatalogReducer.tsx +++ b/src/components/catalog/reducers/CatalogReducer.tsx @@ -1,4 +1,4 @@ -import { CatalogPageMessageOfferData, CatalogPageMessageParser, ClubOfferData, GiftWrappingConfigurationParser, INodeData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageOfferData, CatalogPageMessageParser, ClubGiftInfoParser, ClubOfferData, GiftWrappingConfigurationParser, INodeData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer'; import { HabboGroupEntryData } from '@nitrots/nitro-renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData'; import { Reducer } from 'react'; import { CatalogPetPalette } from '../common/CatalogPetPalette'; @@ -17,6 +17,7 @@ export interface ICatalogState groups: HabboGroupEntryData[]; petPalettes: CatalogPetPalette[]; clubOffers: ClubOfferData[]; + clubGifts: ClubGiftInfoParser; subscriptionInfo: SubscriptionInfo; giftConfiguration: GiftWrappingConfiguration; marketplaceConfiguration: MarketplaceConfigurationMessageParser; @@ -35,6 +36,7 @@ export interface ICatalogAction groups?: HabboGroupEntryData[]; petPalette?: CatalogPetPalette; clubOffers?: ClubOfferData[]; + clubGifts?: ClubGiftInfoParser; subscriptionInfo?: SubscriptionInfo; giftConfiguration?: GiftWrappingConfigurationParser; marketplaceConfiguration?: MarketplaceConfigurationMessageParser; @@ -54,6 +56,7 @@ export class CatalogActions public static SET_SEARCH_RESULT: string = 'CA_SET_SEARCH_RESULT'; public static SET_SUBSCRIPTION_INFO: string = 'CA_SET_SUBSCRIPTION_INFO'; public static SET_GIFT_CONFIGURATION: string = 'CA_SET_GIFT_CONFIGURATION'; + public static SET_CLUB_GIFTS: string = 'CA_SET_CLUB_GIFTS'; public static SET_MARKETPLACE_CONFIGURATION: string = 'CA_SET_MARKETPLACE_CONFIGURATION'; } @@ -67,6 +70,7 @@ export const initialCatalog: ICatalogState = { groups: [], petPalettes: [], clubOffers: null, + clubGifts: null, subscriptionInfo: new SubscriptionInfo(), giftConfiguration: null, marketplaceConfiguration: null @@ -164,8 +168,13 @@ export const CatalogReducer: Reducer = (state, ac return { ...state, giftConfiguration }; } + case CatalogActions.SET_CLUB_GIFTS: { + const clubGifts = (action.payload.clubGifts || state.clubGifts || null); + + return { ...state, clubGifts }; + } case CatalogActions.SET_MARKETPLACE_CONFIGURATION: { - let marketplaceConfiguration = (action.payload.marketplaceConfiguration || state.marketplaceConfiguration || null); + const marketplaceConfiguration = (action.payload.marketplaceConfiguration || state.marketplaceConfiguration || null); return { ...state, marketplaceConfiguration } } diff --git a/src/components/catalog/views/page/layout/GetCatalogLayout.tsx b/src/components/catalog/views/page/layout/GetCatalogLayout.tsx index c5e7b58c..88b31948 100644 --- a/src/components/catalog/views/page/layout/GetCatalogLayout.tsx +++ b/src/components/catalog/views/page/layout/GetCatalogLayout.tsx @@ -15,6 +15,7 @@ import { CatalogLayoutSingleBundleView } from './single-bundle/CatalogLayoutSing import { CatalogLayoutSpacesView } from './spaces-new/CatalogLayoutSpacesView'; import { CatalogLayoutTrophiesView } from './trophies/CatalogLayoutTrophiesView'; import { CatalogLayoutVipBuyView } from './vip-buy/CatalogLayoutVipBuyView'; +import { CatalogLayoutVipGiftsView } from './vip-gifts/CatalogLayoutVipGiftsView'; export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPreviewer: RoomPreviewer) => { @@ -41,7 +42,7 @@ export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPrevi case 'search_results': return null; case 'club_gifts': - return null; + return ; case 'marketplace_own_items': return ; case 'marketplace': @@ -56,6 +57,8 @@ export const GetCatalogLayout = (pageParser: CatalogPageMessageParser, roomPrevi return ; case 'badge_display': return ; + //case 'default_3x3_color_grouping': + //return ; case 'bots': case 'default_3x3': default: diff --git a/src/layout/card/NitroCardView.scss b/src/layout/card/NitroCardView.scss index 2e3d1924..ecc8562f 100644 --- a/src/layout/card/NitroCardView.scss +++ b/src/layout/card/NitroCardView.scss @@ -5,6 +5,10 @@ $nitro-card-tabs-height: 33px; pointer-events: all; resize: both; + @include media-breakpoint-down(sm) { + max-width: 100vw !important; + } + &.theme-primary { border: $border-width solid $border-color; @@ -28,56 +32,6 @@ $nitro-card-tabs-height: 33px; } } -.nitro-card-responsive { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - pointer-events: none; - overflow: hidden; - - @include media-breakpoint-down(lg) { - .draggable-window { - top: 0 !important; - left: 0 !important; - width: 100%; - height: 100%; - //transform: none !important; - overflow: hidden; - } - - .nitro-card { - max-width: 75%; - max-height: calc(100% - 20px); - margin: 10px auto 10px; - } - } - - @include media-breakpoint-down(sm) { - .draggable-window { - top: 0 !important; - left: 0 !important; - width: 100%; - height: 100%; - //transform: none !important; - overflow: hidden; - } - - .nitro-card { - width: 100%; - height: 100%; - max-width: 100%; - max-height: calc(100% - #{$toolbar-height}); - margin: 0; - - &.rounded { - border-radius: 0 !important; - } - } - } -} - @import "./accordion/NitroCardAccordionView"; @import "./content/NitroCardContentView"; @import "./grid/NitroCardGridView"; diff --git a/src/layout/card/NitroCardView.tsx b/src/layout/card/NitroCardView.tsx index f44ee67f..ee5112ed 100644 --- a/src/layout/card/NitroCardView.tsx +++ b/src/layout/card/NitroCardView.tsx @@ -9,13 +9,11 @@ export const NitroCardView: FC = props => return ( -
- -
- { children } -
-
-
+ +
+ { children } +
+
); } diff --git a/src/layout/draggable-window/DraggableWindow.scss b/src/layout/draggable-window/DraggableWindow.scss index 0679e33d..47e08233 100644 --- a/src/layout/draggable-window/DraggableWindow.scss +++ b/src/layout/draggable-window/DraggableWindow.scss @@ -1,7 +1,25 @@ -.draggable-window { - visibility: hidden; +#draggable-windows-container { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; + overflow: hidden; - .drag-handler { - cursor: move; + @include media-breakpoint-down(lg) { + display: flex; + justify-content: center; + transform: none !important; + + .draggable-window { + top: 10px !important; + left: 0 !important; + } + } + + .draggable-window { + display: inline-block; + visibility: hidden; } } diff --git a/src/layout/draggable-window/DraggableWindow.tsx b/src/layout/draggable-window/DraggableWindow.tsx index d9d1fb03..10e2a4e6 100644 --- a/src/layout/draggable-window/DraggableWindow.tsx +++ b/src/layout/draggable-window/DraggableWindow.tsx @@ -1,15 +1,25 @@ import { MouseEventType, TouchEventType } from '@nitrots/nitro-renderer'; -import { FC, Key, MouseEvent as ReactMouseEvent, TouchEvent as ReactTouchEvent, useCallback, useEffect, useRef, useState } from 'react'; -import { DraggableWindowPosition, DraggableWindowProps } from './DraggableWindow.types'; +import { DetailedHTMLProps, FC, HTMLAttributes, Key, MouseEvent as ReactMouseEvent, TouchEvent as ReactTouchEvent, useCallback, useEffect, useRef, useState } from 'react'; +import { createPortal } from 'react-dom'; +import { BatchUpdates } from '../../hooks'; +import { DraggableWindowPosition } from './DraggableWindow.types'; const CURRENT_WINDOWS: HTMLElement[] = []; const POS_MEMORY: Map = new Map(); const BOUNDS_THRESHOLD_TOP: number = 0; const BOUNDS_THRESHOLD_LEFT: number = 0; +export interface DraggableWindowProps extends DetailedHTMLProps, HTMLDivElement> +{ + uniqueKey?: Key; + handleSelector?: string; + position?: string; + disableDrag?: boolean; +} + export const DraggableWindow: FC = props => { - const { uniqueKey = null, handleSelector = '.drag-handler', position = DraggableWindowPosition.CENTER, disableDrag = false, children = null } = props; + const { uniqueKey = null, handleSelector = '.drag-handler', position = DraggableWindowPosition.CENTER, disableDrag = false, children = null, ...rest } = props; const [ delta, setDelta ] = useState<{ x: number, y: number }>(null); const [ offset, setOffset ] = useState<{ x: number, y: number }>(null); const [ start, setStart ] = useState<{ x: number, y: number }>({ x: 0, y: 0 }); @@ -120,9 +130,12 @@ export const DraggableWindow: FC = props => offsetX = (document.body.offsetWidth - elementRef.current.offsetWidth) - elementRef.current.offsetLeft; } - setDelta({ x: 0, y: 0 }); - setOffset({ x: offsetX, y: offsetY }); - setIsDragging(false); + BatchUpdates(() => + { + setDelta({ x: 0, y: 0 }); + setOffset({ x: offsetX, y: offsetY }); + setIsDragging(false); + }); if(uniqueKey !== null) POS_MEMORY.set(uniqueKey, { x: offsetX, y: offsetY }); }, [ dragHandler, delta, offset, uniqueKey ]); @@ -180,8 +193,11 @@ export const DraggableWindow: FC = props => } } - setDelta({ x: 0, y: 0 }); - setOffset({ x: offsetX, y: offsetY }); + BatchUpdates(() => + { + setDelta({ x: 0, y: 0 }); + setOffset({ x: offsetX, y: offsetY }); + }); return () => { @@ -236,8 +252,9 @@ export const DraggableWindow: FC = props => }, [ isDragging, onDragMouseUp, onDragMouseMove, onDragTouchUp, onDragTouchMove ]); return ( -
+ createPortal( +
{ children } -
+
, document.getElementById('draggable-windows-container')) ); } diff --git a/src/layout/draggable-window/DraggableWindow.types.tsx b/src/layout/draggable-window/DraggableWindow.types.tsx index 278e866a..a8cbea31 100644 --- a/src/layout/draggable-window/DraggableWindow.types.tsx +++ b/src/layout/draggable-window/DraggableWindow.types.tsx @@ -1,13 +1,3 @@ -import { Key } from 'react'; - -export interface DraggableWindowProps -{ - uniqueKey?: Key; - handleSelector?: string; - position?: string; - disableDrag?: boolean; -} - export class DraggableWindowPosition { public static CENTER: string = 'DWP_CENTER'; diff --git a/src/views/help/HelpMessageHandler.tsx b/src/views/help/HelpMessageHandler.tsx index 047dd512..1febee73 100644 --- a/src/views/help/HelpMessageHandler.tsx +++ b/src/views/help/HelpMessageHandler.tsx @@ -39,7 +39,7 @@ export const HelpMessageHandler: FC<{}> = props => { const parser = event.getParser(); - const message = LocalizeText('help.cfh.closed.' + GetCloseReasonKey(parser.closeReason)) + const message = parser.messageText.length === 0 ? LocalizeText('help.cfh.closed.' + GetCloseReasonKey(parser.closeReason)) : parser.messageText; NotificationUtilities.simpleAlert(message, NotificationAlertType.MODERATION, null, null, LocalizeText('mod.alert.title')); }, []); diff --git a/src/views/help/views/HelpIndexView.tsx b/src/views/help/views/HelpIndexView.tsx index 3f067047..27ce5a04 100644 --- a/src/views/help/views/HelpIndexView.tsx +++ b/src/views/help/views/HelpIndexView.tsx @@ -35,7 +35,7 @@ export const HelpIndexView: FC<{}> = props =>
- +
diff --git a/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx b/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx index d169c1fb..3f40c1c6 100644 --- a/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx +++ b/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx @@ -88,7 +88,6 @@ export const ModToolsRoomView: FC = props =>
Owner in room: { ownerInRoom ? 'Yes' : 'No' }
-
diff --git a/src/views/mod-tools/views/tickets/issue-info/IssueInfoView.tsx b/src/views/mod-tools/views/tickets/issue-info/IssueInfoView.tsx index 61a9784a..8030cc7f 100644 --- a/src/views/mod-tools/views/tickets/issue-info/IssueInfoView.tsx +++ b/src/views/mod-tools/views/tickets/issue-info/IssueInfoView.tsx @@ -49,8 +49,8 @@ export const IssueInfoView: FC = props =>
Source: {getSourceName(ticket.categoryId)}
Category: {LocalizeText('help.cfh.topic.' + ticket.reportedCategoryId)}
Description: {ticket.message}
-
Caller:
-
Reported User:
+
Caller:
+
Reported User:
diff --git a/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx b/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx index 4ec3667b..ac414847 100644 --- a/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx +++ b/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx @@ -33,10 +33,10 @@ export const ModToolsUserRoomVisitsView: FC = p const item = roomVisitData.rooms[props.index]; return ( -
+
{item.enterHour.toString().padStart(2, '0')}:{item.enterMinute.toString().padStart(2, '0')}
Room: {item.roomName}
- +
); } diff --git a/src/views/notification-center/NotificationCenterMessageHandler.tsx b/src/views/notification-center/NotificationCenterMessageHandler.tsx index 76c68e65..2579d57e 100644 --- a/src/views/notification-center/NotificationCenterMessageHandler.tsx +++ b/src/views/notification-center/NotificationCenterMessageHandler.tsx @@ -80,7 +80,7 @@ export const NotificationCenterMessageHandler: FC = props =>
{ getBubbleAlerts }
- { createPortal(getAlerts, document.getElementById('nitro-alerts-container')) } - { createPortal(getConfirms, document.getElementById('nitro-confirms-container')) } + { getConfirms } + { getAlerts } ); } diff --git a/src/views/notification-center/common/ProductImageUtility.ts b/src/views/notification-center/common/ProductImageUtility.ts index dc67348b..378194e8 100644 --- a/src/views/notification-center/common/ProductImageUtility.ts +++ b/src/views/notification-center/common/ProductImageUtility.ts @@ -41,7 +41,7 @@ export class ProductImageUtility return imageUrl; } - private static getProductCategory(productType: string, furniClassId: number): number + public static getProductCategory(productType: string, furniClassId: number): number { if(productType === CatalogPageMessageProductData.S) return 1; diff --git a/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx b/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx index f39f7f26..983e34a2 100644 --- a/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx +++ b/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx @@ -1,19 +1,22 @@ -import { FC } from 'react'; +import { FC, useMemo } from 'react'; +import { GetRoomObjectBounds, GetRoomSession } from '../../../../../../api'; import { DraggableWindow, DraggableWindowPosition } from '../../../../../../layout'; -import { ObjectLocationView } from '../../../object-location/ObjectLocationView'; import { AvatarInfoRentableBotChatViewProps } from './AvatarInfoRentableBotChatView.types'; export const AvatarInfoRentableBotChatView: FC = props => { const { chatEvent = null } = props; + const getObjectLocation = useMemo(() => + { + return GetRoomObjectBounds(GetRoomSession().roomId, chatEvent.objectId, chatEvent.category, 1); + }, [ chatEvent ]); + return ( - - -
-
test!!!!!
-
-
+ +
+
test!!!!!
+
); }