Update to react 18

This commit is contained in:
Bill 2022-04-01 17:08:50 -04:00
parent d7b00756bf
commit 554bea8c66
87 changed files with 848 additions and 1331 deletions

View File

@ -3,8 +3,8 @@
"version": "2.0.0",
"private": true,
"scripts": {
"start": "cross-env BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
"build": "cross-env GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
"build": "cross-env SKIP_PREFLIGHT_CHECK=true GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
"build:prod": "npx browserslist@latest --update-db && yarn build",
"test": "craco test",
"eject": "react-scripts eject",
@ -21,11 +21,11 @@
"cross-env": "^7.0.3",
"emoji-toolkit": "^6.6.0",
"node-sass": "^6.0.1",
"react": "^17.0.2",
"react": "^18.0.0",
"react-bootstrap": "^2.2.2",
"react-dom": "^17.0.2",
"react-dom": "^18.0.0",
"react-scripts": "4.0.3",
"react-slider": "^1.3.1",
"react-slider": "^2.0.0",
"react-transition-group": "^4.4.2",
"react-virtualized": "^9.22.3",
"react-youtube": "^7.13.1",

View File

@ -2,7 +2,6 @@ import { MouseEventType, TouchEventType } from '@nitrots/nitro-renderer';
import { CSSProperties, FC, Key, MouseEvent as ReactMouseEvent, TouchEvent as ReactTouchEvent, useCallback, useEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { Base } from '..';
import { BatchUpdates } from '../../hooks';
import { DraggableWindowPosition } from './DraggableWindowPosition';
const CURRENT_WINDOWS: HTMLElement[] = [];
@ -134,12 +133,9 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
offsetX = (document.body.offsetWidth - elementRef.current.offsetWidth) - elementRef.current.offsetLeft;
}
BatchUpdates(() =>
{
setDelta({ x: 0, y: 0 });
setOffset({ x: offsetX, y: offsetY });
setIsDragging(false);
});
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 ]);
@ -201,11 +197,8 @@ export const DraggableWindow: FC<DraggableWindowProps> = props =>
}
}
BatchUpdates(() =>
{
setDelta({ x: 0, y: 0 });
setOffset({ x: offsetX, y: offsetY });
});
setDelta({ x: 0, y: 0 });
setOffset({ x: offsetX, y: offsetY });
return () =>
{

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { AchievementCategory, AddEventLinkTracker, CloneObject, GetAchievementCategoryImageUrl, GetAchievementIsIgnored, LocalizeText, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { Base, Column, LayoutImage, LayoutProgressBar, NitroCardContentView, NitroCardHeaderView, NitroCardSubHeaderView, NitroCardView, Text } from '../../common';
import { AchievementsUIUnseenCountEvent } from '../../events';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks';
import { DispatchUiEvent, UseMessageEventHook } from '../../hooks';
import { AchievementCategoryView } from './views/AchievementCategoryView';
import { AchievementsCategoryListView } from './views/category-list/AchievementsCategoryListView';
@ -92,11 +92,8 @@ export const AchievementsView: FC<{}> = props =>
existing.achievements.push(achievement);
}
BatchUpdates(() =>
{
setAchievementCategories(categories);
setIsInitalized(true);
});
setAchievementCategories(categories);
setIsInitalized(true);
}, []);
UseMessageEventHook(AchievementsEvent, onAchievementsEvent);

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { GetConfiguration, GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, LayoutCurrencyIcon, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { InventoryEvent } from '../../../../events';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
export interface CameraWidgetCheckoutViewProps
{
@ -27,11 +27,8 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
const onCameraPurchaseOKMessageEvent = useCallback((event: CameraPurchaseOKMessageEvent) =>
{
BatchUpdates(() =>
{
setPicturesBought(value => (value + 1));
setIsWaiting(false);
});
setPicturesBought(value => (value + 1));
setIsWaiting(false);
}, []);
UseMessageEventHook(CameraPurchaseOKMessageEvent, onCameraPurchaseOKMessageEvent);
@ -40,13 +37,10 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
{
const parser = event.getParser();
BatchUpdates(() =>
{
setPublishUrl(parser.extraDataId);
setPublishCooldown(parser.secondsToWait);
setWasPicturePublished(parser.ok);
setIsWaiting(false);
});
setPublishUrl(parser.extraDataId);
setPublishCooldown(parser.secondsToWait);
setWasPicturePublished(parser.ok);
setIsWaiting(false);
}, []);
UseMessageEventHook(CameraPublishStatusMessageEvent, onCameraPublishStatusMessageEvent);

View File

@ -1,7 +1,7 @@
import { CampaignCalendarData, CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, CalendarItem, RemoveLinkEventTracker, SendMessageComposer } from '../../api';
import { BatchUpdates, UseMessageEventHook } from '../../hooks';
import { UseMessageEventHook } from '../../hooks';
import { CalendarView } from './CalendarView';
export const CampaignView: FC<{}> = props =>
@ -31,23 +31,20 @@ export const CampaignView: FC<{}> = props =>
if(parser.doorOpened)
{
BatchUpdates(() =>
setCalendarData(prev =>
{
setCalendarData(prev =>
{
const copy = prev.clone();
copy.openedDays.push(lastOpenAttempt);
return copy;
});
setReceivedProducts(prev =>
{
const copy = new Map(prev);
copy.set(lastAttempt, new CalendarItem(parser.productName, parser.customImage,parser.furnitureClassName));
return copy;
});
const copy = prev.clone();
copy.openedDays.push(lastOpenAttempt);
return copy;
});
setReceivedProducts(prev =>
{
const copy = new Map(prev);
copy.set(lastAttempt, new CalendarItem(parser.productName, parser.customImage,parser.furnitureClassName));
return copy;
});
}

View File

@ -3,7 +3,7 @@ import { GuildMembershipsMessageEvent } from '@nitrots/nitro-renderer/src/nitro/
import { FC, useCallback } from 'react';
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, NotificationAlertType, NotificationUtilities, ProductTypeEnum } from '../../api';
import { CatalogGiftReceiverNotFoundEvent, CatalogNameResultEvent, CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent } from '../../events';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../hooks';
import { DispatchUiEvent, UseMessageEventHook } from '../../hooks';
import { useCatalogContext } from './CatalogContext';
import { CatalogNode } from './common/CatalogNode';
import { CatalogPetPalette } from './common/CatalogPetPalette';
@ -43,11 +43,8 @@ export const CatalogMessageHandler: FC<{}> = props =>
return catalogNode;
}
BatchUpdates(() =>
{
setRootNode(getCatalogNode(parser.root, 0, null));
setOffersToNodes(offers);
});
setRootNode(getCatalogNode(parser.root, 0, null));
setOffersToNodes(offers);
}, [ setRootNode, setOffersToNodes ]);
const onCatalogPageMessageEvent = useCallback((event: CatalogPageMessageEvent) =>
@ -77,17 +74,14 @@ export const CatalogMessageHandler: FC<{}> = props =>
if((currentType === CatalogType.NORMAL) || ((purchasableOffer.pricingModel !== Offer.PRICING_MODEL_BUNDLE) && (purchasableOffer.pricingModel !== Offer.PRICING_MODEL_MULTI))) purchasableOffers.push(purchasableOffer);
}
BatchUpdates(() =>
if(parser.frontPageItems && parser.frontPageItems.length) setFrontPageItems(parser.frontPageItems);
setIsBusy(false);
if(pageId === parser.pageId)
{
if(parser.frontPageItems && parser.frontPageItems.length) setFrontPageItems(parser.frontPageItems);
setIsBusy(false);
if(pageId === parser.pageId)
{
showCatalogPage(parser.pageId, parser.layoutCode, new PageLocalization(parser.localization.images.concat(), parser.localization.texts.concat()), purchasableOffers, parser.offerId, parser.acceptSeasonCurrencyAsCredits);
}
});
showCatalogPage(parser.pageId, parser.layoutCode, new PageLocalization(parser.localization.images.concat(), parser.localization.texts.concat()), purchasableOffers, parser.offerId, parser.acceptSeasonCurrencyAsCredits);
}
}, [ currentType, pageId, setFrontPageItems, setIsBusy, showCatalogPage ]);
const onPurchaseOKMessageEvent = useCallback((event: PurchaseOKMessageEvent) =>

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
import { AddEventLinkTracker, GetRoomEngine, LocalizeText, NotificationAlertType, NotificationUtilities, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../api';
import { Column, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { CatalogPurchasedEvent } from '../../events';
import { BatchUpdates, UseMessageEventHook, UseUiEvent } from '../../hooks';
import { UseMessageEventHook, UseUiEvent } from '../../hooks';
import { CatalogContextProvider } from './CatalogContext';
import { CatalogMessageHandler } from './CatalogMessageHandler';
import { CatalogPage } from './common/CatalogPage';
@ -44,19 +44,16 @@ export const CatalogView: FC<{}> = props =>
const resetState = useCallback(() =>
{
BatchUpdates(() =>
{
setPageId(-1);
setPreviousPageId(-1);
setRootNode(null);
setOffersToNodes(null);
setCurrentPage(null);
setCurrentOffer(null);
setActiveNodes([]);
setSearchResult(null);
setFrontPageItems([]);
setIsVisible(false);
});
setPageId(-1);
setPreviousPageId(-1);
setRootNode(null);
setOffersToNodes(null);
setCurrentPage(null);
setCurrentOffer(null);
setActiveNodes([]);
setSearchResult(null);
setFrontPageItems([]);
setIsVisible(false);
}, []);
const onCatalogPublishedMessageEvent = useCallback((event: CatalogPublishedMessageEvent) =>
@ -119,11 +116,8 @@ export const CatalogView: FC<{}> = props =>
{
if(pageId < 0) return;
BatchUpdates(() =>
{
setIsBusy(true);
setPageId(pageId);
});
setIsBusy(true);
setPageId(pageId);
if(pageId > -1) SendMessageComposer(new GetCatalogPageComposer(pageId, offerId, currentType));
}, [ currentType ]);
@ -132,24 +126,21 @@ export const CatalogView: FC<{}> = props =>
{
const catalogPage = (new CatalogPage(pageId, layoutCode, localization, offers, acceptSeasonCurrencyAsCredits) as ICatalogPage);
BatchUpdates(() =>
{
setCurrentPage(catalogPage);
setPreviousPageId(prevValue => ((pageId !== -1) ? pageId : prevValue));
setNavigationHidden(false);
setCurrentPage(catalogPage);
setPreviousPageId(prevValue => ((pageId !== -1) ? pageId : prevValue));
setNavigationHidden(false);
if((offerId > -1) && catalogPage.offers.length)
if((offerId > -1) && catalogPage.offers.length)
{
for(const offer of catalogPage.offers)
{
for(const offer of catalogPage.offers)
{
if(offer.offerId !== offerId) continue;
setCurrentOffer(offer)
break;
}
if(offer.offerId !== offerId) continue;
setCurrentOffer(offer)
break;
}
});
}
}, []);
const activateNode = useCallback((targetNode: ICatalogNode, offerId: number = -1) =>
@ -214,67 +205,58 @@ export const CatalogView: FC<{}> = props =>
const openPageById = useCallback((id: number) =>
{
BatchUpdates(() =>
setSearchResult(null);
if(!isVisible)
{
setSearchResult(null);
REQUESTED_PAGE.requestById = id;
if(!isVisible)
{
REQUESTED_PAGE.requestById = id;
setIsVisible(true);
}
else
{
const node = getNodeById(id, rootNode);
setIsVisible(true);
}
else
{
const node = getNodeById(id, rootNode);
if(node) activateNode(node);
}
});
if(node) activateNode(node);
}
}, [ isVisible, rootNode, getNodeById, activateNode ]);
const openPageByName = useCallback((name: string) =>
{
BatchUpdates(() =>
setSearchResult(null);
if(!isVisible)
{
setSearchResult(null);
REQUESTED_PAGE.requestByName = name;
if(!isVisible)
{
REQUESTED_PAGE.requestByName = name;
setIsVisible(true);
}
else
{
const node = getNodeByName(name, rootNode);
setIsVisible(true);
}
else
{
const node = getNodeByName(name, rootNode);
if(node) activateNode(node);
}
});
if(node) activateNode(node);
}
}, [ isVisible, rootNode, getNodeByName, activateNode ]);
const openPageByOfferId = useCallback((offerId: number) =>
{
BatchUpdates(() =>
setSearchResult(null);
if(!isVisible)
{
setSearchResult(null);
REQUESTED_PAGE.requestedByOfferId = offerId;
if(!isVisible)
{
REQUESTED_PAGE.requestedByOfferId = offerId;
setIsVisible(true);
}
else
{
const nodes = getNodesByOfferId(offerId);
setIsVisible(true);
}
else
{
const nodes = getNodesByOfferId(offerId);
if(!nodes || !nodes.length) return;
if(!nodes || !nodes.length) return;
activateNode(nodes[0], offerId);
}
});
activateNode(nodes[0], offerId);
}
}, [ isVisible, getNodesByOfferId, activateNode ]);
const onCatalogPurchasedEvent = useCallback((event: CatalogPurchasedEvent) =>

View File

@ -5,7 +5,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { GetSessionDataManager, LocalizeText, ProductTypeEnum, SendMessageComposer } from '../../../../api';
import { Base, Button, ButtonGroup, Column, Flex, FormGroup, LayoutCurrencyIcon, LayoutFurniImageView, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchasedEvent } from '../../../../events';
import { BatchUpdates, UseUiEvent } from '../../../../hooks';
import { UseUiEvent } from '../../../../hooks';
import { useCatalogContext } from '../../CatalogContext';
export const CatalogGiftView: FC<{}> = props =>
@ -29,20 +29,17 @@ export const CatalogGiftView: FC<{}> = props =>
const close = useCallback(() =>
{
BatchUpdates(() =>
{
setIsVisible(false);
setPageId(0);
setOfferId(0);
setExtraData('');
setReceiverName('');
setShowMyFace(true);
setMessage('');
setSelectedBoxIndex(0);
setSelectedRibbonIndex(0);
if(colors.length) setSelectedColorId(colors[0].id);
});
setIsVisible(false);
setPageId(0);
setOfferId(0);
setExtraData('');
setReceiverName('');
setShowMyFace(true);
setMessage('');
setSelectedBoxIndex(0);
setSelectedRibbonIndex(0);
if(colors.length) setSelectedColorId(colors[0].id);
}, [ colors ]);
const onCatalogEvent = useCallback((event: CatalogEvent) =>
@ -55,15 +52,12 @@ export const CatalogGiftView: FC<{}> = props =>
case CatalogEvent.INIT_GIFT:
const castedEvent = (event as CatalogInitGiftEvent);
BatchUpdates(() =>
{
close();
close();
setPageId(castedEvent.pageId);
setOfferId(castedEvent.offerId);
setExtraData(castedEvent.extraData);
setIsVisible(true);
});
setPageId(castedEvent.pageId);
setOfferId(castedEvent.offerId);
setExtraData(castedEvent.extraData);
setIsVisible(true);
return;
case CatalogEvent.GIFT_RECEIVER_NOT_FOUND:
setReceiverNotFound(true);
@ -144,17 +138,14 @@ export const CatalogGiftView: FC<{}> = props =>
if(giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: `#${giftData.colors[0].toString(16)}` });
}
BatchUpdates(() =>
{
setMaxBoxIndex(giftConfiguration.boxTypes.length - 1);
setMaxRibbonIndex(giftConfiguration.ribbonTypes.length - 1);
setMaxBoxIndex(giftConfiguration.boxTypes.length - 1);
setMaxRibbonIndex(giftConfiguration.ribbonTypes.length - 1);
if(newColors.length)
{
setSelectedColorId(newColors[0].id);
setColors(newColors);
}
});
if(newColors.length)
{
setSelectedColorId(newColors[0].id);
setColors(newColors);
}
}, [ giftConfiguration ]);
if(!giftConfiguration || !giftConfiguration.isEnabled || !isVisible) return null;

View File

@ -3,7 +3,7 @@ import { RedeemVoucherMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRe
import { FC, useCallback, useState } from 'react';
import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../api';
import { Button, Flex } from '../../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../../hooks';
import { UseMessageEventHook } from '../../../../../hooks';
export interface CatalogRedeemVoucherViewProps
{
@ -35,11 +35,8 @@ export const CatalogRedeemVoucherView: FC<CatalogRedeemVoucherViewProps> = props
NotificationUtilities.simpleAlert(message, null, null, null, LocalizeText('catalog.alert.voucherredeem.ok.title'));
BatchUpdates(() =>
{
setIsWaiting(false);
setVoucher('');
});
setIsWaiting(false);
setVoucher('');
}, []);
UseMessageEventHook(VoucherRedeemOkMessageEvent, onVoucherRedeemOkMessageEvent);

View File

@ -4,7 +4,6 @@ import { FC, useCallback, useEffect, useState } from 'react';
import { GetSessionDataManager, LocalizeText } from '../../../../../api';
import { Button } from '../../../../../common/Button';
import { Flex } from '../../../../../common/Flex';
import { BatchUpdates } from '../../../../../hooks';
import { useCatalogContext } from '../../../CatalogContext';
import { CatalogPage } from '../../../common/CatalogPage';
import { CatalogType } from '../../../common/CatalogType';
@ -24,20 +23,17 @@ export const CatalogSearchView: FC<{}> = props =>
const updateSearchValue = (value: string) =>
{
BatchUpdates(() =>
if(!value || !value.length)
{
if(!value || !value.length)
{
setSearchValue('');
setSearchValue('');
if(searchResult) setSearchResult(null);
}
else
{
setSearchValue(value);
setNeedsProcessing(true);
}
});
if(searchResult) setSearchResult(null);
}
else
{
setSearchValue(value);
setNeedsProcessing(true);
}
}
const processSearch = useCallback((search: string) =>
@ -96,11 +92,8 @@ export const CatalogSearchView: FC<{}> = props =>
FilterCatalogNode(search, foundFurniLines, rootNode, nodes);
BatchUpdates(() =>
{
setCurrentPage((new CatalogPage(-1, 'default_3x3', new PageLocalization([], []), offers, false, 1) as ICatalogPage));
setSearchResult(new SearchResult(search, offers, nodes.filter(node => (node.isVisible))));
});
setCurrentPage((new CatalogPage(-1, 'default_3x3', new PageLocalization([], []), offers, false, 1) as ICatalogPage));
setSearchResult(new SearchResult(search, offers, nodes.filter(node => (node.isVisible))));
}, [ offersToNodes, currentType, rootNode, setCurrentPage, setSearchResult ]);
useEffect(() =>

View File

@ -2,7 +2,7 @@ import { CancelMarketplaceOfferMessageComposer, GetMarketplaceOwnOffersMessageCo
import { FC, useCallback, useMemo, useState } from 'react';
import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api';
import { Button, Column, Text } from '../../../../../../common';
import { BatchUpdates, UseMessageEventHook, UseMountEffect } from '../../../../../../hooks';
import { UseMessageEventHook, UseMountEffect } from '../../../../../../hooks';
import { CatalogLayoutProps } from '../CatalogLayout.types';
import { CatalogLayoutMarketplaceItemView, OWN_OFFER } from './CatalogLayoutMarketplaceItemView';
import { MarketplaceOfferData } from './common/MarketplaceOfferData';
@ -28,11 +28,8 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
return newOffer;
});
BatchUpdates(() =>
{
setCreditsWaiting(parser.creditsWaiting);
setOffers(offers);
});
setCreditsWaiting(parser.creditsWaiting);
setOffers(offers);
}, []);
UseMessageEventHook(MarketplaceOwnOffersEvent, onMarketPlaceOwnOffersEvent);

View File

@ -2,7 +2,7 @@ import { BuyMarketplaceOfferMessageComposer, GetMarketplaceOffersMessageComposer
import { FC, useCallback, useMemo, useState } from 'react';
import { LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer } from '../../../../../../api';
import { Button, ButtonGroup, Column, Text } from '../../../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../../../hooks';
import { UseMessageEventHook } from '../../../../../../hooks';
import { GetCurrencyAmount } from '../../../../../purse/common/CurrencyHelper';
import { CatalogLayoutProps } from '../CatalogLayout.types';
import { CatalogLayoutMarketplaceItemView, PUBLIC_OFFER } from './CatalogLayoutMarketplaceItemView';
@ -75,12 +75,8 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
latestOffers.set(entry.offerId, offerEntry);
});
BatchUpdates(() =>
{
setTotalItemsFound(parser.totalItemsFound);
setOffers(latestOffers);
});
setTotalItemsFound(parser.totalItemsFound);
setOffers(latestOffers);
}, []);
const onMarketplaceBuyOfferResultEvent = useCallback( (event: MarketplaceBuyOfferResultEvent) =>

View File

@ -4,7 +4,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { LocalizeText, SendMessageComposer } from '../../../../../../api';
import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, LayoutPetImageView, Text } from '../../../../../../common';
import { CatalogNameResultEvent, CatalogPurchaseFailureEvent, CatalogWidgetEvent } from '../../../../../../events';
import { BatchUpdates, DispatchUiEvent, UseUiEvent } from '../../../../../../hooks';
import { DispatchUiEvent, UseUiEvent } from '../../../../../../hooks';
import { useCatalogContext } from '../../../../CatalogContext';
import { GetPetAvailableColors, GetPetIndexFromLocalization } from '../../../../common/CatalogUtilities';
import { CatalogAddOnBadgeWidgetView } from '../../widgets/CatalogAddOnBadgeWidgetView';
@ -122,12 +122,9 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
const offer = page.offers[0];
BatchUpdates(() =>
{
setCurrentOffer(offer);
setPetIndex(GetPetIndexFromLocalization(offer.localizationId));
setColorsShowing(false);
});
setCurrentOffer(offer);
setPetIndex(GetPetIndexFromLocalization(offer.localizationId));
setColorsShowing(false);
}, [ page, setCurrentOffer ]);
useEffect(() =>
@ -153,21 +150,15 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
palettes.push(palette);
}
BatchUpdates(() =>
{
setSelectedPaletteIndex((palettes.length ? 0 : -1));
setSellablePalettes(palettes);
});
setSelectedPaletteIndex((palettes.length ? 0 : -1));
setSellablePalettes(palettes);
return;
}
}
BatchUpdates(() =>
{
setSelectedPaletteIndex(-1);
setSellablePalettes([]);
});
setSelectedPaletteIndex(-1);
setSellablePalettes([]);
SendMessageComposer(new GetSellablePetPalettesComposer(productData.type));
}, [ currentOffer, petPalettes ]);
@ -178,11 +169,8 @@ export const CatalogLayoutPetView: FC<CatalogLayoutProps> = props =>
const colors = GetPetAvailableColors(petIndex, sellablePalettes);
BatchUpdates(() =>
{
setSelectedColorIndex((colors.length ? 0 : -1));
setSellableColors(colors);
});
setSelectedColorIndex((colors.length ? 0 : -1));
setSellableColors(colors);
}, [ petIndex, sellablePalettes ]);
useEffect(() =>

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, ProductTypeEnum } from '../../../../../api';
import { AutoGrid, AutoGridProps, Button, ButtonGroup } from '../../../../../common';
import { BatchUpdates } from '../../../../../hooks';
import { useCatalogContext } from '../../../CatalogContext';
import { IPurchasableOffer } from '../../../common/IPurchasableOffer';
import { Offer } from '../../../common/Offer';
@ -52,12 +51,9 @@ export const CatalogSpacesWidgetView: FC<CatalogSpacesWidgetViewProps> = props =
}
}
BatchUpdates(() =>
{
setGroupedOffers(groupedOffers);
setSelectedGroupIndex(0);
setSelectedOfferForGroup([ groupedOffers[0][0], groupedOffers[1][0], groupedOffers[2][0] ]);
});
setGroupedOffers(groupedOffers);
setSelectedGroupIndex(0);
setSelectedOfferForGroup([ groupedOffers[0][0], groupedOffers[1][0], groupedOffers[2][0] ]);
}, [ currentPage ]);
useEffect(() =>

View File

@ -3,7 +3,6 @@ import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { AutoSizer, CellMeasurer, CellMeasurerCache, List, ListRowProps, ListRowRenderer, Size } from 'react-virtualized';
import { AddEventLinkTracker, LocalizeText, RemoveLinkEventTracker } from '../../api';
import { Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
import { BatchUpdates } from '../../hooks';
import { ChatHistoryContextProvider } from './ChatHistoryContext';
import { ChatHistoryMessageHandler } from './ChatHistoryMessageHandler';
import { ChatEntryType } from './common/ChatEntryType';
@ -91,11 +90,8 @@ export const ChatHistoryView: FC<{}> = props =>
chatState.notifier = () => setChatHistoryUpdateId(prevValue => (prevValue + 1));
roomState.notifier = () => setRoomHistoryUpdateId(prevValue => (prevValue + 1));
BatchUpdates(() =>
{
setChatHistoryState(chatState);
setRoomHistoryState(roomState);
});
setChatHistoryState(chatState);
setRoomHistoryState(roomState);
return () =>
{

View File

@ -2,7 +2,7 @@ import { HabboSearchComposer, HabboSearchResultData, HabboSearchResultEvent } fr
import { FC, useCallback, useEffect, useState } from 'react';
import { LocalizeText, OpenMessengerChat, SendMessageComposer } from '../../../../api';
import { Base, Column, Flex, NitroCardAccordionItemView, NitroCardAccordionSetView, NitroCardAccordionSetViewProps, Text, UserProfileIconView } from '../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../hooks';
import { UseMessageEventHook } from '../../../../hooks';
import { useFriendsContext } from '../../FriendsContext';
interface FriendsSearchViewProps extends NitroCardAccordionSetViewProps
@ -22,11 +22,8 @@ export const FriendsSearchView: FC<FriendsSearchViewProps> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setFriendResults(parser.friends);
setOtherResults(parser.others);
});
setFriendResults(parser.friends);
setOtherResults(parser.others);
}, []);
UseMessageEventHook(HabboSearchResultEvent, onHabboSearchResultEvent);

View File

@ -4,7 +4,7 @@ import { FC, KeyboardEvent, useCallback, useEffect, useMemo, useRef, useState }
import { AddEventLinkTracker, GetSessionDataManager, GetUserProfile, LocalizeText, NotificationAlertType, NotificationUtilities, PlaySound, RemoveLinkEventTracker, SendMessageComposer, SoundNames } from '../../../../api';
import { Base, Button, ButtonGroup, Column, Flex, Grid, LayoutAvatarImageView, LayoutBadgeImageView, LayoutGridItem, LayoutItemCountView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { FriendsMessengerIconEvent } from '../../../../events';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { MessengerThread } from '../../common/MessengerThread';
import { MessengerThreadChat } from '../../common/MessengerThreadChat';
import { useFriendsContext } from '../../FriendsContext';
@ -142,11 +142,8 @@ export const FriendsMessengerView: FC<{}> = props =>
thread.addMessage(GetSessionDataManager().userId, messageText, 0, null, MessengerThreadChat.CHAT);
BatchUpdates(() =>
{
setMessageThreads(prevValue => [ ...prevValue ]);
setMessageText('');
});
setMessageThreads(prevValue => [ ...prevValue ]);
setMessageText('');
}, [ messageThreads, activeThreadIndex, messageText ]);
const onKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) =>
@ -173,11 +170,8 @@ export const FriendsMessengerView: FC<{}> = props =>
if(threadIndex === -1) return;
BatchUpdates(() =>
{
setActiveThreadIndex(threadIndex);
setIsVisible(true);
});
setActiveThreadIndex(threadIndex);
setIsVisible(true);
}, [ getMessageThreadWithIndex ]);
const closeThread = useCallback((threadIndex: number) =>

View File

@ -2,7 +2,7 @@ import { GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent } from '@nitr
import { FC, useCallback, useEffect, useState } from 'react';
import { HasHabboClub, LocalizeText, SendMessageComposer } from '../../../api';
import { Base, Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../hooks';
import { UseMessageEventHook } from '../../../hooks';
import { IGroupData } from '../common/IGroupData';
import { GroupTabBadgeView } from './tabs/GroupTabBadgeView';
import { GroupTabColorsView } from './tabs/GroupTabColorsView';
@ -94,31 +94,25 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
parser.availableRooms.forEach((name, id) => rooms.push({ id, name }));
BatchUpdates(() =>
{
setAvailableRooms(rooms);
setPurchaseCost(parser.groupCost);
});
setAvailableRooms(rooms);
setPurchaseCost(parser.groupCost);
}, []);
UseMessageEventHook(GroupBuyDataEvent, onGroupBuyDataEvent);
useEffect(() =>
{
BatchUpdates(() =>
{
setCurrentTab(1);
setCurrentTab(1);
setGroupData({
groupId: -1,
groupName: null,
groupDescription: null,
groupHomeroomId: -1,
groupState: 1,
groupCanMembersDecorate: true,
groupColors: null,
groupBadgeParts: null
});
setGroupData({
groupId: -1,
groupName: null,
groupDescription: null,
groupHomeroomId: -1,
groupState: 1,
groupCanMembersDecorate: true,
groupColors: null,
groupBadgeParts: null
});
SendMessageComposer(new GroupBuyDataComposer());

View File

@ -3,7 +3,7 @@ import { GroupAdminGiveComposer, GroupAdminTakeComposer, GroupConfirmMemberRemov
import { FC, useCallback, useEffect, useState } from 'react';
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 { UseMessageEventHook } from '../../../hooks';
export const GroupMembersView: FC<{}> = props =>
{
@ -76,12 +76,9 @@ export const GroupMembersView: FC<{}> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setMembersData(parser);
setLevelId(parser.level);
setTotalPages(Math.ceil(parser.totalMembersCount / parser.pageSize));
});
setMembersData(parser);
setLevelId(parser.level);
setTotalPages(Math.ceil(parser.totalMembersCount / parser.pageSize));
}, []);
UseMessageEventHook(GroupMembersEvent, onGroupMembersEvent);
@ -111,11 +108,8 @@ export const GroupMembersView: FC<{}> = props =>
const groupId = (parseInt(parts[1]) || -1);
const levelId = (parseInt(parts[2]) || 3);
BatchUpdates(() =>
{
setGroupId(groupId);
setLevelId(levelId);
});
setGroupId(groupId);
setLevelId(levelId);
}, []);
useEffect(() =>
@ -146,14 +140,11 @@ export const GroupMembersView: FC<{}> = props =>
{
if(groupId === -1) return;
BatchUpdates(() =>
{
setLevelId(-1);
setMembersData(null);
setTotalPages(0);
setSearchQuery('');
setRemovingMemberName(null);
})
setLevelId(-1);
setMembersData(null);
setTotalPages(0);
setSearchQuery('');
setRemovingMemberName(null);
}, [ groupId ]);
if((groupId === -1) || !membersData) return null;

View File

@ -2,7 +2,6 @@ import { GroupDeleteComposer, GroupSaveInformationComposer } from '@nitrots/nitr
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react';
import { CreateLinkEvent, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../api';
import { Base, Button, Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { IGroupData } from '../../common/IGroupData';
interface GroupTabIdentityViewProps
@ -65,12 +64,9 @@ export const GroupTabIdentityView: FC<GroupTabIdentityViewProps> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setGroupName(groupData.groupName || '');
setGroupDescription(groupData.groupDescription || '');
setGroupHomeroomId(groupData.groupHomeroomId);
});
setGroupName(groupData.groupName || '');
setGroupDescription(groupData.groupDescription || '');
setGroupHomeroomId(groupData.groupHomeroomId);
}, [ groupData ]);
useEffect(() =>

View File

@ -3,7 +3,6 @@ import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from '
import { SendMessageComposer } from '../../../../api';
import { LocalizeText } from '../../../../api/utils/LocalizeText';
import { Column, Flex, HorizontalRule, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { IGroupData } from '../../common/IGroupData';
const STATES: string[] = [ 'regular', 'exclusive', 'private' ];
@ -49,11 +48,8 @@ export const GroupTabSettingsView: FC<GroupTabSettingsViewProps> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setGroupState(groupData.groupState);
setGroupDecorate(groupData.groupCanMembersDecorate);
});
setGroupState(groupData.groupState);
setGroupDecorate(groupData.groupCanMembersDecorate);
}, [ groupData ]);
useEffect(() =>

View File

@ -2,7 +2,7 @@ import { FigureUpdateEvent, RoomSessionEvent, UserInfoDataParser, UserInfoEvent
import { FC, useCallback, useState } from 'react';
import { GetConfiguration, GetConfigurationManager } from '../../api';
import { LayoutAvatarImageView } from '../../common';
import { BatchUpdates, UseMessageEventHook, UseRoomSessionManagerEvent } from '../../hooks';
import { UseMessageEventHook, UseRoomSessionManagerEvent } from '../../hooks';
import { WidgetSlotView } from './views/widgets/WidgetSlotView';
export const HotelView: FC<{}> = props =>
{
@ -16,11 +16,8 @@ export const HotelView: FC<{}> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setUserInfo(parser.userInfo);
setUserFigure(parser.userInfo.figure);
});
setUserInfo(parser.userInfo);
setUserFigure(parser.userInfo.figure);
}, []);
UseMessageEventHook(UserInfoEvent, onUserInfoEvent);

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer, TryVisitRoom } from '../../../../api';
import { Button, Column, DraggableWindowPosition, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { ModToolsOpenRoomChatlogEvent } from '../../../../events/mod-tools/ModToolsOpenRoomChatlogEvent';
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
import { DispatchUiEvent, UseMessageEventHook } from '../../../../hooks';
interface ModToolsRoomViewProps
{
@ -36,15 +36,12 @@ export const ModToolsRoomView: FC<ModToolsRoomViewProps> = props =>
if(!parser || parser.data.flatId !== roomId) return;
BatchUpdates(() =>
{
setLoadedRoomId(parser.data.flatId);
setName(parser.data.room.name);
setOwnerId(parser.data.ownerId);
setOwnerName(parser.data.ownerName);
setOwnerInRoom(parser.data.ownerInRoom);
setUsersInRoom(parser.data.userCount);
});
setLoadedRoomId(parser.data.flatId);
setName(parser.data.room.name);
setOwnerId(parser.data.ownerId);
setOwnerName(parser.data.ownerName);
setOwnerInRoom(parser.data.ownerInRoom);
setUsersInRoom(parser.data.userCount);
}, [ roomId ]);
UseMessageEventHook(ModeratorRoomInfoEvent, onModtoolRoomInfoEvent);

View File

@ -2,7 +2,7 @@ import { ChatRecordData, GetUserChatlogMessageComposer, UserChatlogEvent } from
import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer } from '../../../../api';
import { DraggableWindowPosition, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../hooks';
import { UseMessageEventHook } from '../../../../hooks';
import { ChatlogView } from '../chatlog/ChatlogView';
interface ModToolsUserChatlogViewProps
@ -23,11 +23,8 @@ export const ModToolsUserChatlogView: FC<ModToolsUserChatlogViewProps> = props =
if(!parser || parser.data.userId !== userId) return;
BatchUpdates(() =>
{
setUsername(parser.data.username);
setUserChatlog(parser.data.roomChatlogs);
});
setUsername(parser.data.username);
setUserChatlog(parser.data.roomChatlogs);
}, [ userId ]);
UseMessageEventHook(UserChatlogEvent, onModtoolUserChatlogEvent);

View File

@ -1,7 +1,7 @@
import { CanCreateRoomEventEvent, CantConnectMessageParser, FollowFriendMessageComposer, GenericErrorEvent, GetGuestRoomResultEvent, HabboWebTools, LegacyExternalInterface, NavigatorCategoriesComposer, NavigatorCategoriesEvent, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchEvent, NavigatorSettingsComposer, RoomCreatedEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomDoorbellEvent, RoomDoorbellRejectedEvent, RoomEnterErrorEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomInfoComposer, RoomScoreEvent, RoomSettingsUpdatedEvent, SecurityLevel, UserInfoEvent, UserPermissionsEvent } from '@nitrots/nitro-renderer';
import { FC, useCallback } from 'react';
import { CreateLinkEvent, CreateRoomSession, DoorStateType, GetConfiguration, GetSessionDataManager, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TryVisitRoom, VisitDesktop } from '../../api';
import { BatchUpdates, UseMessageEventHook } from '../../hooks';
import { UseMessageEventHook } from '../../hooks';
import { useNavigatorContext } from './NavigatorContext';
export const NavigatorMessageHandler: FC<{}> = props =>
@ -271,49 +271,43 @@ export const NavigatorMessageHandler: FC<{}> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setTopLevelContexts(parser.topLevelContexts);
setTopLevelContext(parser.topLevelContexts.length ? parser.topLevelContexts[0] : null);
});
setTopLevelContexts(parser.topLevelContexts);
setTopLevelContext(parser.topLevelContexts.length ? parser.topLevelContexts[0] : null);
}, [ setTopLevelContexts, setTopLevelContext ]);
const onNavigatorSearchEvent = useCallback((event: NavigatorSearchEvent) =>
{
const parser = event.getParser();
BatchUpdates(() =>
setTopLevelContext(prevValue =>
{
setTopLevelContext(prevValue =>
let newValue = prevValue;
if(!newValue) newValue = ((topLevelContexts && topLevelContexts.length && topLevelContexts[0]) || null);
if(!newValue) return null;
if((parser.result.code !== newValue.code) && topLevelContexts && topLevelContexts.length)
{
let newValue = prevValue;
if(!newValue) newValue = ((topLevelContexts && topLevelContexts.length && topLevelContexts[0]) || null);
if(!newValue) return null;
if((parser.result.code !== newValue.code) && topLevelContexts && topLevelContexts.length)
{
for(const context of topLevelContexts)
{
if(context.code !== parser.result.code) continue;
newValue = context;
}
}
for(const context of topLevelContexts)
{
if(context.code !== parser.result.code) continue;
newValue = context;
}
}
return newValue;
});
for(const context of topLevelContexts)
{
if(context.code !== parser.result.code) continue;
setSearchResult(parser.result);
newValue = context;
}
return newValue;
});
setSearchResult(parser.result);
}, [ topLevelContexts, setTopLevelContext, setSearchResult ]);
const onNavigatorCategoriesEvent = useCallback((event: NavigatorCategoriesEvent) =>

View File

@ -3,7 +3,7 @@ import { ConvertGlobalRoomIdMessageComposer, HabboWebTools, ILinkEventTracker, L
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { AddEventLinkTracker, DoorStateType, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api';
import { Base, Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
import { BatchUpdates, UseRoomSessionManagerEvent, useSharedNavigatorData } from '../../hooks';
import { UseRoomSessionManagerEvent, useSharedNavigatorData } from '../../hooks';
import { NavigatorContextProvider } from './NavigatorContext';
import { NavigatorMessageHandler } from './NavigatorMessageHandler';
import { NavigatorDoorStateView } from './views/NavigatorDoorStateView';
@ -37,11 +37,8 @@ export const NavigatorView: FC<{}> = props =>
switch(event.type)
{
case RoomSessionEvent.CREATED:
BatchUpdates(() =>
{
setIsVisible(false);
setCreatorOpen(false);
});
setIsVisible(false);
setCreatorOpen(false);
return;
}
}, []);
@ -96,11 +93,8 @@ export const NavigatorView: FC<{}> = props =>
switch(parts[1])
{
case 'show': {
BatchUpdates(() =>
{
setIsVisible(true);
setNeedsSearch(true);
});
setIsVisible(true);
setNeedsSearch(true);
return;
}
case 'hide':
@ -114,11 +108,8 @@ export const NavigatorView: FC<{}> = props =>
return;
}
BatchUpdates(() =>
{
setIsVisible(true);
setNeedsSearch(true);
});
setIsVisible(true);
setNeedsSearch(true);
return;
}
case 'toggle-room-info':
@ -145,11 +136,8 @@ export const NavigatorView: FC<{}> = props =>
}
return;
case 'create':
BatchUpdates(() =>
{
setIsVisible(true);
setCreatorOpen(true);
});
setIsVisible(true);
setCreatorOpen(true);
return;
case 'search':
if(parts.length > 2)
@ -162,11 +150,8 @@ export const NavigatorView: FC<{}> = props =>
pendingSearch.current = { value: searchValue, code: topLevelContextCode };
BatchUpdates(() =>
{
setIsVisible(true);
setNeedsSearch(true);
});
setIsVisible(true);
setNeedsSearch(true);
}
return;
}

View File

@ -3,7 +3,6 @@ import { HabboClubLevelEnum, RoomCreateComposer } from '@nitrots/nitro-renderer'
import { FC, useEffect, useState } from 'react';
import { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, RoomModels, SendMessageComposer } from '../../../api';
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common';
import { BatchUpdates } from '../../../hooks';
import { useNavigatorContext } from '../NavigatorContext';
export const NavigatorRoomCreatorView: FC<{}> = props =>
@ -39,11 +38,8 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
for(let i = 10; i <= 100; i = i + 10) list.push(i);
BatchUpdates(() =>
{
setMaxVisitorsList(list);
setVisitorsCount(list[0]);
});
setMaxVisitorsList(list);
setVisitorsCount(list[0]);
}
}, [ maxVisitorsList ]);

View File

@ -5,7 +5,7 @@ import { FC, useEffect, useState } from 'react';
import { CreateLinkEvent, GetGroupInformation, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api';
import { Button, Column, Flex, LayoutBadgeImageView, LayoutRoomThumbnailView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text, UserProfileIconView } from '../../../common';
import { FloorplanEditorEvent, RoomWidgetThumbnailEvent } from '../../../events';
import { BatchUpdates, DispatchUiEvent } from '../../../hooks';
import { DispatchUiEvent } from '../../../hooks';
import { useNavigatorContext } from '../NavigatorContext';
export class NavigatorRoomInfoViewProps
@ -85,11 +85,9 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
{
if(!navigatorData) return;
BatchUpdates(() =>
{
setIsRoomPicked(navigatorData.currentRoomIsStaffPick);
if(navigatorData.enteredGuestRoom) setIsRoomMuted(navigatorData.enteredGuestRoom.allInRoomMuted);
});
setIsRoomPicked(navigatorData.currentRoomIsStaffPick);
if(navigatorData.enteredGuestRoom) setIsRoomMuted(navigatorData.enteredGuestRoom.allInRoomMuted);
}, [ navigatorData ]);
if(!navigatorData.enteredGuestRoom) return null;

View File

@ -2,7 +2,6 @@ import { RoomDataParser } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { IRoomData, LocalizeText } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
interface NavigatorRoomSettingsTabViewProps
{
@ -26,12 +25,9 @@ export const NavigatorRoomSettingsAccessTabView: FC<NavigatorRoomSettingsTabView
useEffect(() =>
{
BatchUpdates(() =>
{
setPassword('');
setConfirmPassword('');
setIsTryingPassword(false);
});
setPassword('');
setConfirmPassword('');
setIsTryingPassword(false);
}, [ roomData ]);
return (

View File

@ -3,7 +3,6 @@ import { RoomDeleteComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { CreateLinkEvent, GetMaxVisitorsList, IRoomData, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../api';
import { Base, Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useNavigatorContext } from '../../NavigatorContext';
const ROOM_NAME_MIN_LENGTH = 3;
@ -54,11 +53,8 @@ export const NavigatorRoomSettingsBasicTabView: FC<NavigatorRoomSettingsTabViewP
useEffect(() =>
{
BatchUpdates(() =>
{
setRoomName(roomData.roomName);
setRoomDescription(roomData.roomDescription);
});
setRoomName(roomData.roomName);
setRoomDescription(roomData.roomDescription);
}, [ roomData ]);
return (

View File

@ -2,7 +2,7 @@ import { RoomBannedUsersComposer, RoomDataParser, RoomSettingsEvent, SaveRoomSet
import { FC, useCallback, useState } from 'react';
import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api';
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../hooks';
import { UseMessageEventHook } from '../../../../hooks';
import { NavigatorRoomSettingsAccessTabView } from './NavigatorRoomSettingsAccessTabView';
import { NavigatorRoomSettingsBasicTabView } from './NavigatorRoomSettingsBasicTabView';
import { NavigatorRoomSettingsModTabView } from './NavigatorRoomSettingsModTabView';
@ -65,11 +65,8 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
const close = () =>
{
BatchUpdates(() =>
{
setRoomData(null);
setCurrentTab(TABS[0]);
});
setRoomData(null);
setCurrentTab(TABS[0]);
}
const handleChange = (field: string, value: string | number | boolean) =>

View File

@ -2,7 +2,6 @@ import { RoomDataParser } from '@nitrots/nitro-renderer';
import { FC, MouseEvent, useEffect, useState } from 'react';
import { Overlay, Popover } from 'react-bootstrap';
import { Base, NitroCardContentView } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
interface NavigatorSearchResultItemInfoViewProps
{
@ -19,19 +18,16 @@ export const NavigatorSearchResultItemInfoView: FC<NavigatorSearchResultItemInfo
{
event.stopPropagation();
BatchUpdates(() =>
let visible = false;
setIsVisible(prevValue =>
{
let visible = false;
visible = !prevValue;
setIsVisible(prevValue =>
{
visible = !prevValue;
return visible;
});
return visible;
});
if(visible) setTarget((event.target as (EventTarget & HTMLElement)));
})
if(visible) setTarget((event.target as (EventTarget & HTMLElement)));
}
useEffect(() =>

View File

@ -3,7 +3,6 @@ import { NavigatorSearchResultList } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { LocalizeText, NavigatorSearchResultViewDisplayMode } from '../../../../api';
import { AutoGrid, AutoGridProps, Column, Flex, Grid, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { NavigatorSearchResultItemView } from './NavigatorSearchResultItemView';
export interface NavigatorSearchResultViewProps extends AutoGridProps
@ -43,11 +42,8 @@ export const NavigatorSearchResultView: FC<NavigatorSearchResultViewProps> = pro
{
if(!searchResult) return;
BatchUpdates(() =>
{
//setIsExtended(searchResult.closed);
setDisplayMode(searchResult.mode);
});
//setIsExtended(searchResult.closed);
setDisplayMode(searchResult.mode);
}, [ searchResult,props ]);
const gridHasTwoColumns = (displayMode >= NavigatorSearchResultViewDisplayMode.THUMBNAILS);

View File

@ -2,7 +2,6 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React, { FC, KeyboardEvent, useEffect, useState } from 'react';
import { INavigatorSearchFilter, LocalizeText, SearchFilterOptions } from '../../../../api';
import { Button, Flex } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useNavigatorContext } from '../../NavigatorContext';
export interface NavigatorSearchViewProps
@ -60,11 +59,8 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
if(!filter) filter = SearchFilterOptions[0];
BatchUpdates(() =>
{
setSearchFilterIndex(SearchFilterOptions.findIndex(option => (option === filter)));
setSearchValue(value);
});
setSearchFilterIndex(SearchFilterOptions.findIndex(option => (option === filter)));
setSearchValue(value);
}, [ searchResult ]);
return (

View File

@ -2,7 +2,6 @@ import { NitroLogger } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { AddEventLinkTracker, GetConfiguration, NotificationUtilities, RemoveLinkEventTracker } from '../../api';
import { Base, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
import { BatchUpdates } from '../../hooks';
const NEW_LINE_REGEX = /\n\r|\n|\r/mg;
@ -25,25 +24,22 @@ export const NitropediaView: FC<{}> = props =>
const splitData = text.split(NEW_LINE_REGEX);
const line = splitData.shift().split('|');
BatchUpdates(() =>
setHeader(line[0]);
setDimensions(prevValue =>
{
setHeader(line[0]);
setDimensions(prevValue =>
if(line[1] && (line[1].split(';').length === 2))
{
if(line[1] && (line[1].split(';').length === 2))
{
return {
width: parseInt(line[1].split(';')[0]),
height: parseInt(line[1].split(';')[1])
}
return {
width: parseInt(line[1].split(';')[0]),
height: parseInt(line[1].split(';')[1])
}
}
return null;
});
setContent(splitData.join(''));
return null;
});
setContent(splitData.join(''));
}
catch (error)

View File

@ -3,7 +3,6 @@ import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@ni
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import { GetOwnRoomObject, GetUserProfile, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUserActionMessage } from '../../../../api';
import { Base, Flex } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView';
import { ContextMenuListItemView } from '../context-menu/ContextMenuListItemView';
@ -208,11 +207,8 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
useEffect(() =>
{
BatchUpdates(() =>
{
setMode(MODE_NORMAL);
setRespectsLeft(userData.respectLeft);
});
setMode(MODE_NORMAL);
setRespectsLeft(userData.respectLeft);
}, [ userData ]);
return (

View File

@ -1,7 +1,6 @@
import { PetType, RoomObjectCategory, RoomObjectType, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { FC, useEffect, useMemo, useState } from 'react';
import { CreateLinkEvent, GetConfiguration, GetOwnRoomObject, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUserActionMessage } from '../../../../api';
import { BatchUpdates } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView';
import { ContextMenuListItemView } from '../context-menu/ContextMenuListItemView';
@ -130,19 +129,16 @@ export const AvatarInfoWidgetOwnPetView: FC<AvatarInfoWidgetOwnPetViewProps> = p
useEffect(() =>
{
BatchUpdates(() =>
setMode(prevValue =>
{
setMode(prevValue =>
{
if(petData.petType === PetType.MONSTERPLANT) return _Str_10946;
else if(petData.saddle && !petData.rider) return _Str_5818;
else if(petData.rider) return _Str_5938;
return _Str_2906;
});
setRespectsLeft(petData.respectsPetLeft);
if(petData.petType === PetType.MONSTERPLANT) return _Str_10946;
else if(petData.saddle && !petData.rider) return _Str_5818;
else if(petData.rider) return _Str_5938;
return _Str_2906;
});
setRespectsLeft(petData.respectsPetLeft);
}, [ petData ]);
return (

View File

@ -1,7 +1,6 @@
import { PetType, RoomControllerLevel, RoomObjectCategory, RoomObjectType, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { FC, useEffect, useMemo, useState } from 'react';
import { GetOwnRoomObject, GetSessionDataManager, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandPetEvent, RoomWidgetUserActionMessage } from '../../../../api';
import { BatchUpdates } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView';
import { ContextMenuListItemView } from '../context-menu/ContextMenuListItemView';
@ -97,19 +96,16 @@ export const AvatarInfoWidgetPetView: FC<AvatarInfoWidgetPetViewProps> = props =
useEffect(() =>
{
BatchUpdates(() =>
setMode(prevValue =>
{
setMode(prevValue =>
{
if(petData.petType === PetType.MONSTERPLANT) return _Str_13388;
else if(petData.saddle && !petData.rider) return _Str_5818;
else if(petData.rider) return _Str_5938;
return _Str_2906;
});
setRespectsLeft(petData.respectsPetLeft);
if(petData.petType === PetType.MONSTERPLANT) return _Str_13388;
else if(petData.saddle && !petData.rider) return _Str_5818;
else if(petData.rider) return _Str_5938;
return _Str_2906;
});
setRespectsLeft(petData.respectsPetLeft);
}, [ petData ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, MouseEvent, useEffect, useState } from 'react';
import { Overlay, Popover } from 'react-bootstrap';
import { Base, Flex, Grid, NitroCardContentView } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
interface ChatInputStyleSelectorViewProps
{
@ -18,28 +17,22 @@ export const ChatInputStyleSelectorView: FC<ChatInputStyleSelectorViewProps> = p
const selectStyle = (styleId: number) =>
{
BatchUpdates(() =>
{
selectChatStyleId(styleId);
setSelectorVisible(false);
});
selectChatStyleId(styleId);
setSelectorVisible(false);
}
const toggleSelector = (event: MouseEvent<HTMLElement>) =>
{
BatchUpdates(() =>
let visible = false;
setSelectorVisible(prevValue =>
{
let visible = false;
visible = !prevValue;
setSelectorVisible(prevValue =>
{
visible = !prevValue;
return visible;
});
return visible;
});
if(visible) setTarget((event.target as (EventTarget & HTMLElement)));
})
if(visible) setTarget((event.target as (EventTarget & HTMLElement)));
}
useEffect(() =>

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { GetClubMemberLevel, GetConfiguration, GetSessionDataManager, LocalizeText, RoomWidgetChatMessage, RoomWidgetChatTypingMessage, RoomWidgetFloodControlEvent, RoomWidgetUpdateChatInputContentEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
import { Text } from '../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ChatInputStyleSelectorView } from './ChatInputStyleSelectorView';
@ -211,11 +211,8 @@ export const ChatInputView: FC<{}> = props =>
const onRoomWidgetFloodControlEvent = useCallback((event: RoomWidgetFloodControlEvent) =>
{
BatchUpdates(() =>
{
setFloodBlocked(true);
setFloodBlockedSeconds(event.seconds);
});
setFloodBlocked(true);
setFloodBlockedSeconds(event.seconds);
}, []);
UseEventDispatcherHook(RoomWidgetFloodControlEvent.FLOOD_CONTROL, eventDispatcher, onRoomWidgetFloodControlEvent);

View File

@ -1,7 +1,7 @@
import { SecurityLevel } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react';
import { GetSessionDataManager, LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ChooserWidgetView } from './ChooserWidgetView';
@ -26,11 +26,8 @@ export const FurniChooserWidgetView: FC<{}> = props =>
const onRoomWidgetChooserContentEvent = useCallback((event: RoomWidgetChooserContentEvent) =>
{
BatchUpdates(() =>
{
setItems(event.items);
setIsVisible(true);
});
setItems(event.items);
setIsVisible(true);
}, []);
UseEventDispatcherHook(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
@ -53,11 +50,8 @@ export const FurniChooserWidgetView: FC<{}> = props =>
const close = useCallback(() =>
{
BatchUpdates(() =>
{
setIsVisible(false);
setItems(null);
});
setIsVisible(false);
setItems(null);
}, []);
if(!items) return null;

View File

@ -1,6 +1,6 @@
import { FC, useCallback, useState } from 'react';
import { LocalizeText, RoomObjectItem, RoomWidgetChooserContentEvent, RoomWidgetRequestWidgetMessage, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ChooserWidgetView } from './ChooserWidgetView';
@ -25,11 +25,8 @@ export const UserChooserWidgetView: FC<{}> = props =>
const onRoomWidgetChooserContentEvent = useCallback((event: RoomWidgetChooserContentEvent) =>
{
BatchUpdates(() =>
{
setItems(event.items);
setIsVisible(true);
});
setItems(event.items);
setIsVisible(true);
}, []);
UseEventDispatcherHook(RoomWidgetChooserContentEvent.USER_CHOOSER_CONTENT, eventDispatcher, onRoomWidgetChooserContentEvent);
@ -52,11 +49,8 @@ export const UserChooserWidgetView: FC<{}> = props =>
const close = useCallback(() =>
{
BatchUpdates(() =>
{
setIsVisible(false);
setItems(null);
});
setIsVisible(false);
setItems(null);
}, []);
if(!isVisible) return null;

View File

@ -2,7 +2,6 @@ import { FixedSizeStack, NitroPoint, NitroRectangle, RoomObjectType } from '@nit
import { CSSProperties, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { GetNitroInstance, GetRoomEngine, GetRoomObjectBounds, GetRoomSession, GetTicker } from '../../../../api';
import { Base, BaseProps } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
interface ContextMenuViewProps extends BaseProps<HTMLDivElement>
{
@ -102,11 +101,8 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
if(y < SPACE_AROUND_EDGES) y = SPACE_AROUND_EDGES;
else if(y > maxTop) y = maxTop;
BatchUpdates(() =>
{
setCurrentDeltaY(maxStack);
setPos({ x, y });
});
setCurrentDeltaY(maxStack);
setPos({ x, y });
}, [ deltaYStack, currentDeltaY, getOffset ]);
const update = useCallback((time: number) =>
@ -145,11 +141,8 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setDeltaYStack(new FixedSizeStack(LOCATION_STACK_SIZE));
setCurrentDeltaY(-1000000);
});
setDeltaYStack(new FixedSizeStack(LOCATION_STACK_SIZE));
setCurrentDeltaY(-1000000);
}, []);
useEffect(() =>

View File

@ -1,7 +1,7 @@
import { FC, useCallback, useState } from 'react';
import { LocalizeText, RoomWidgetDoorbellEvent, RoomWidgetLetUserInMessage } from '../../../../api';
import { Base, Button, Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
export const DoorbellWidgetView: FC<{}> = props =>
@ -14,11 +14,8 @@ export const DoorbellWidgetView: FC<{}> = props =>
{
if(users.indexOf(userName) >= 0) return;
BatchUpdates(() =>
{
setUsers([ ...users, userName ]);
setIsVisible(true);
});
setUsers([ ...users, userName ]);
setIsVisible(true);
}, [ users ]);
const removeUser = useCallback((userName: string) =>

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { GetRoomEngine, GetSessionDataManager, LocalizeText, RoomWidgetUpdateBackgroundColorPreviewEvent, RoomWidgetUpdateRoomObjectEvent, SendMessageComposer } from '../../../../../api';
import { Button, Column, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook, UseRoomEngineEvent } from '../../../../../hooks';
import { UseEventDispatcherHook, UseRoomEngineEvent } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
export const FurnitureBackgroundColorView: FC<{}> = props =>
@ -36,13 +36,10 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
const roomObject = GetRoomEngine().getRoomObject(event.roomId, event.objectId, event.category);
const model = roomObject.model;
BatchUpdates(() =>
{
setObjectId(roomObject.id);
setHue(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE)));
setSaturation(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION)));
setLightness(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS)));
});
setObjectId(roomObject.id);
setHue(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE)));
setSaturation(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION)));
setLightness(parseInt(model.getValue<string>(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS)));
return;
}

View File

@ -1,7 +1,7 @@
import { ContextMenuEnum, GroupFurniContextMenuInfoMessageEvent, GroupFurniContextMenuInfoMessageParser, RoomEngineTriggerWidgetEvent, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react';
import { GetGroupInformation, GetRoomEngine, IsOwnerOfFurniture, LocalizeText, RoomWidgetFurniActionMessage, TryJoinGroup, TryVisitRoom } from '../../../../../api';
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../../../../hooks';
import { UseMessageEventHook, UseRoomEngineEvent } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
import { ContextMenuHeaderView } from '../../context-menu/ContextMenuHeaderView';
import { ContextMenuListItemView } from '../../context-menu/ContextMenuListItemView';
@ -27,13 +27,10 @@ export const FurnitureContextMenuView: FC<{}> = props =>
const close = useCallback(() =>
{
BatchUpdates(() =>
{
setObjectId(-1);
setGroupData(null);
setIsGroupMember(false);
setMode(null);
});
setObjectId(-1);
setGroupData(null);
setIsGroupMember(false);
setMode(null);
}, []);
const closeConfirm = () =>
@ -53,60 +50,48 @@ export const FurnitureContextMenuView: FC<{}> = props =>
case RoomEngineTriggerWidgetEvent.REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG:
if(!IsOwnerOfFurniture(object)) return;
BatchUpdates(() =>
{
setConfirmingObjectId(object.id);
setConfirmMode(MONSTERPLANT_SEED_CONFIRMATION);
});
setConfirmingObjectId(object.id);
setConfirmMode(MONSTERPLANT_SEED_CONFIRMATION);
close();
return;
case RoomEngineTriggerWidgetEvent.REQUEST_EFFECTBOX_OPEN_DIALOG:
if(!IsOwnerOfFurniture(object)) return;
BatchUpdates(() =>
{
setConfirmingObjectId(object.id);
setConfirmMode(EFFECTBOX_OPEN);
});
setConfirmingObjectId(object.id);
setConfirmMode(EFFECTBOX_OPEN);
close();
return;
case RoomEngineTriggerWidgetEvent.REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG:
if(!IsOwnerOfFurniture(object)) return;
BatchUpdates(() =>
{
setConfirmingObjectId(object.id);
setConfirmMode(PURCHASABLE_CLOTHING_CONFIRMATION);
});
setConfirmingObjectId(object.id);
setConfirmMode(PURCHASABLE_CLOTHING_CONFIRMATION);
close();
return;
case RoomEngineTriggerWidgetEvent.OPEN_FURNI_CONTEXT_MENU:
BatchUpdates(() =>
{
setObjectId(object.id);
setObjectId(object.id);
switch(event.contextMenu)
{
case ContextMenuEnum.FRIEND_FURNITURE:
setMode(ContextMenuEnum.FRIEND_FURNITURE);
return;
case ContextMenuEnum.MONSTERPLANT_SEED:
if(IsOwnerOfFurniture(object)) setMode(ContextMenuEnum.MONSTERPLANT_SEED);
return;
case ContextMenuEnum.MYSTERY_BOX:
return;
case ContextMenuEnum.RANDOM_TELEPORT:
setMode(ContextMenuEnum.RANDOM_TELEPORT);
return;
case ContextMenuEnum.PURCHASABLE_CLOTHING:
if(IsOwnerOfFurniture(object)) setMode(ContextMenuEnum.PURCHASABLE_CLOTHING);
return;
}
});
switch(event.contextMenu)
{
case ContextMenuEnum.FRIEND_FURNITURE:
setMode(ContextMenuEnum.FRIEND_FURNITURE);
return;
case ContextMenuEnum.MONSTERPLANT_SEED:
if(IsOwnerOfFurniture(object)) setMode(ContextMenuEnum.MONSTERPLANT_SEED);
return;
case ContextMenuEnum.MYSTERY_BOX:
return;
case ContextMenuEnum.RANDOM_TELEPORT:
setMode(ContextMenuEnum.RANDOM_TELEPORT);
return;
case ContextMenuEnum.PURCHASABLE_CLOTHING:
if(IsOwnerOfFurniture(object)) setMode(ContextMenuEnum.PURCHASABLE_CLOTHING);
return;
}
return;
case RoomEngineTriggerWidgetEvent.CLOSE_FURNI_CONTEXT_MENU:
@ -125,13 +110,10 @@ export const FurnitureContextMenuView: FC<{}> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setObjectId(parser.objectId);
setGroupData(parser);
setIsGroupMember(parser.userIsMember);
setMode(GROUP_FURNITURE);
});
setObjectId(parser.objectId);
setGroupData(parser);
setIsGroupMember(parser.userIsMember);
setMode(GROUP_FURNITURE);
}, []);
UseMessageEventHook(GroupFurniContextMenuInfoMessageEvent, onGroupFurniContextMenuInfoMessageEvent);

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, RoomWidgetUpdateCustomStackHeightEvent, SendMessageComposer } from '../../../../../api';
import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook, UseMessageEventHook } from '../../../../../hooks';
import { UseEventDispatcherHook, UseMessageEventHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
const MAX_HEIGHT: number = 40;
@ -17,11 +17,8 @@ export const FurnitureCustomStackHeightView: FC<{}> = props =>
const close = () =>
{
BatchUpdates(() =>
{
setObjectId(-1);
setHeight(0);
});
setObjectId(-1);
setHeight(0);
}
const updateHeight = useCallback((height: number, fromServer: boolean = false) =>
@ -32,12 +29,9 @@ export const FurnitureCustomStackHeightView: FC<{}> = props =>
if(!fromServer) ((height > MAX_HEIGHT) && (height = MAX_HEIGHT));
BatchUpdates(() =>
{
setHeight(parseFloat(height.toFixed(2)));
setHeight(parseFloat(height.toFixed(2)));
if(!fromServer) setPendingHeight(height * 100);
});
if(!fromServer) setPendingHeight(height * 100);
}, []);
const onRoomWidgetUpdateCustomStackHeightEvent = useCallback((event: RoomWidgetUpdateCustomStackHeightEvent) =>

View File

@ -4,7 +4,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react';
import ReactSlider from 'react-slider';
import { ColorUtils, GetConfiguration, LocalizeText, RoomWidgetDimmerChangeStateMessage, RoomWidgetDimmerPreviewMessage, RoomWidgetDimmerSavePresetMessage, RoomWidgetUpdateDimmerEvent, RoomWidgetUpdateDimmerStateEvent } from '../../../../../api';
import { Base, Button, Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
import { DimmerFurnitureWidgetPresetItem } from './DimmerFurnitureWidgetPresetItem';
@ -39,12 +39,9 @@ export const FurnitureDimmerView: FC<{}> = props =>
for(const preset of widgetEvent.presets) presets.push(new DimmerFurnitureWidgetPresetItem(preset.id, preset.type, preset.color, preset.brightness));
BatchUpdates(() =>
{
setPresets(presets);
setSelectedPresetId(widgetEvent.selectedPresetId);
setIsVisible(true);
});
setPresets(presets);
setSelectedPresetId(widgetEvent.selectedPresetId);
setIsVisible(true);
return;
}
case RoomWidgetUpdateDimmerEvent.HIDE: {
@ -55,18 +52,15 @@ export const FurnitureDimmerView: FC<{}> = props =>
case RoomWidgetUpdateDimmerStateEvent.DIMMER_STATE: {
const widgetEvent = (event as RoomWidgetUpdateDimmerStateEvent);
BatchUpdates(() =>
{
setLastDimmerState(dimmerState);
setDimmerState(widgetEvent.state);
setSelectedPresetId(widgetEvent.presetId);
setEffectId(widgetEvent.effectId);
setSelectedEffectId(widgetEvent.effectId);
setColor(widgetEvent.color);
setSelectedColor(widgetEvent.color);
setBrightness(widgetEvent.brightness);
setSelectedBrightness(widgetEvent.brightness);
});
setLastDimmerState(dimmerState);
setDimmerState(widgetEvent.state);
setSelectedPresetId(widgetEvent.presetId);
setEffectId(widgetEvent.effectId);
setSelectedEffectId(widgetEvent.effectId);
setColor(widgetEvent.color);
setSelectedColor(widgetEvent.color);
setBrightness(widgetEvent.brightness);
setSelectedBrightness(widgetEvent.brightness);
return;
}
@ -82,14 +76,11 @@ export const FurnitureDimmerView: FC<{}> = props =>
const preset = presets[(id - 1)];
if(!preset) return;
BatchUpdates(() =>
{
setSelectedPresetId(preset.id);
setSelectedEffectId(preset.type);
setSelectedColor(preset.color);
setSelectedBrightness(preset.light);
});
setSelectedPresetId(preset.id);
setSelectedEffectId(preset.type);
setSelectedColor(preset.color);
setSelectedBrightness(preset.light);
}, [ presets ]);
const close = useCallback(() =>

View File

@ -1,7 +1,7 @@
import { FC, useCallback, useState } from 'react';
import { LocalizeText, RoomWidgetCreditFurniRedeemMessage, RoomWidgetUpdateCreditFurniEvent } from '../../../../../api';
import { Base, Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
export const FurnitureExchangeCreditView: FC<{}> = props =>
@ -12,22 +12,16 @@ export const FurnitureExchangeCreditView: FC<{}> = props =>
const onRoomWidgetUpdateCreditFurniEvent = useCallback((event: RoomWidgetUpdateCreditFurniEvent) =>
{
BatchUpdates(() =>
{
setObjectId(event.objectId);
setValue(event.value);
});
setObjectId(event.objectId);
setValue(event.value);
}, []);
UseEventDispatcherHook(RoomWidgetUpdateCreditFurniEvent.CREDIT_FURNI_UPDATE, eventDispatcher, onRoomWidgetUpdateCreditFurniEvent);
const close = () =>
{
BatchUpdates(() =>
{
setObjectId(-1);
setValue(0);
});
setObjectId(-1);
setValue(0);
}
const redeem = () =>

View File

@ -1,7 +1,7 @@
import { FC, useCallback, useState } from 'react';
import { IPhotoData, LocalizeText, RoomWidgetUpdateExternalImageEvent } from '../../../../../api';
import { Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
export const FurnitureExternalImageView: FC<{}> = props =>
@ -20,14 +20,10 @@ export const FurnitureExternalImageView: FC<{}> = props =>
{
switch(event.type)
{
case RoomWidgetUpdateExternalImageEvent.UPDATE_EXTERNAL_IMAGE: {
BatchUpdates(() =>
{
setObjectId(event.objectId);
setPhotoData(event.photoData);
});
}
case RoomWidgetUpdateExternalImageEvent.UPDATE_EXTERNAL_IMAGE:
setObjectId(event.objectId);
setPhotoData(event.photoData);
return;
}
}, []);

View File

@ -2,7 +2,7 @@ import { FriendFurniConfirmLockMessageComposer, LoveLockFurniFinishedEvent, Love
import { FC, useCallback, useState } from 'react';
import { GetRoomEngine, GetRoomSession, LocalizeText, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
import { DraggableWindow, LayoutAvatarImageView, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook, UseMessageEventHook, UseRoomEngineEvent } from '../../../../../hooks';
import { UseEventDispatcherHook, UseMessageEventHook, UseRoomEngineEvent } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
import { FurnitureEngravingLockData } from './FriendFurniLockData';
@ -30,11 +30,8 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
{
if(data.length !== 6) return;
BatchUpdates(() =>
{
setEngravingLockData(new FurnitureEngravingLockData(widgetEvent.objectId, widgetEvent.category, type, [ data[1], data[2] ], [ data[3], data[4] ], data[5]));
setEngravingStage(0);
});
setEngravingLockData(new FurnitureEngravingLockData(widgetEvent.objectId, widgetEvent.category, type, [ data[1], data[2] ], [ data[3], data[4] ], data[5]));
setEngravingStage(0);
}
return;
}
@ -59,11 +56,8 @@ export const FurnitureFriendFurniView: FC<{}> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setEngravingLockData(new FurnitureEngravingLockData(parser.furniId));
setEngravingStage(parser.start ? 1 : 2);
});
setEngravingLockData(new FurnitureEngravingLockData(parser.furniId));
setEngravingStage(parser.start ? 1 : 2);
}, []);
UseMessageEventHook(LoveLockFurniStartEvent, onLoveLockFurniStartEvent);

View File

@ -2,7 +2,6 @@ import { RoomObjectCategory, RoomObjectOperationType } from '@nitrots/nitro-rend
import { FC, useCallback, useMemo, useState } from 'react';
import { CreateLinkEvent, GetRoomEngine, GetSessionDataManager, LocalizeText, ProductTypeEnum, RoomWidgetPresentOpenMessage, RoomWidgetUpdatePresentDataEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
import { Button, Column, Flex, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks/events/UseEventDispatcherHook';
import { useRoomContext } from '../../../RoomContext';
@ -49,16 +48,13 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
switch(event.type)
{
case RoomWidgetUpdatePresentDataEvent.PACKAGEINFO: {
BatchUpdates(() =>
{
setOpenRequested(false);
setObjectId(event.objectId);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setSenderName(event.purchaserName);
setSenderFigure(event.purchaserFigure);
setImageUrl(event.imageUrl);
});
setOpenRequested(false);
setObjectId(event.objectId);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setSenderName(event.purchaserName);
setSenderFigure(event.purchaserFigure);
setImageUrl(event.imageUrl);
return;
}
case RoomWidgetUpdatePresentDataEvent.CONTENTS_FLOOR:
@ -70,47 +66,38 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_LANDSCAPE) imageType = 'packagecard_icon_landscape';
else if(event.type === RoomWidgetUpdatePresentDataEvent.CONTENTS_WALLPAPER) imageType = 'packagecard_icon_wallpaper';
BatchUpdates(() =>
{
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setPlacedItemId(event.placedItemId);
setPlacedItemType(event.placedItemType);
setPlacedInRoom(event.placedInRoom);
setImageUrl(getGiftImageUrl(imageType));
});
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setPlacedItemId(event.placedItemId);
setPlacedItemType(event.placedItemType);
setPlacedInRoom(event.placedInRoom);
setImageUrl(getGiftImageUrl(imageType));
return;
}
case RoomWidgetUpdatePresentDataEvent.CONTENTS_CLUB: {
BatchUpdates(() =>
{
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setImageUrl(getGiftImageUrl('packagecard_icon_hc'));
});
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setImageUrl(getGiftImageUrl('packagecard_icon_hc'));
return;
}
case RoomWidgetUpdatePresentDataEvent.CONTENTS: {
if(!openRequested) return;
BatchUpdates(() =>
{
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setPlacedItemId(event.placedItemId);
setPlacedItemType(event.placedItemType);
setPlacedInRoom(event.placedInRoom);
setImageUrl(event.imageUrl);
});
setObjectId(event.objectId);
setClassId(event.classId);
setItemType(event.itemType);
setText(event.giftMessage);
setIsOwnerOfFurniture(event.isController);
setPlacedItemId(event.placedItemId);
setPlacedItemType(event.placedItemType);
setPlacedInRoom(event.placedInRoom);
setImageUrl(event.imageUrl);
return;
}
case RoomWidgetUpdatePresentDataEvent.CONTENTS_IMAGE: {
@ -143,15 +130,12 @@ export const FurnitureGiftOpeningView: FC<{}> = props =>
const close = useCallback(() =>
{
BatchUpdates(() =>
{
setObjectId(-1);
setOpenRequested(false);
setPlacedItemId(-1);
setPlacedInRoom(false);
setText(null);
setIsOwnerOfFurniture(false);
});
setObjectId(-1);
setOpenRequested(false);
setPlacedItemId(-1);
setPlacedInRoom(false);
setText(null);
setIsOwnerOfFurniture(false);
}, []);
const isSpaces = useMemo(() =>

View File

@ -2,7 +2,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { RoomObjectOperationType } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { ProcessRoomObjectOperation, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../../api';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
import { ObjectLocationView } from '../../object-location/ObjectLocationView';
@ -33,33 +33,24 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
switch(event.type)
{
case RoomWidgetUpdateRoomObjectEvent.OBJECT_REQUEST_MANIPULATION: {
BatchUpdates(() =>
{
setIsVisible(true);
setObjectId(event.id);
setObjectType(event.category);
});
setIsVisible(true);
setObjectId(event.id);
setObjectType(event.category);
return;
}
case RoomWidgetUpdateRoomObjectEvent.FURNI_REMOVED: {
if(event.id === objectId)
{
BatchUpdates(() =>
{
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
});
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
}
return;
}
case RoomWidgetUpdateRoomObjectEvent.OBJECT_DESELECTED: {
BatchUpdates(() =>
{
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
});
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
return;
}
}
@ -74,12 +65,9 @@ export const FurnitureManipulationMenuView: FC<{}> = props =>
moveFurniture();
BatchUpdates(() =>
{
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
});
setIsVisible(false);
setObjectId(-1);
setObjectType(-1);
}, [ moveFurniture ]);
UseEventDispatcherHook(RoomWidgetUpdateDecorateModeEvent.UPDATE_DECORATE, eventDispatcher, onRoomWidgetUpdateDecorateModeEvent);

View File

@ -2,7 +2,7 @@ import { AvatarFigurePartType, FurnitureMannequinSaveLookComposer, FurnitureMann
import { FC, KeyboardEvent, useCallback, useEffect, useState } from 'react';
import { GetAvatarRenderManager, GetClubMemberLevel, GetSessionDataManager, LocalizeText, RoomWidgetUpdateMannequinEvent, SendMessageComposer } from '../../../../../api';
import { Base, Button, Column, Flex, LayoutAvatarImageView, LayoutCurrencyIcon, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
const MODE_NONE: number = -1;
@ -43,33 +43,30 @@ export const FurnitureMannequinView: FC<{}> = props =>
const figureContainer = GetAvatarRenderManager().createFigureContainer(event.figure);
const figureClubLevel = GetAvatarRenderManager().getFigureClubLevel(figureContainer, event.gender, MANNEQUIN_CLOTHING_PART_TYPES);
BatchUpdates(() =>
setObjectId(event.objectId);
setFigure(event.figure);
setGender(event.gender);
setName(event.name);
setClubLevel(figureClubLevel);
if(roomSession.isRoomOwner || (roomSession.controllerLevel >= RoomControllerLevel.GUEST) || GetSessionDataManager().isModerator)
{
setObjectId(event.objectId);
setFigure(event.figure);
setGender(event.gender);
setName(event.name);
setClubLevel(figureClubLevel);
setMode(MODE_CONTROLLER);
}
if(roomSession.isRoomOwner || (roomSession.controllerLevel >= RoomControllerLevel.GUEST) || GetSessionDataManager().isModerator)
{
setMode(MODE_CONTROLLER);
}
else if(GetSessionDataManager().gender.toLowerCase() !== event.gender.toLowerCase())
{
setMode(MODE_WRONG_GENDER);
}
else if(GetSessionDataManager().gender.toLowerCase() !== event.gender.toLowerCase())
{
setMode(MODE_WRONG_GENDER);
}
else if(GetClubMemberLevel() < figureClubLevel)
{
setMode(MODE_NO_CLUB);
}
else
{
setMode(MODE_PEER);
}
});
else if(GetClubMemberLevel() < figureClubLevel)
{
setMode(MODE_NO_CLUB);
}
else
{
setMode(MODE_PEER);
}
}, [ roomSession ]);
UseEventDispatcherHook(RoomWidgetUpdateMannequinEvent.MANNEQUIN_UPDATE, eventDispatcher, onRoomWidgetUpdateMannequinEvent);
@ -136,11 +133,8 @@ export const FurnitureMannequinView: FC<{}> = props =>
transformAsMannequinFigure(figureContainer);
BatchUpdates(() =>
{
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(clubLevel);
});
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(clubLevel);
break;
}
case MODE_UPDATE: {
@ -148,22 +142,16 @@ export const FurnitureMannequinView: FC<{}> = props =>
transformAsMannequinFigure(figureContainer);
BatchUpdates(() =>
{
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(GetAvatarRenderManager().getFigureClubLevel(figureContainer, GetSessionDataManager().gender, MANNEQUIN_CLOTHING_PART_TYPES));
});
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(GetAvatarRenderManager().getFigureClubLevel(figureContainer, GetSessionDataManager().gender, MANNEQUIN_CLOTHING_PART_TYPES));
break;
}
case MODE_PEER:
case MODE_NO_CLUB: {
const figureContainer = getMergedFigureContainer(GetSessionDataManager().figure, figure);
BatchUpdates(() =>
{
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(clubLevel);
});
setRenderedFigure(figureContainer.getFigureString());
setRenderedClubLevel(clubLevel);
break;
}
}

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useMemo, useState } from 'react';
import YouTube, { Options } from 'react-youtube';
import { FurnitureYoutubeDisplayWidgetHandler, LocalizeText, RoomWidgetUpdateYoutubeDisplayEvent, SendMessageComposer } from '../../../../../api';
import { Grid, LayoutGridItem, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook, UseMessageEventHook } from '../../../../../hooks';
import { UseEventDispatcherHook, UseMessageEventHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
import { YoutubeVideoPlaybackStateEnum } from './utils/YoutubeVideoPlaybackStateEnum';
@ -53,13 +53,10 @@ export const FurnitureYoutubeDisplayView: FC<{}> = props =>
if(objectId !== parser.furniId) return;
BatchUpdates(() =>
{
setVideoId(parser.videoId);
setVideoStart(parser.startAtSeconds);
setVideoEnd(parser.endAtSeconds);
setCurrentVideoState(parser.state);
});
setVideoId(parser.videoId);
setVideoStart(parser.startAtSeconds);
setVideoEnd(parser.endAtSeconds);
setCurrentVideoState(parser.state);
}, [ objectId ]);
const onPlaylists = useCallback((event: YoutubeDisplayPlaylistsEvent) =>
@ -70,15 +67,12 @@ export const FurnitureYoutubeDisplayView: FC<{}> = props =>
if(objectId !== parser.furniId) return;
BatchUpdates(() =>
{
setPlaylists(parser.playlists);
setSelectedItem(parser.selectedPlaylistId);
setVideoId(null);
setCurrentVideoState(-1);
setVideoEnd(null);
setVideoStart(null);
});
setPlaylists(parser.playlists);
setSelectedItem(parser.selectedPlaylistId);
setVideoId(null);
setCurrentVideoState(-1);
setVideoEnd(null);
setVideoStart(null);
}, [ objectId ]);
const onControlVideo = useCallback((event: YoutubeControlVideoMessageEvent) =>

View File

@ -3,7 +3,7 @@ import { CrackableDataType, GroupInformationComposer, GroupInformationEvent, Roo
import { FC, useCallback, useEffect, useState } from 'react';
import { CreateLinkEvent, GetGroupInformation, GetRoomEngine, LocalizeText, RoomWidgetFurniActionMessage, RoomWidgetUpdateInfostandFurniEvent, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, LayoutBadgeImageView, LayoutLimitedEditionCompactPlateView, LayoutRarityLevelView, Text, UserProfileIconView } from '../../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../../hooks';
import { UseMessageEventHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
interface InfoStandWidgetFurniViewProps
@ -129,23 +129,20 @@ export const InfoStandWidgetFurniView: FC<InfoStandWidgetFurniViewProps> = props
if(furniData.isStickie) pickupMode = PICKUP_MODE_NONE;
BatchUpdates(() =>
{
setPickupMode(pickupMode);
setCanMove(canMove);
setCanRotate(canRotate);
setCanUse(canUse);
setFurniKeys(furniKeyss);
setFurniValues(furniValuess);
setCustomKeys(customKeyss);
setCustomValues(customValuess);
setIsCrackable(isCrackable);
setCrackableHits(crackableHits);
setCrackableTarget(crackableTarget);
setGodMode(godMode);
setCanSeeFurniId(canSeeFurniId);
setGroupName(null);
});
setPickupMode(pickupMode);
setCanMove(canMove);
setCanRotate(canRotate);
setCanUse(canUse);
setFurniKeys(furniKeyss);
setFurniValues(furniValuess);
setCustomKeys(customKeyss);
setCustomValues(customValuess);
setIsCrackable(isCrackable);
setCrackableHits(crackableHits);
setCrackableTarget(crackableTarget);
setGodMode(godMode);
setCanSeeFurniId(canSeeFurniId);
setGroupName(null);
if(furniData.groupId) SendMessageComposer(new GroupInformationComposer(furniData.groupId, false));
}, [ roomSession, furniData ]);

View File

@ -3,7 +3,7 @@ import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomS
import { Dispatch, FC, FocusEvent, KeyboardEvent, SetStateAction, useCallback, useEffect, useState } from 'react';
import { CloneObject, GetConfiguration, GetGroupInformation, GetSessionDataManager, GetUserProfile, LocalizeText, RoomWidgetChangeMottoMessage, RoomWidgetUpdateInfostandUserEvent, SendMessageComposer } from '../../../../api';
import { Base, Column, Flex, LayoutAvatarImageView, LayoutBadgeImageView, Text, UserProfileIconView } from '../../../../common';
import { BatchUpdates, UseEventDispatcherHook, UseMessageEventHook } from '../../../../hooks';
import { UseEventDispatcherHook, UseMessageEventHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { InfoStandWidgetUserRelationshipsView } from './InfoStandWidgetUserRelationshipsView';
@ -113,22 +113,16 @@ export const InfoStandWidgetUserView: FC<InfoStandWidgetUserViewProps> = props =
useEffect(() =>
{
BatchUpdates(() =>
{
setIsEditingMotto(false);
setMotto(userData.motto);
});
setIsEditingMotto(false);
setMotto(userData.motto);
SendMessageComposer(new UserRelationshipsComposer(userData.webID));
return () =>
{
BatchUpdates(() =>
{
setIsEditingMotto(false);
setMotto(null);
setRelationships(null);
});
setIsEditingMotto(false);
setMotto(null);
setRelationships(null);
}
}, [ userData ]);

View File

@ -3,7 +3,7 @@ import classNames from 'classnames';
import { FC, useCallback, useEffect, useState } from 'react';
import { CreateLinkEvent, LocalizeText, RoomWidgetZoomToggleMessage, SendMessageComposer } from '../../../../api';
import { Base, Column, Flex, Text, TransitionAnimation, TransitionAnimationTypes } from '../../../../common';
import { BatchUpdates, UseMessageEventHook, useSharedNavigatorData } from '../../../../hooks';
import { UseMessageEventHook, useSharedNavigatorData } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
export const RoomToolsWidgetView: FC<{}> = props =>
@ -46,12 +46,9 @@ export const RoomToolsWidgetView: FC<{}> = props =>
if(!parser.roomEnter) return;
BatchUpdates(() =>
{
if(roomName !== parser.data.roomName) setRoomName(parser.data.roomName);
if(roomOwner !== parser.data.ownerName) setRoomOwner(parser.data.ownerName);
if(roomTags !== parser.data.tags) setRoomTags(parser.data.tags);
});
if(roomName !== parser.data.roomName) setRoomName(parser.data.roomName);
if(roomOwner !== parser.data.ownerName) setRoomOwner(parser.data.ownerName);
if(roomTags !== parser.data.tags) setRoomTags(parser.data.tags);
}, [ roomName, roomOwner, roomTags ]);
UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);

View File

@ -1,7 +1,7 @@
import { IQuestion } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react';
import { RoomWidgetPollMessage, RoomWidgetWordQuizUpdateEvent } from '../../../../api';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../hooks';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { VALUE_KEY_DISLIKE, VALUE_KEY_LIKE, VoteValue } from './common/VoteValue';
import { WordQuizQuestionView } from './WordQuizQuestionView';
@ -31,27 +31,24 @@ export const WordQuizWidgetView: FC<{}> = props =>
switch(event.type)
{
case RoomWidgetWordQuizUpdateEvent.NEW_QUESTION:
BatchUpdates(() =>
setPollId(event.id);
setQuestion(event.question);
setAnswerSent(false);
setAnswerCounts(new Map());
setUserAnswers(new Map());
setQuestionClearTimeout(prevValue =>
{
setPollId(event.id);
setQuestion(event.question);
setAnswerSent(false);
setAnswerCounts(new Map());
setUserAnswers(new Map());
if(prevValue) clearTimeout(prevValue);
setQuestionClearTimeout(prevValue =>
if(event.duration > 0)
{
if(prevValue) clearTimeout(prevValue);
const delay = event.duration < 1000 ? DEFAULT_DISPLAY_DELAY : event.duration;
if(event.duration > 0)
{
const delay = event.duration < 1000 ? DEFAULT_DISPLAY_DELAY : event.duration;
return setTimeout(() => clearQuestion(), delay) as unknown as number;
}
return null;
});
return setTimeout(() => clearQuestion(), delay) as unknown as number;
}
return null;
});
break;
case RoomWidgetWordQuizUpdateEvent.QUESTION_ANSWERED: {
@ -59,40 +56,34 @@ export const WordQuizWidgetView: FC<{}> = props =>
if(!userData) return;
BatchUpdates(() =>
setAnswerCounts(event.answerCounts);
setUserAnswers(prevValue =>
{
setAnswerCounts(event.answerCounts);
setUserAnswers(prevValue =>
if(!prevValue.has(userData.roomIndex))
{
if(!prevValue.has(userData.roomIndex))
{
const newValue = new Map(userAnswers);
const newValue = new Map(userAnswers);
newValue.set(userData.roomIndex, { value: event.value, secondsLeft: SIGN_FADE_DELAY });
newValue.set(userData.roomIndex, { value: event.value, secondsLeft: SIGN_FADE_DELAY });
return newValue;
}
return newValue;
}
return prevValue;
});
return prevValue;
});
break;
}
case RoomWidgetWordQuizUpdateEvent.QUESTION_FINISHED:
if(question && question.id === event.questionId)
{
BatchUpdates(() =>
setAnswerCounts(event.answerCounts);
setAnswerSent(true);
setQuestionClearTimeout(prevValue =>
{
setAnswerCounts(event.answerCounts);
setAnswerSent(true);
if(prevValue) clearTimeout(prevValue);
setQuestionClearTimeout(prevValue =>
{
if(prevValue) clearTimeout(prevValue);
return setTimeout(() => clearQuestion(), DEFAULT_DISPLAY_DELAY) as unknown as number;
});
return setTimeout(() => clearQuestion(), DEFAULT_DISPLAY_DELAY) as unknown as number;
});
}

View File

@ -3,7 +3,7 @@ import { FC, useCallback, useState } from 'react';
import { CreateLinkEvent, GetSessionDataManager, GetUserProfile, OpenMessengerChat, VisitDesktop } from '../../api';
import { Base, Flex, LayoutAvatarImageView, LayoutItemCountView, TransitionAnimation, TransitionAnimationTypes } from '../../common';
import { AchievementsUIUnseenCountEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, GuideToolEvent, ModToolsEvent, UserSettingsUIEvent } from '../../events';
import { BatchUpdates, DispatchUiEvent, useInventoryUnseenTracker, UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
import { DispatchUiEvent, useInventoryUnseenTracker, UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
import { ToolbarViewItems } from './common/ToolbarViewItems';
import { ToolbarMeView } from './ToolbarMeView';
@ -34,11 +34,8 @@ export const ToolbarView: FC<ToolbarViewProps> = props =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setUserInfo(parser.userInfo);
setUserFigure(parser.userInfo.figure);
});
setUserInfo(parser.userInfo);
setUserFigure(parser.userInfo.figure);
}, []);
UseMessageEventHook(UserInfoEvent, onUserInfoEvent);

View File

@ -2,7 +2,7 @@ import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomE
import { FC, useCallback, useState } from 'react';
import { CreateLinkEvent, GetRoomSession, GetSessionDataManager, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api';
import { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
import { UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
import { BadgesContainerView } from './views/BadgesContainerView';
import { FriendsContainerView } from './views/FriendsContainerView';
import { GroupsContainerView } from './views/GroupsContainerView';
@ -16,12 +16,9 @@ export const UserProfileView: FC<{}> = props =>
const onClose = () =>
{
BatchUpdates(() =>
{
setUserProfile(null);
setUserBadges([]);
setUserRelationships(null);
});
setUserProfile(null);
setUserBadges([]);
setUserRelationships(null);
}
const onLeaveGroup = useCallback(() =>
@ -59,22 +56,19 @@ export const UserProfileView: FC<{}> = props =>
let isSameProfile = false;
BatchUpdates(() =>
setUserProfile(prevValue =>
{
setUserProfile(prevValue =>
{
if(prevValue && prevValue.id) isSameProfile = (prevValue.id === parser.id);
if(prevValue && prevValue.id) isSameProfile = (prevValue.id === parser.id);
return parser;
});
if(!isSameProfile)
{
setUserBadges([]);
setUserRelationships(null);
}
return parser;
});
if(!isSameProfile)
{
setUserBadges([]);
setUserRelationships(null);
}
SendMessageComposer(new UserCurrentBadgesComposer(parser.id));
SendMessageComposer(new UserRelationshipsComposer(parser.id));
}, []);

View File

@ -2,7 +2,7 @@ import { GroupInformationComposer, GroupInformationEvent, GroupInformationParser
import { FC, useCallback, useEffect, useState } from 'react';
import { SendMessageComposer, ToggleFavoriteGroup } from '../../../api';
import { AutoGrid, Base, Column, Flex, Grid, GridProps, LayoutBadgeImageView, LayoutGridItem } from '../../../common';
import { BatchUpdates, UseMessageEventHook } from '../../../hooks';
import { UseMessageEventHook } from '../../../hooks';
import { GroupInformationView } from '../../groups/views/GroupInformationView';
interface GroupsContainerViewProps extends GridProps
@ -38,23 +38,20 @@ export const GroupsContainerView: FC<GroupsContainerViewProps> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setGroupInformation(null);
setGroupInformation(null);
if(groups.length > 0)
if(groups.length > 0)
{
setSelectedGroupId(prevValue =>
{
setSelectedGroupId(prevValue =>
if(prevValue === groups[0].groupId)
{
if(prevValue === groups[0].groupId)
{
SendMessageComposer(new GroupInformationComposer(groups[0].groupId, false));
}
return groups[0].groupId;
});
}
});
SendMessageComposer(new GroupInformationComposer(groups[0].groupId, false));
}
return groups[0].groupId;
});
}
}, [ groups ]);
if(!groups || !groups.length)

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { GetSessionDataManager, LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../api';
import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
import { BatchUpdates } from '../../../hooks';
import { useWiredContext } from '../WiredContext';
import { WiredFurniSelectorView } from './WiredFurniSelectorView';
@ -49,56 +48,50 @@ export const WiredBaseView: FC<WiredBaseViewProps> = props =>
const spriteId = (trigger.spriteId || -1);
const furniData = GetSessionDataManager().getFloorItemData(spriteId);
BatchUpdates(() =>
if(!furniData)
{
if(!furniData)
{
setWiredName(('NAME: ' + spriteId));
setWiredDescription(('NAME: ' + spriteId));
}
else
{
setWiredName(furniData.name);
setWiredDescription(furniData.description);
}
setWiredName(('NAME: ' + spriteId));
setWiredDescription(('NAME: ' + spriteId));
}
else
{
setWiredName(furniData.name);
setWiredDescription(furniData.description);
}
if(hasSpecialInput)
if(hasSpecialInput)
{
setIntParams(trigger.intData);
setStringParam(trigger.stringData);
}
if(requiresFurni > WiredFurniType.STUFF_SELECTION_OPTION_NONE)
{
setFurniIds(prevValue =>
{
setIntParams(trigger.intData);
setStringParam(trigger.stringData);
}
if(requiresFurni > WiredFurniType.STUFF_SELECTION_OPTION_NONE)
{
setFurniIds(prevValue =>
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
if(trigger.selectedItems && trigger.selectedItems.length)
{
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
if(trigger.selectedItems && trigger.selectedItems.length)
{
WiredSelectionVisualizer.applySelectionShaderToFurni(trigger.selectedItems);
return trigger.selectedItems;
}
return [];
});
}
});
WiredSelectionVisualizer.applySelectionShaderToFurni(trigger.selectedItems);
return trigger.selectedItems;
}
return [];
});
}
return () =>
{
BatchUpdates(() =>
setNeedsSave(false);
setIntParams([]);
setStringParam(null);
setFurniIds(prevValue =>
{
setNeedsSave(false);
setIntParams([]);
setStringParam(null);
setFurniIds(prevValue =>
{
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue);
return [];
});
return [];
});
}
}, [ trigger, hasSpecialInput, requiresFurni, setIntParams, setStringParam, setFurniIds ]);

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { GetSessionDataManager, LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
import { Button, Column, Flex, LayoutAvatarImageView, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -19,11 +18,8 @@ export const WiredActionBotChangeFigureView: FC<{}> = props =>
{
const data = trigger.stringData.split(WIRED_STRING_DELIMETER);
BatchUpdates(() =>
{
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setFigure(data[1].length > 0 ? data[1] : DEFAULT_FIGURE);
});
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setFigure(data[1].length > 0 ? data[1] : DEFAULT_FIGURE);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -13,20 +12,14 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setStringParam(botName);
setIntParams([ followMode ]);
});
setStringParam(botName);
setIntParams([ followMode ]);
}
useEffect(() =>
{
BatchUpdates(() =>
{
setBotName(trigger.stringData);
setFollowMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
});
setBotName(trigger.stringData);
setFollowMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -15,20 +14,14 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setStringParam(botName);
setIntParams([ handItemId ]);
});
setStringParam(botName);
setIntParams([ handItemId ]);
}
useEffect(() =>
{
BatchUpdates(() =>
{
setBotName(trigger.stringData);
setHandItemId((trigger.intData.length > 0) ? trigger.intData[0] : 0);
});
setBotName(trigger.stringData);
setHandItemId((trigger.intData.length > 0) ? trigger.intData[0] : 0);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -14,24 +13,18 @@ export const WiredActionBotTalkToAvatarView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setStringParam(botName + WIRED_STRING_DELIMETER + message);
setIntParams([ talkMode ]);
});
setStringParam(botName + WIRED_STRING_DELIMETER + message);
setIntParams([ talkMode ]);
}
useEffect(() =>
{
const data = trigger.stringData.split(WIRED_STRING_DELIMETER);
BatchUpdates(() =>
{
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setMessage(data[1].length > 0 ? data[1] : '');
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setMessage(data[1].length > 0 ? data[1] : '');
setTalkMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
});
setTalkMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType, WIRED_STRING_DELIMETER } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -14,24 +13,18 @@ export const WiredActionBotTalkView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setStringParam(botName + WIRED_STRING_DELIMETER + message);
setIntParams([ talkMode ]);
});
setStringParam(botName + WIRED_STRING_DELIMETER + message);
setIntParams([ talkMode ]);
}
useEffect(() =>
{
const data = trigger.stringData.split(WIRED_STRING_DELIMETER);
BatchUpdates(() =>
{
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setMessage(data[1].length > 0 ? data[1] : '');
if(data.length > 0) setBotName(data[0]);
if(data.length > 1) setMessage(data[1].length > 0 ? data[1] : '');
setTalkMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
});
setTalkMode((trigger.intData.length > 0) ? trigger.intData[0] : 0);
}, [ trigger ]);
return (

View File

@ -6,7 +6,6 @@ import { Button } from '../../../../common/Button';
import { Column } from '../../../../common/Column';
import { Flex } from '../../../../common/Flex';
import { Text } from '../../../../common/Text';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -65,11 +64,8 @@ export const WiredActionGiveRewardView: FC<{}> = props =>
if(stringRewards.length > 0)
{
BatchUpdates(() =>
{
setStringParam(stringRewards.join(';'));
setIntParams([ rewardTime, uniqueRewards ? 1 : 0, rewardsLimit, limitationInterval ]);
});
setStringParam(stringRewards.join(';'));
setIntParams([ rewardTime, uniqueRewards ? 1 : 0, rewardsLimit, limitationInterval ]);
}
}, [ rewardTime, uniqueRewards, rewardsLimit, limitationInterval, rewards, setIntParams, setStringParam ]);
@ -93,15 +89,12 @@ export const WiredActionGiveRewardView: FC<{}> = props =>
if(readRewards.length === 0) readRewards.push({ isBadge: false, itemCode: '', probability: null });
BatchUpdates(() =>
{
setRewardTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
setUniqueRewards((trigger.intData.length > 1) ? (trigger.intData[1] === 1) : false);
setRewardsLimit((trigger.intData.length > 2) ? trigger.intData[2] : 0);
setLimitationInterval((trigger.intData.length > 3) ? trigger.intData[3] : 0);
setLimitEnabled((trigger.intData.length > 3) ? trigger.intData[3] > 0 : false);
setRewards(readRewards);
});
setRewardTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
setUniqueRewards((trigger.intData.length > 1) ? (trigger.intData[1] === 1) : false);
setRewardsLimit((trigger.intData.length > 2) ? trigger.intData[2] : 0);
setLimitationInterval((trigger.intData.length > 3) ? trigger.intData[3] : 0);
setLimitEnabled((trigger.intData.length > 3) ? trigger.intData[3] > 0 : false);
setRewards(readRewards);
}, [ trigger ]);
return (

View File

@ -2,7 +2,6 @@ import { FC, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -17,21 +16,18 @@ export const WiredActionGiveScoreToPredefinedTeamView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setPoints(trigger.intData[0]);
setTime(trigger.intData[1]);
setSelectedTeam(trigger.intData[2]);
}
else
{
setPoints(1);
setTime(1);
setSelectedTeam(1);
}
});
setPoints(trigger.intData[0]);
setTime(trigger.intData[1]);
setSelectedTeam(trigger.intData[2]);
}
else
{
setPoints(1);
setTime(1);
setSelectedTeam(1);
}
}, [ trigger ]);
return (

View File

@ -2,7 +2,6 @@ import { FC, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -16,19 +15,16 @@ export const WiredActionGiveScoreView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setPoints(trigger.intData[0]);
setTime(trigger.intData[1]);
}
else
{
setPoints(1);
setTime(1);
}
});
setPoints(trigger.intData[0]);
setTime(trigger.intData[1]);
}
else
{
setPoints(1);
setTime(1);
}
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -36,19 +35,16 @@ export const WiredActionMoveAndRotateFurniView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setMovement(trigger.intData[0]);
setRotation(trigger.intData[1]);
}
else
{
setMovement(-1);
setRotation(-1);
}
});
setMovement(trigger.intData[0]);
setRotation(trigger.intData[1]);
}
else
{
setMovement(-1);
setRotation(-1);
}
}, [ trigger ]);
return (

View File

@ -2,7 +2,6 @@ import { FC, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -35,19 +34,16 @@ export const WiredActionMoveFurniToView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setSpacing(trigger.intData[1]);
setMovement(trigger.intData[0]);
}
else
{
setSpacing(-1);
setMovement(-1);
}
});
setSpacing(trigger.intData[1]);
setMovement(trigger.intData[0]);
}
else
{
setSpacing(-1);
setMovement(-1);
}
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -48,19 +47,16 @@ export const WiredActionMoveFurniView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setMovement(trigger.intData[0]);
setRotation(trigger.intData[1]);
}
else
{
setMovement(-1);
setRotation(-1);
}
});
setMovement(trigger.intData[0]);
setRotation(trigger.intData[1]);
}
else
{
setMovement(-1);
setRotation(-1);
}
}, [ trigger ]);
return (

View File

@ -2,7 +2,6 @@ import { FC, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -14,20 +13,14 @@ export const WiredActionMuteUserView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setIntParams([ time ]);
setStringParam(message);
});
setIntParams([ time ]);
setStringParam(message);
}
useEffect(() =>
{
BatchUpdates(() =>
{
setTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
setMessage(trigger.stringData);
});
setTime((trigger.intData.length > 0) ? trigger.intData[0] : 0);
setMessage(trigger.stringData);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredActionBaseView } from './WiredActionBaseView';
@ -16,12 +15,9 @@ export const WiredActionSetFurniStateToView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setStateFlag(trigger.getBoolean(0) ? 1 : 0);
setDirectionFlag(trigger.getBoolean(1) ? 1 : 0);
setPositionFlag(trigger.getBoolean(2) ? 1 : 0);
});
setStateFlag(trigger.getBoolean(0) ? 1 : 0);
setDirectionFlag(trigger.getBoolean(1) ? 1 : 0);
setPositionFlag(trigger.getBoolean(2) ? 1 : 0);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredDateToString, WiredFurniType } from '../../../../api';
import { Column, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredConditionBaseView } from './WiredConditionBaseView';
@ -39,11 +38,8 @@ export const WiredConditionDateRangeView: FC<{}> = props =>
if(trigger.intData[1] > 0) endDate = new Date((trigger.intData[1] * 1000));
BatchUpdates(() =>
{
setStartDate(WiredDateToString(startDate));
setEndDate(WiredDateToString(endDate));
});
setStartDate(WiredDateToString(startDate));
setEndDate(WiredDateToString(endDate));
}
}, [ trigger ]);

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredConditionBaseView } from './WiredConditionBaseView';
@ -16,12 +15,9 @@ export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setStateFlag(trigger.getBoolean(0) ? 1 : 0);
setDirectionFlag(trigger.getBoolean(1) ? 1 : 0);
setPositionFlag(trigger.getBoolean(2) ? 1 : 0);
});
setStateFlag(trigger.getBoolean(0) ? 1 : 0);
setDirectionFlag(trigger.getBoolean(1) ? 1 : 0);
setPositionFlag(trigger.getBoolean(2) ? 1 : 0);
}, [ trigger ]);
return (

View File

@ -2,7 +2,6 @@ import { FC, useEffect, useState } from 'react';
import ReactSlider from 'react-slider';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredConditionBaseView } from './WiredConditionBaseView';
@ -16,19 +15,16 @@ export const WiredConditionUserCountInRoomView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
if(trigger.intData.length >= 2)
{
if(trigger.intData.length >= 2)
{
setMin(trigger.intData[0]);
setMax(trigger.intData[1]);
}
else
{
setMin(1);
setMax(1);
}
});
setMin(trigger.intData[0]);
setMax(trigger.intData[1]);
}
else
{
setMin(1);
setMax(1);
}
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
@ -15,11 +14,8 @@ export const WiredTriggerAvatarEnterRoomView: FC<{}> = props =>
useEffect(() =>
{
BatchUpdates(() =>
{
setUsername(trigger.stringData);
setAvatarMode(trigger.stringData ? 1 : 0);
});
setUsername(trigger.stringData);
setAvatarMode(trigger.stringData ? 1 : 0);
}, [ trigger ]);
return (

View File

@ -1,7 +1,6 @@
import { FC, useEffect, useState } from 'react';
import { GetSessionDataManager, LocalizeText, WiredFurniType } from '../../../../api';
import { Column, Flex, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { useWiredContext } from '../../WiredContext';
import { WiredTriggerBaseView } from './WiredTriggerBaseView';
@ -13,20 +12,14 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props =>
const save = () =>
{
BatchUpdates(() =>
{
setStringParam(message);
setIntParams([ triggererAvatar ]);
});
setStringParam(message);
setIntParams([ triggererAvatar ]);
}
useEffect(() =>
{
BatchUpdates(() =>
{
setMessage(trigger.stringData);
setTriggererAvatar((trigger.intData.length > 0) ? trigger.intData[0] : 0);
});
setMessage(trigger.stringData);
setTriggererAvatar((trigger.intData.length > 0) ? trigger.intData[0] : 0);
}, [ trigger ]);
return (

View File

@ -1,6 +0,0 @@
import { unstable_batchedUpdates } from 'react-dom';
export const BatchUpdates = (callback: () => any) =>
{
return unstable_batchedUpdates(callback);
}

View File

@ -1,4 +1,3 @@
export * from './BatchUpdates';
export * from './events';
export * from './events/core';
export * from './events/nitro';

View File

@ -1,7 +1,7 @@
import { BadgeReceivedEvent, BadgesEvent, RequestBadgesComposer, SetActivatedBadgesComposer } from '@nitrots/nitro-renderer';
import { useCallback, useEffect, useState } from 'react';
import { useBetween } from 'use-between';
import { BatchUpdates, UseMessageEventHook } from '..';
import { UseMessageEventHook } from '..';
import { GetConfiguration, SendMessageComposer } from '../../api';
import { useSharedVisibility } from '../useSharedVisibility';
@ -21,30 +21,30 @@ const useInventoryBadgesState = () =>
const toggleBadge = (badgeCode: string) =>
{
setActiveBadgeCodes(prevValue =>
{
const newValue = [ ...prevValue ];
const index = newValue.indexOf(badgeCode);
if(index === -1)
{
const newValue = [ ...prevValue ];
if(!canWearBadges()) return prevValue;
const index = newValue.indexOf(badgeCode);
newValue.push(badgeCode);
}
else
{
newValue.splice(index, 1);
}
if(index === -1)
{
if(!canWearBadges()) return prevValue;
const composer = new SetActivatedBadgesComposer();
newValue.push(badgeCode);
}
else
{
newValue.splice(index, 1);
}
for(let i = 0; i < maxBadgeCount; i++) composer.addActivatedBadge(newValue[i] || null);
const composer = new SetActivatedBadgesComposer();
SendMessageComposer(composer);
for(let i = 0; i < maxBadgeCount; i++) composer.addActivatedBadge(newValue[i] || null);
SendMessageComposer(composer);
return newValue;
});
return newValue;
});
}
const selectBadge = (badgeCode: string) =>
@ -66,18 +66,14 @@ const useInventoryBadgesState = () =>
const onBadgesEvent = useCallback((event: BadgesEvent) =>
{
const parser = event.getParser();
const newBadgeCodes = parser.getAllBadgeCodes();
const newBadgeIds: number[] = [];
BatchUpdates(() =>
{
const newBadgeCodes = parser.getAllBadgeCodes();
const newBadgeIds: number[] = [];
for(const newBadgeCode of newBadgeCodes) newBadgeIds.push(parser.getBadgeId(newBadgeCode));
for(const newBadgeCode of newBadgeCodes) newBadgeIds.push(parser.getBadgeId(newBadgeCode));
setBadgeCodes(newBadgeCodes);
setBadgeIds(newBadgeIds);
setActiveBadgeCodes(parser.getActiveBadgeCodes());
});
setBadgeCodes(newBadgeCodes);
setBadgeIds(newBadgeIds);
setActiveBadgeCodes(parser.getActiveBadgeCodes());
}, []);
UseMessageEventHook(BadgesEvent, onBadgesEvent);
@ -86,25 +82,22 @@ const useInventoryBadgesState = () =>
{
const parser = event.getParser();
BatchUpdates(() =>
setBadgeCodes(prevValue =>
{
setBadgeCodes(prevValue =>
{
const newValue = [ ...prevValue ];
const newValue = [ ...prevValue ];
newValue.push(parser.badgeCode);
return newValue;
});
setBadgeIds(prevValue =>
{
const newValue = [ ...prevValue ];
newValue.push(parser.badgeId);
return newValue;
})
newValue.push(parser.badgeCode);
return newValue;
});
setBadgeIds(prevValue =>
{
const newValue = [ ...prevValue ];
newValue.push(parser.badgeId);
return newValue;
});
}, []);
@ -115,15 +108,15 @@ const useInventoryBadgesState = () =>
if(!badgeCodes || !badgeCodes.length) return;
setSelectedBadgeCode(prevValue =>
{
let newValue = prevValue;
{
let newValue = prevValue;
if(newValue && (badgeCodes.indexOf(newValue) === -1)) newValue = null;
if(newValue && (badgeCodes.indexOf(newValue) === -1)) newValue = null;
if(!newValue) newValue = badgeCodes[0];
if(!newValue) newValue = badgeCodes[0];
return newValue;
});
return newValue;
});
}, [ badgeCodes ]);
useEffect(() =>

View File

@ -2,7 +2,7 @@ import { AdvancedMap, TradingAcceptComposer, TradingAcceptEvent, TradingCancelCo
import { useCallback, useState } from 'react';
import { useBetween } from 'use-between';
import { useInventoryFurni } from '.';
import { BatchUpdates, UseMessageEventHook } from '..';
import { UseMessageEventHook } from '..';
import { CloneObject, GetRoomSession, GetSessionDataManager, GroupItem, LocalizeText, NotificationUtilities, SendMessageComposer, TradeState, TradeUserData, TradingNotificationMessage, TradingNotificationType } from '../../api';
import { InventoryTradeRequestEvent } from '../../events';
import { UseUiEvent } from '../events';
@ -90,25 +90,25 @@ const useInventoryTradeState = () =>
if(ownUser.userId === parser.userID)
{
setOwnUser(prevValue =>
{
const newValue = CloneObject(prevValue);
{
const newValue = CloneObject(prevValue);
newValue.accepts = parser.userAccepts;
newValue.accepts = parser.userAccepts;
return newValue;
});
return newValue;
});
}
else if(otherUser.userId === parser.userID)
{
setOtherUser(prevValue =>
{
const newValue = CloneObject(prevValue);
{
const newValue = CloneObject(prevValue);
newValue.accepts = parser.userAccepts;
newValue.accepts = parser.userAccepts;
return newValue;
});
return newValue;
});
}
}, [ ownUser, otherUser ]);
@ -130,12 +130,9 @@ const useInventoryTradeState = () =>
}
}
BatchUpdates(() =>
{
setOwnUser(null);
setOtherUser(null);
setTradeState(TradeState.TRADING_STATE_READY);
});
setOwnUser(null);
setOtherUser(null);
setTradeState(TradeState.TRADING_STATE_READY);
}, [ ownUser ]);
UseMessageEventHook(TradingCloseEvent, onTradingCloseEvent);
@ -144,12 +141,9 @@ const useInventoryTradeState = () =>
{
const parser = event.getParser();
BatchUpdates(() =>
{
setOwnUser(null);
setOtherUser(null);
setTradeState(TradeState.TRADING_STATE_READY);
});
setOwnUser(null);
setOtherUser(null);
setTradeState(TradeState.TRADING_STATE_READY);
}, []);
UseMessageEventHook(TradingCompletedEvent, onTradingCompletedEvent);
@ -170,69 +164,69 @@ const useInventoryTradeState = () =>
const secondUserItems = parseTradeItems(parser.secondUserItemArray);
setOwnUser(prevValue =>
{
const newValue = CloneObject(prevValue);
if(newValue.userId === parser.firstUserID)
{
const newValue = CloneObject(prevValue);
newValue.creditsCount = parser.firstUserNumCredits;
newValue.itemCount = parser.firstUserNumItems;
newValue.userItems = firstUserItems;
}
else
{
newValue.creditsCount = parser.secondUserNumCredits;
newValue.itemCount = parser.secondUserNumItems;
newValue.userItems = secondUserItems;
}
if(newValue.userId === parser.firstUserID)
const tradeIds: number[] = [];
for(const groupItem of newValue.userItems.getValues())
{
let i = 0;
while(i < groupItem.getTotalCount())
{
newValue.creditsCount = parser.firstUserNumCredits;
newValue.itemCount = parser.firstUserNumItems;
newValue.userItems = firstUserItems;
}
else
{
newValue.creditsCount = parser.secondUserNumCredits;
newValue.itemCount = parser.secondUserNumItems;
newValue.userItems = secondUserItems;
const item = groupItem.getItemByIndex(i);
if(item) tradeIds.push(item.ref);
i++;
}
}
const tradeIds: number[] = [];
setGroupItems(prevValue =>
{
const newValue = [ ...prevValue ];
for(const groupItem of newValue.userItems.getValues())
{
let i = 0;
while(i < groupItem.getTotalCount())
{
const item = groupItem.getItemByIndex(i);
if(item) tradeIds.push(item.ref);
i++;
}
}
setGroupItems(prevValue =>
{
const newValue = [ ...prevValue ];
for(const groupItem of newValue) groupItem.lockItemIds(tradeIds);
return newValue;
});
for(const groupItem of newValue) groupItem.lockItemIds(tradeIds);
return newValue;
});
return newValue;
});
setOtherUser(prevValue =>
{
const newValue = CloneObject(prevValue);
if(newValue.userId === parser.firstUserID)
{
const newValue = CloneObject(prevValue);
newValue.creditsCount = parser.firstUserNumCredits;
newValue.itemCount = parser.firstUserNumItems;
newValue.userItems = firstUserItems;
}
else
{
newValue.creditsCount = parser.secondUserNumCredits;
newValue.itemCount = parser.secondUserNumItems;
newValue.userItems = secondUserItems;
}
if(newValue.userId === parser.firstUserID)
{
newValue.creditsCount = parser.firstUserNumCredits;
newValue.itemCount = parser.firstUserNumItems;
newValue.userItems = firstUserItems;
}
else
{
newValue.creditsCount = parser.secondUserNumCredits;
newValue.itemCount = parser.secondUserNumItems;
newValue.userItems = secondUserItems;
}
return newValue;
});
return newValue;
});
}, [ setGroupItems ]);
UseMessageEventHook(TradingListItemEvent, onTradingListItemEvent);
@ -280,12 +274,9 @@ const useInventoryTradeState = () =>
secondUser.canTrade = parser.userCanTrade;
}
BatchUpdates(() =>
{
setOwnUser(firstUser);
setOtherUser(secondUser);
setTradeState(TradeState.TRADING_STATE_RUNNING);
});
setOwnUser(firstUser);
setOtherUser(secondUser);
setTradeState(TradeState.TRADING_STATE_RUNNING);
}, []);
UseMessageEventHook(TradingOpenEvent, onTradingOpenEvent);

View File

@ -1,11 +1,11 @@
import { library } from '@fortawesome/fontawesome-svg-core';
import { fas } from '@fortawesome/free-solid-svg-icons';
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { App } from './App';
import './index.scss';
//@ts-ignore
library.add(fas);
ReactDOM.render(<App />, document.getElementById('root'));
createRoot(document.getElementById('root')).render(<App />);

View File

@ -10036,14 +10036,13 @@ react-dev-utils@^11.0.3:
strip-ansi "6.0.0"
text-table "0.2.0"
react-dom@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23"
integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==
react-dom@^18.0.0:
version "18.0.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0.tgz#26b88534f8f1dbb80853e1eabe752f24100d8023"
integrity sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler "^0.20.2"
scheduler "^0.21.0"
react-error-overlay@6.0.9, react-error-overlay@^6.0.9:
version "6.0.9"
@ -10136,10 +10135,12 @@ react-scripts@4.0.3:
optionalDependencies:
fsevents "^2.1.3"
react-slider@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/react-slider/-/react-slider-1.3.1.tgz#41dd88f7c67520811a4114d6f8f49d186268d9da"
integrity sha512-bD8hHJJUgAHI8g1F6PY6432l+Dmcs2fqzUwDhd+0HWDdvfjwNoXRNC2cL9OWyGTjYlJM92A8nF/w1X4pyHfytQ==
react-slider@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/react-slider/-/react-slider-2.0.0.tgz#d904593b23434bf50bf3913aa2ab8c68621f41a5"
integrity sha512-r2Z4VkGvtQXbmiANEYzYdCnb4SnTRpgog1QZa++Wl1x1n5vRL3QOufyf52VVkcaLQCLk5m0WPMwGNvRqcBDtmw==
dependencies:
prop-types "^15.8.1"
react-transition-group@^4.4.2:
version "4.4.2"
@ -10172,13 +10173,12 @@ react-youtube@^7.13.1:
prop-types "15.7.2"
youtube-player "5.5.2"
react@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==
react@^18.0.0:
version "18.0.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.0.0.tgz#b468736d1f4a5891f38585ba8e8fb29f91c3cb96"
integrity sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
read-pkg-up@^7.0.1:
version "7.0.1"
@ -10672,13 +10672,12 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"
scheduler@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.20.2.tgz#4baee39436e34aa93b4874bddcbf0fe8b8b50e91"
integrity sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==
scheduler@^0.21.0:
version "0.21.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820"
integrity sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
schema-utils@^1.0.0:
version "1.0.0"