mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
Rename hooks
This commit is contained in:
parent
afb8b8b48b
commit
10ed6673d4
@ -1,7 +1,7 @@
|
|||||||
import { StringDataType } from '@nitrots/nitro-renderer';
|
import { StringDataType } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useEffect, useMemo, useState } from 'react';
|
import { FC, useEffect, useMemo, useState } from 'react';
|
||||||
import { AutoGrid, AutoGridProps, LayoutBadgeImageView, LayoutGridItem } from '../../../../../common';
|
import { AutoGrid, AutoGridProps, LayoutBadgeImageView, LayoutGridItem } from '../../../../../common';
|
||||||
import { useSharedInventoryBadges } from '../../../../../hooks';
|
import { useInventoryBadges } from '../../../../../hooks';
|
||||||
import { useCatalogContext } from '../../../CatalogContext';
|
import { useCatalogContext } from '../../../CatalogContext';
|
||||||
|
|
||||||
const EXCLUDED_BADGE_CODES: string[] = [];
|
const EXCLUDED_BADGE_CODES: string[] = [];
|
||||||
@ -16,7 +16,7 @@ export const CatalogBadgeSelectorWidgetView: FC<CatalogBadgeSelectorWidgetViewPr
|
|||||||
const { columnCount = 5, ...rest } = props;
|
const { columnCount = 5, ...rest } = props;
|
||||||
const [ currentBadgeCode, setCurrentBadgeCode ] = useState<string>(null);
|
const [ currentBadgeCode, setCurrentBadgeCode ] = useState<string>(null);
|
||||||
const { currentOffer = null, setPurchaseOptions = null } = useCatalogContext();
|
const { currentOffer = null, setPurchaseOptions = null } = useCatalogContext();
|
||||||
const { badgeCodes = [] } = useSharedInventoryBadges();
|
const { badgeCodes = [] } = useInventoryBadges();
|
||||||
|
|
||||||
const previewStuffData = useMemo(() =>
|
const previewStuffData = useMemo(() =>
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ import { FC, useCallback, useEffect, useState } from 'react';
|
|||||||
import { AddEventLinkTracker, GetLocalization, GetRoomEngine, LocalizeText, RemoveLinkEventTracker, UnseenItemCategory } from '../../api';
|
import { AddEventLinkTracker, GetLocalization, GetRoomEngine, LocalizeText, RemoveLinkEventTracker, UnseenItemCategory } from '../../api';
|
||||||
import { isObjectMoverRequested, setObjectMoverRequested } from '../../api/inventory/InventoryUtilities';
|
import { isObjectMoverRequested, setObjectMoverRequested } from '../../api/inventory/InventoryUtilities';
|
||||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||||
import { UseMessageEventHook, UseRoomEngineEvent, UseRoomSessionManagerEvent, useSharedInventoryTrade, useSharedInventoryUnseenTracker } from '../../hooks';
|
import { useInventoryTrade, useInventoryUnseenTracker, UseMessageEventHook, UseRoomEngineEvent, UseRoomSessionManagerEvent } from '../../hooks';
|
||||||
import { InventoryBadgeView } from './views/InventoryBadgeView';
|
import { InventoryBadgeView } from './views/InventoryBadgeView';
|
||||||
import { InventoryBotView } from './views/InventoryBotView';
|
import { InventoryBotView } from './views/InventoryBotView';
|
||||||
import { InventoryFurnitureView } from './views/InventoryFurnitureView';
|
import { InventoryFurnitureView } from './views/InventoryFurnitureView';
|
||||||
@ -23,8 +23,8 @@ export const InventoryView: FC<{}> = props =>
|
|||||||
const [ currentTab, setCurrentTab ] = useState<string>(TABS[0]);
|
const [ currentTab, setCurrentTab ] = useState<string>(TABS[0]);
|
||||||
const [ roomSession, setRoomSession ] = useState<IRoomSession>(null);
|
const [ roomSession, setRoomSession ] = useState<IRoomSession>(null);
|
||||||
const [ roomPreviewer, setRoomPreviewer ] = useState<RoomPreviewer>(null);
|
const [ roomPreviewer, setRoomPreviewer ] = useState<RoomPreviewer>(null);
|
||||||
const { isTrading = false, stopTrading = null } = useSharedInventoryTrade();
|
const { isTrading = false, stopTrading = null } = useInventoryTrade();
|
||||||
const { getCount = null, resetCategory = null } = useSharedInventoryUnseenTracker();
|
const { getCount = null, resetCategory = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
const close = () =>
|
const close = () =>
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { FC, useEffect } from 'react';
|
import { FC, useEffect } from 'react';
|
||||||
import { LocalizeBadgeName, LocalizeText, UnseenItemCategory } from '../../../api';
|
import { LocalizeBadgeName, LocalizeText, UnseenItemCategory } from '../../../api';
|
||||||
import { AutoGrid, Button, Column, Flex, Grid, LayoutBadgeImageView, LayoutGridItem, Text } from '../../../common';
|
import { AutoGrid, Button, Column, Flex, Grid, LayoutBadgeImageView, LayoutGridItem, Text } from '../../../common';
|
||||||
import { useSharedInventoryBadges, useSharedInventoryUnseenTracker } from '../../../hooks';
|
import { useInventoryBadges, useInventoryUnseenTracker } from '../../../hooks';
|
||||||
|
|
||||||
export const InventoryBadgeView: FC<{}> = props =>
|
export const InventoryBadgeView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const { badgeCodes = [], activeBadgeCodes = [], selectedBadgeCode = null, isWearingBadge = null, canWearBadges = null, toggleBadge = null, selectBadge = null, getBadgeId = null } = useSharedInventoryBadges();
|
const { badgeCodes = [], activeBadgeCodes = [], selectedBadgeCode = null, isWearingBadge = null, canWearBadges = null, toggleBadge = null, selectBadge = null, getBadgeId = null } = useInventoryBadges();
|
||||||
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useSharedInventoryUnseenTracker();
|
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ import { IRoomSession, MouseEventType, RoomObjectVariable, RoomPreviewer } from
|
|||||||
import { FC, MouseEvent, useEffect, useState } from 'react';
|
import { FC, MouseEvent, useEffect, useState } from 'react';
|
||||||
import { attemptBotPlacement, GetRoomEngine, IBotItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
import { attemptBotPlacement, GetRoomEngine, IBotItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
||||||
import { AutoGrid, Button, Column, Grid, LayoutAvatarImageView, LayoutGridItem, LayoutRoomPreviewerView, Text } from '../../../common';
|
import { AutoGrid, Button, Column, Grid, LayoutAvatarImageView, LayoutGridItem, LayoutRoomPreviewerView, Text } from '../../../common';
|
||||||
import { useSharedInventoryBots, useSharedInventoryUnseenTracker } from '../../../hooks';
|
import { useInventoryBots, useInventoryUnseenTracker } from '../../../hooks';
|
||||||
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
||||||
|
|
||||||
interface InventoryBotViewProps
|
interface InventoryBotViewProps
|
||||||
@ -14,8 +14,8 @@ interface InventoryBotViewProps
|
|||||||
export const InventoryBotView: FC<InventoryBotViewProps> = props =>
|
export const InventoryBotView: FC<InventoryBotViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { roomSession = null, roomPreviewer = null } = props;
|
const { roomSession = null, roomPreviewer = null } = props;
|
||||||
const { botItems = [], selectedBot = null, selectBot = null } = useSharedInventoryBots();
|
const { botItems = [], selectedBot = null, selectBot = null } = useInventoryBots();
|
||||||
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useSharedInventoryUnseenTracker();
|
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ import { IRoomSession, MouseEventType, RoomObjectVariable, RoomPreviewer, Vector
|
|||||||
import { FC, MouseEvent, useEffect, useState } from 'react';
|
import { FC, MouseEvent, useEffect, useState } from 'react';
|
||||||
import { attemptItemPlacement, FurniCategory, GetRoomEngine, GetSessionDataManager, GroupItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
import { attemptItemPlacement, FurniCategory, GetRoomEngine, GetSessionDataManager, GroupItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
||||||
import { AutoGrid, Button, Column, Grid, LayoutGridItem, LayoutLimitedEditionCompactPlateView, LayoutRarityLevelView, LayoutRoomPreviewerView, Text } from '../../../common';
|
import { AutoGrid, Button, Column, Grid, LayoutGridItem, LayoutLimitedEditionCompactPlateView, LayoutRarityLevelView, LayoutRoomPreviewerView, Text } from '../../../common';
|
||||||
import { useSharedInventoryFurni, useSharedInventoryUnseenTracker } from '../../../hooks';
|
import { useInventoryFurni, useInventoryUnseenTracker } from '../../../hooks';
|
||||||
import { attemptPlaceMarketplaceOffer } from '../../../hooks/inventory/common';
|
import { attemptPlaceMarketplaceOffer } from '../../../hooks/inventory/common';
|
||||||
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
||||||
import { InventoryFurnitureSearchView } from './InventoryFurnitureSearchView';
|
import { InventoryFurnitureSearchView } from './InventoryFurnitureSearchView';
|
||||||
@ -16,9 +16,9 @@ interface InventoryFurnitureViewProps
|
|||||||
export const InventoryFurnitureView: FC<InventoryFurnitureViewProps> = props =>
|
export const InventoryFurnitureView: FC<InventoryFurnitureViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { roomSession = null, roomPreviewer = null } = props;
|
const { roomSession = null, roomPreviewer = null } = props;
|
||||||
const { groupItems = [], selectedItem = null, selectItem = null } = useSharedInventoryFurni();
|
const { groupItems = [], selectedItem = null, selectItem = null } = useInventoryFurni();
|
||||||
const [ filteredGroupItems, setFilteredGroupItems ] = useState<GroupItem[]>(groupItems);
|
const [ filteredGroupItems, setFilteredGroupItems ] = useState<GroupItem[]>(groupItems);
|
||||||
const { getCount = null, resetCategory = null } = useSharedInventoryUnseenTracker();
|
const { getCount = null, resetCategory = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ import { IRoomSession, MouseEventType, RoomObjectVariable, RoomPreviewer } from
|
|||||||
import { FC, MouseEvent, useEffect, useState } from 'react';
|
import { FC, MouseEvent, useEffect, useState } from 'react';
|
||||||
import { attemptPetPlacement, GetRoomEngine, IPetItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
import { attemptPetPlacement, GetRoomEngine, IPetItem, LocalizeText, UnseenItemCategory } from '../../../api';
|
||||||
import { AutoGrid, Button, Column, Grid, LayoutGridItem, LayoutPetImageView, LayoutRoomPreviewerView, Text } from '../../../common';
|
import { AutoGrid, Button, Column, Grid, LayoutGridItem, LayoutPetImageView, LayoutRoomPreviewerView, Text } from '../../../common';
|
||||||
import { useSharedInventoryPets, useSharedInventoryUnseenTracker } from '../../../hooks';
|
import { useInventoryPets, useInventoryUnseenTracker } from '../../../hooks';
|
||||||
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
import { InventoryCategoryEmptyView } from './InventoryCategoryEmptyView';
|
||||||
|
|
||||||
interface InventoryPetViewProps
|
interface InventoryPetViewProps
|
||||||
@ -14,8 +14,8 @@ interface InventoryPetViewProps
|
|||||||
export const InventoryPetView: FC<InventoryPetViewProps> = props =>
|
export const InventoryPetView: FC<InventoryPetViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { roomSession = null, roomPreviewer = null } = props;
|
const { roomSession = null, roomPreviewer = null } = props;
|
||||||
const { petItems = null, selectedPet = null, selectPet = null } = useSharedInventoryPets();
|
const { petItems = null, selectedPet = null, selectPet = null } = useInventoryPets();
|
||||||
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useSharedInventoryUnseenTracker();
|
const { getCount = null, resetCategory = null, isUnseen = null, removeUnseen = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ import { IObjectData, TradingListAddItemComposer, TradingListAddItemsComposer }
|
|||||||
import { FC, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { FurniCategory, GroupItem, IFurnitureItem, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TradeState } from '../../../api';
|
import { FurniCategory, GroupItem, IFurnitureItem, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TradeState } from '../../../api';
|
||||||
import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, Text } from '../../../common';
|
import { AutoGrid, Base, Button, Column, Flex, Grid, LayoutGridItem, Text } from '../../../common';
|
||||||
import { useSharedInventoryTrade } from '../../../hooks';
|
import { useInventoryTrade } from '../../../hooks';
|
||||||
import { getGuildFurniType } from '../../../hooks/inventory/common/TradingUtilities';
|
import { getGuildFurniType } from '../../../hooks/inventory/common/TradingUtilities';
|
||||||
import { InventoryFurnitureSearchView } from './InventoryFurnitureSearchView';
|
import { InventoryFurnitureSearchView } from './InventoryFurnitureSearchView';
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export const InventoryTradeView: FC<InventoryTradeViewProps> = props =>
|
|||||||
const [ otherGroupItem, setOtherGroupItem ] = useState<GroupItem>(null);
|
const [ otherGroupItem, setOtherGroupItem ] = useState<GroupItem>(null);
|
||||||
const [ filteredGroupItems, setFilteredGroupItems ] = useState<GroupItem[]>(null);
|
const [ filteredGroupItems, setFilteredGroupItems ] = useState<GroupItem[]>(null);
|
||||||
const [ countdownTick, setCountdownTick ] = useState(3);
|
const [ countdownTick, setCountdownTick ] = useState(3);
|
||||||
const { ownUser = null, otherUser = null, groupItems = [], tradeState = TradeState.TRADING_STATE_READY, progressTrade = null, removeItem = null, setTradeState = null } = useSharedInventoryTrade();
|
const { ownUser = null, otherUser = null, groupItems = [], tradeState = TradeState.TRADING_STATE_READY, progressTrade = null, removeItem = null, setTradeState = null } = useInventoryTrade();
|
||||||
|
|
||||||
const canTradeItem = (isWallItem: boolean, spriteId: number, category: number, groupable: boolean, stuffData: IObjectData) =>
|
const canTradeItem = (isWallItem: boolean, spriteId: number, category: number, groupable: boolean, stuffData: IObjectData) =>
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ import { FC, useCallback, useState } from 'react';
|
|||||||
import { CreateLinkEvent, GetSessionDataManager, GetUserProfile, OpenMessengerChat, VisitDesktop } from '../../api';
|
import { CreateLinkEvent, GetSessionDataManager, GetUserProfile, OpenMessengerChat, VisitDesktop } from '../../api';
|
||||||
import { Base, Flex, LayoutAvatarImageView, LayoutItemCountView, TransitionAnimation, TransitionAnimationTypes } from '../../common';
|
import { Base, Flex, LayoutAvatarImageView, LayoutItemCountView, TransitionAnimation, TransitionAnimationTypes } from '../../common';
|
||||||
import { AchievementsUIUnseenCountEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, GuideToolEvent, ModToolsEvent, UserSettingsUIEvent } from '../../events';
|
import { AchievementsUIUnseenCountEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, GuideToolEvent, ModToolsEvent, UserSettingsUIEvent } from '../../events';
|
||||||
import { BatchUpdates, DispatchUiEvent, UseMessageEventHook, UseRoomEngineEvent, useSharedInventoryUnseenTracker, UseUiEvent } from '../../hooks';
|
import { BatchUpdates, DispatchUiEvent, useInventoryUnseenTracker, UseMessageEventHook, UseRoomEngineEvent, UseUiEvent } from '../../hooks';
|
||||||
import { ToolbarViewItems } from './common/ToolbarViewItems';
|
import { ToolbarViewItems } from './common/ToolbarViewItems';
|
||||||
import { ToolbarMeView } from './ToolbarMeView';
|
import { ToolbarMeView } from './ToolbarMeView';
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ export const ToolbarView: FC<ToolbarViewProps> = props =>
|
|||||||
const [ chatIconType, setChatIconType ] = useState(CHAT_ICON_HIDDEN);
|
const [ chatIconType, setChatIconType ] = useState(CHAT_ICON_HIDDEN);
|
||||||
const [ unseenAchievementCount, setUnseenAchievementCount ] = useState(0);
|
const [ unseenAchievementCount, setUnseenAchievementCount ] = useState(0);
|
||||||
const [ unseenFriendRequestCount, setFriendRequestCount ] = useState(0);
|
const [ unseenFriendRequestCount, setFriendRequestCount ] = useState(0);
|
||||||
const { getFullCount = null } = useSharedInventoryUnseenTracker();
|
const { getFullCount = null } = useInventoryUnseenTracker();
|
||||||
const isMod = GetSessionDataManager().isModerator;
|
const isMod = GetSessionDataManager().isModerator;
|
||||||
|
|
||||||
const onUserInfoEvent = useCallback((event: UserInfoEvent) =>
|
const onUserInfoEvent = useCallback((event: UserInfoEvent) =>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export * from './common';
|
export * from './common';
|
||||||
export * from './useSharedInventoryBadges';
|
export * from './useInventoryBadges';
|
||||||
export * from './useSharedInventoryBots';
|
export * from './useInventoryBots';
|
||||||
export * from './useSharedInventoryFurni';
|
export * from './useInventoryFurni';
|
||||||
export * from './useSharedInventoryPets';
|
export * from './useInventoryPets';
|
||||||
export * from './useSharedInventoryTrade';
|
export * from './useInventoryTrade';
|
||||||
export * from './useSharedInventoryUnseenTracker';
|
export * from './useInventoryUnseenTracker';
|
||||||
|
@ -5,7 +5,7 @@ import { BatchUpdates, UseMessageEventHook } from '..';
|
|||||||
import { GetConfiguration, SendMessageComposer } from '../../api';
|
import { GetConfiguration, SendMessageComposer } from '../../api';
|
||||||
import { useSharedVisibility } from '../useSharedVisibility';
|
import { useSharedVisibility } from '../useSharedVisibility';
|
||||||
|
|
||||||
const useInventoryBadges = () =>
|
const useInventoryBadgesState = () =>
|
||||||
{
|
{
|
||||||
const [ isVisible, setIsVisible ] = useState(false);
|
const [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
||||||
@ -138,9 +138,9 @@ const useInventoryBadges = () =>
|
|||||||
return { badgeCodes, activeBadgeCodes, selectedBadgeCode, isWearingBadge, canWearBadges, toggleBadge, selectBadge, getBadgeId, setIsVisible };
|
return { badgeCodes, activeBadgeCodes, selectedBadgeCode, isWearingBadge, canWearBadges, toggleBadge, selectBadge, getBadgeId, setIsVisible };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryBadges = () =>
|
export const useInventoryBadges = () =>
|
||||||
{
|
{
|
||||||
const { setIsVisible, ...rest } = useBetween(useInventoryBadges);
|
const { setIsVisible, ...rest } = useBetween(useInventoryBadgesState);
|
||||||
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
@ -1,18 +1,18 @@
|
|||||||
import { BotAddedToInventoryEvent, BotData, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, GetBotInventoryComposer } from '@nitrots/nitro-renderer';
|
import { BotAddedToInventoryEvent, BotData, BotInventoryMessageEvent, BotRemovedFromInventoryEvent, GetBotInventoryComposer } from '@nitrots/nitro-renderer';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { useSharedInventoryUnseenTracker } from '.';
|
import { useInventoryUnseenTracker } from '.';
|
||||||
import { UseMessageEventHook } from '..';
|
import { UseMessageEventHook } from '..';
|
||||||
import { cancelRoomObjectPlacement, CreateLinkEvent, getPlacingItemId, IBotItem, SendMessageComposer, UnseenItemCategory } from '../../api';
|
import { cancelRoomObjectPlacement, CreateLinkEvent, getPlacingItemId, IBotItem, SendMessageComposer, UnseenItemCategory } from '../../api';
|
||||||
import { useSharedVisibility } from '../useSharedVisibility';
|
import { useSharedVisibility } from '../useSharedVisibility';
|
||||||
|
|
||||||
const useInventoryBots = () =>
|
const useInventoryBotsState = () =>
|
||||||
{
|
{
|
||||||
const [ isVisible, setIsVisible ] = useState(false);
|
const [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
||||||
const [ botItems, setBotItems ] = useState<IBotItem[]>([]);
|
const [ botItems, setBotItems ] = useState<IBotItem[]>([]);
|
||||||
const [ selectedBot, setSelectedBot ] = useState<IBotItem>(null);
|
const [ selectedBot, setSelectedBot ] = useState<IBotItem>(null);
|
||||||
const { isUnseen = null } = useSharedInventoryUnseenTracker();
|
const { isUnseen = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
const selectBot = (bot: IBotItem) => setSelectedBot(bot);
|
const selectBot = (bot: IBotItem) => setSelectedBot(bot);
|
||||||
|
|
||||||
@ -151,9 +151,9 @@ const useInventoryBots = () =>
|
|||||||
return { botItems, selectedBot, selectBot, setIsVisible };
|
return { botItems, selectedBot, selectBot, setIsVisible };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryBots = () =>
|
export const useInventoryBots = () =>
|
||||||
{
|
{
|
||||||
const { setIsVisible, ...rest } = useBetween(useInventoryBots);
|
const { setIsVisible, ...rest } = useBetween(useInventoryBotsState);
|
||||||
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
@ -1,7 +1,7 @@
|
|||||||
import { FurnitureListAddOrUpdateEvent, FurnitureListComposer, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent } from '@nitrots/nitro-renderer';
|
import { FurnitureListAddOrUpdateEvent, FurnitureListComposer, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListItemParser, FurnitureListRemovedEvent, FurniturePostItPlacedEvent } from '@nitrots/nitro-renderer';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { useSharedInventoryUnseenTracker } from '.';
|
import { useInventoryUnseenTracker } from '.';
|
||||||
import { UseMessageEventHook } from '..';
|
import { UseMessageEventHook } from '..';
|
||||||
import { attemptItemPlacement, cancelRoomObjectPlacement, CloneObject, CreateLinkEvent, FurnitureItem, getPlacingItemId, GroupItem, SendMessageComposer, UnseenItemCategory } from '../../api';
|
import { attemptItemPlacement, cancelRoomObjectPlacement, CloneObject, CreateLinkEvent, FurnitureItem, getPlacingItemId, GroupItem, SendMessageComposer, UnseenItemCategory } from '../../api';
|
||||||
import { useSharedVisibility } from '../useSharedVisibility';
|
import { useSharedVisibility } from '../useSharedVisibility';
|
||||||
@ -9,13 +9,13 @@ import { addFurnitureItem, getAllItemIds, mergeFurniFragments } from './common';
|
|||||||
|
|
||||||
let furniMsgFragments: Map<number, FurnitureListItemParser>[] = null;
|
let furniMsgFragments: Map<number, FurnitureListItemParser>[] = null;
|
||||||
|
|
||||||
const useInventoryFurni = () =>
|
const useInventoryFurniState = () =>
|
||||||
{
|
{
|
||||||
const [ isVisible, setIsVisible ] = useState(false);
|
const [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
||||||
const [ groupItems, setGroupItems ] = useState<GroupItem[]>([]);
|
const [ groupItems, setGroupItems ] = useState<GroupItem[]>([]);
|
||||||
const [ selectedItem, setSelectedItem ] = useState<GroupItem>(null);
|
const [ selectedItem, setSelectedItem ] = useState<GroupItem>(null);
|
||||||
const { isUnseen = null, removeUnseen = null, resetCategory = null, getCount = null } = useSharedInventoryUnseenTracker();
|
const { isUnseen = null, removeUnseen = null, resetCategory = null, getCount = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
const selectItem = (item: GroupItem) =>
|
const selectItem = (item: GroupItem) =>
|
||||||
{
|
{
|
||||||
@ -253,9 +253,9 @@ const useInventoryFurni = () =>
|
|||||||
return { groupItems, setGroupItems, selectedItem, selectItem, setIsVisible };
|
return { groupItems, setGroupItems, selectedItem, selectItem, setIsVisible };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryFurni = () =>
|
export const useInventoryFurni = () =>
|
||||||
{
|
{
|
||||||
const { setIsVisible, ...rest } = useBetween(useInventoryFurni);
|
const { setIsVisible, ...rest } = useBetween(useInventoryFurniState);
|
||||||
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
@ -1,7 +1,7 @@
|
|||||||
import { PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestPetsComposer } from '@nitrots/nitro-renderer';
|
import { PetAddedToInventoryEvent, PetData, PetInventoryEvent, PetRemovedFromInventory, RequestPetsComposer } from '@nitrots/nitro-renderer';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { useSharedInventoryUnseenTracker } from '.';
|
import { useInventoryUnseenTracker } from '.';
|
||||||
import { UseMessageEventHook } from '..';
|
import { UseMessageEventHook } from '..';
|
||||||
import { SendMessageComposer } from '../../api';
|
import { SendMessageComposer } from '../../api';
|
||||||
import { IPetItem } from '../../api/inventory/IPetItem';
|
import { IPetItem } from '../../api/inventory/IPetItem';
|
||||||
@ -10,13 +10,13 @@ import { addSinglePetItem, mergePetFragments, processPetFragment, removePetItemB
|
|||||||
|
|
||||||
let petMsgFragments: Map<number, PetData>[] = null;
|
let petMsgFragments: Map<number, PetData>[] = null;
|
||||||
|
|
||||||
const useInventoryPets = () =>
|
const useInventoryPetsState = () =>
|
||||||
{
|
{
|
||||||
const [ isVisible, setIsVisible ] = useState(false);
|
const [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
const [ needsUpdate, setNeedsUpdate ] = useState(true);
|
||||||
const [ petItems, setPetItems ] = useState<IPetItem[]>([]);
|
const [ petItems, setPetItems ] = useState<IPetItem[]>([]);
|
||||||
const [ selectedPet, setSelectedPet ] = useState<IPetItem>(null);
|
const [ selectedPet, setSelectedPet ] = useState<IPetItem>(null);
|
||||||
const { isUnseen = null } = useSharedInventoryUnseenTracker();
|
const { isUnseen = null } = useInventoryUnseenTracker();
|
||||||
|
|
||||||
const selectPet = (pet: IPetItem) => setSelectedPet(pet);
|
const selectPet = (pet: IPetItem) => setSelectedPet(pet);
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ const useInventoryPets = () =>
|
|||||||
return { petItems, selectedPet, selectPet, setIsVisible };
|
return { petItems, selectedPet, selectPet, setIsVisible };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryPets = () =>
|
export const useInventoryPets = () =>
|
||||||
{
|
{
|
||||||
const { setIsVisible, ...rest } = useBetween(useInventoryPets);
|
const { setIsVisible, ...rest } = useBetween(useInventoryPetsState);
|
||||||
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
const { isVisible = false, activate = null, deactivate = null } = useSharedVisibility();
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
@ -1,19 +1,19 @@
|
|||||||
import { AdvancedMap, TradingAcceptComposer, TradingAcceptEvent, TradingCancelComposer, TradingCloseComposer, TradingCloseEvent, TradingCloseParser, TradingCompletedEvent, TradingConfirmationComposer, TradingConfirmationEvent, TradingListItemEvent, TradingListItemRemoveComposer, TradingNotOpenEvent, TradingOpenComposer, TradingOpenEvent, TradingOpenFailedEvent, TradingOpenFailedParser, TradingOtherNotAllowedEvent, TradingUnacceptComposer, TradingYouAreNotAllowedEvent } from '@nitrots/nitro-renderer';
|
import { AdvancedMap, TradingAcceptComposer, TradingAcceptEvent, TradingCancelComposer, TradingCloseComposer, TradingCloseEvent, TradingCloseParser, TradingCompletedEvent, TradingConfirmationComposer, TradingConfirmationEvent, TradingListItemEvent, TradingListItemRemoveComposer, TradingNotOpenEvent, TradingOpenComposer, TradingOpenEvent, TradingOpenFailedEvent, TradingOpenFailedParser, TradingOtherNotAllowedEvent, TradingUnacceptComposer, TradingYouAreNotAllowedEvent } from '@nitrots/nitro-renderer';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { useSharedInventoryFurni } from '.';
|
import { useInventoryFurni } from '.';
|
||||||
import { BatchUpdates, UseMessageEventHook } from '..';
|
import { BatchUpdates, UseMessageEventHook } from '..';
|
||||||
import { CloneObject, GetRoomSession, GetSessionDataManager, GroupItem, LocalizeText, NotificationUtilities, SendMessageComposer, TradeState, TradeUserData, TradingNotificationMessage, TradingNotificationType } from '../../api';
|
import { CloneObject, GetRoomSession, GetSessionDataManager, GroupItem, LocalizeText, NotificationUtilities, SendMessageComposer, TradeState, TradeUserData, TradingNotificationMessage, TradingNotificationType } from '../../api';
|
||||||
import { InventoryTradeRequestEvent } from '../../events';
|
import { InventoryTradeRequestEvent } from '../../events';
|
||||||
import { UseUiEvent } from '../events';
|
import { UseUiEvent } from '../events';
|
||||||
import { parseTradeItems } from './common';
|
import { parseTradeItems } from './common';
|
||||||
|
|
||||||
const useInventoryTrade = () =>
|
const useInventoryTradeState = () =>
|
||||||
{
|
{
|
||||||
const [ ownUser, setOwnUser ] = useState<TradeUserData>(null);
|
const [ ownUser, setOwnUser ] = useState<TradeUserData>(null);
|
||||||
const [ otherUser, setOtherUser ] = useState<TradeUserData>(null);
|
const [ otherUser, setOtherUser ] = useState<TradeUserData>(null);
|
||||||
const [ tradeState, setTradeState ] = useState(TradeState.TRADING_STATE_READY);
|
const [ tradeState, setTradeState ] = useState(TradeState.TRADING_STATE_READY);
|
||||||
const { groupItems = [], setGroupItems = null } = useSharedInventoryFurni();
|
const { groupItems = [], setGroupItems = null } = useInventoryFurni();
|
||||||
const isTrading = (tradeState >= TradeState.TRADING_STATE_RUNNING);
|
const isTrading = (tradeState >= TradeState.TRADING_STATE_RUNNING);
|
||||||
|
|
||||||
const progressTrade = () =>
|
const progressTrade = () =>
|
||||||
@ -322,4 +322,4 @@ const useInventoryTrade = () =>
|
|||||||
return { ownUser, otherUser, tradeState, setTradeState, isTrading, groupItems, progressTrade, removeItem, stopTrading };
|
return { ownUser, otherUser, tradeState, setTradeState, isTrading, groupItems, progressTrade, removeItem, stopTrading };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryTrade = () => useBetween(useInventoryTrade);
|
export const useInventoryTrade = () => useBetween(useInventoryTradeState);
|
@ -7,7 +7,7 @@ import { SendMessageComposer } from '../../api';
|
|||||||
const sendResetCategoryMessage = (category: number) => SendMessageComposer(new UnseenResetCategoryComposer(category));
|
const sendResetCategoryMessage = (category: number) => SendMessageComposer(new UnseenResetCategoryComposer(category));
|
||||||
const sendResetItemsMessage = (category: number, itemIds: number[]) => SendMessageComposer(new UnseenResetItemsComposer(category, ...itemIds));
|
const sendResetItemsMessage = (category: number, itemIds: number[]) => SendMessageComposer(new UnseenResetItemsComposer(category, ...itemIds));
|
||||||
|
|
||||||
const useInventoryUnseenTracker = () =>
|
const useInventoryUnseenTrackerState = () =>
|
||||||
{
|
{
|
||||||
const [ unseenItems, setUnseenItems ] = useState<Map<number, number[]>>(new Map());
|
const [ unseenItems, setUnseenItems ] = useState<Map<number, number[]>>(new Map());
|
||||||
const getIds = (category: number) => unseenItems.get(category);
|
const getIds = (category: number) => unseenItems.get(category);
|
||||||
@ -138,4 +138,4 @@ const useInventoryUnseenTracker = () =>
|
|||||||
return { getIds, getCount, getFullCount, resetCategory, resetCategoryIfEmpty, resetItems, isUnseen, removeUnseen };
|
return { getIds, getCount, getFullCount, resetCategory, resetCategoryIfEmpty, resetItems, isUnseen, removeUnseen };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedInventoryUnseenTracker = () => useBetween(useInventoryUnseenTracker);
|
export const useInventoryUnseenTracker = () => useBetween(useInventoryUnseenTrackerState);
|
Loading…
Reference in New Issue
Block a user