diff --git a/src/api/index.ts b/src/api/index.ts index cba6bb8c..9ec673e9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,4 +1,5 @@ export * from './achievements'; +export * from './campaign'; export * from './common'; export * from './core'; export * from './friends'; @@ -18,3 +19,4 @@ export * from './nitro/session'; export * from './notification'; export * from './user'; export * from './utils'; +export * from './wired'; diff --git a/src/components/wired/common/GetWiredTimeLocale.ts b/src/api/wired/GetWiredTimeLocale.ts similarity index 100% rename from src/components/wired/common/GetWiredTimeLocale.ts rename to src/api/wired/GetWiredTimeLocale.ts diff --git a/src/components/wired/common/WiredActionLayoutCode.ts b/src/api/wired/WiredActionLayoutCode.ts similarity index 100% rename from src/components/wired/common/WiredActionLayoutCode.ts rename to src/api/wired/WiredActionLayoutCode.ts diff --git a/src/components/wired/common/WiredConditionLayoutCode.ts b/src/api/wired/WiredConditionLayoutCode.ts similarity index 100% rename from src/components/wired/common/WiredConditionLayoutCode.ts rename to src/api/wired/WiredConditionLayoutCode.ts diff --git a/src/api/wired/WiredDateToString.ts b/src/api/wired/WiredDateToString.ts new file mode 100644 index 00000000..c1b496b4 --- /dev/null +++ b/src/api/wired/WiredDateToString.ts @@ -0,0 +1 @@ +export const WiredDateToString = (date: Date) => `${ date.getFullYear() }/${ ('0' + (date.getMonth() + 1)).slice(-2) }/${ ('0' + date.getDate()).slice(-2) }${ ('0' + date.getHours()).slice(-2) }:${ ('0' + date.getMinutes()).slice(-2) }`; diff --git a/src/components/wired/common/WiredFurniType.ts b/src/api/wired/WiredFurniType.ts similarity index 100% rename from src/components/wired/common/WiredFurniType.ts rename to src/api/wired/WiredFurniType.ts diff --git a/src/components/wired/common/WiredSelectionFilter.ts b/src/api/wired/WiredSelectionFilter.ts similarity index 100% rename from src/components/wired/common/WiredSelectionFilter.ts rename to src/api/wired/WiredSelectionFilter.ts diff --git a/src/components/wired/common/WiredSelectionVisualizer.ts b/src/api/wired/WiredSelectionVisualizer.ts similarity index 95% rename from src/components/wired/common/WiredSelectionVisualizer.ts rename to src/api/wired/WiredSelectionVisualizer.ts index 527a246c..7f5c3328 100644 --- a/src/components/wired/common/WiredSelectionVisualizer.ts +++ b/src/api/wired/WiredSelectionVisualizer.ts @@ -1,6 +1,6 @@ import { IRoomObject, IRoomObjectSpriteVisualization, NitroFilter, RoomObjectCategory } from '@nitrots/nitro-renderer'; -import { GetRoomEngine } from '../../../api'; -import { WiredSelectionFilter } from './WiredSelectionFilter'; +import { WiredSelectionFilter } from '.'; +import { GetRoomEngine } from '..'; export class WiredSelectionVisualizer { diff --git a/src/components/wired/common/WiredStringDelimeter.ts b/src/api/wired/WiredStringDelimeter.ts similarity index 100% rename from src/components/wired/common/WiredStringDelimeter.ts rename to src/api/wired/WiredStringDelimeter.ts diff --git a/src/components/wired/common/WiredTriggerLayoutCode.ts b/src/api/wired/WiredTriggerLayoutCode.ts similarity index 100% rename from src/components/wired/common/WiredTriggerLayoutCode.ts rename to src/api/wired/WiredTriggerLayoutCode.ts diff --git a/src/api/wired/index.ts b/src/api/wired/index.ts new file mode 100644 index 00000000..e8558813 --- /dev/null +++ b/src/api/wired/index.ts @@ -0,0 +1,9 @@ +export * from './GetWiredTimeLocale'; +export * from './WiredActionLayoutCode'; +export * from './WiredConditionLayoutCode'; +export * from './WiredDateToString'; +export * from './WiredFurniType'; +export * from './WiredSelectionFilter'; +export * from './WiredSelectionVisualizer'; +export * from './WiredStringDelimeter'; +export * from './WiredTriggerLayoutCode'; diff --git a/src/components/wired/context/WiredContext.tsx b/src/components/wired/WiredContext.tsx similarity index 93% rename from src/components/wired/context/WiredContext.tsx rename to src/components/wired/WiredContext.tsx index d2046048..f0e3bc45 100644 --- a/src/components/wired/context/WiredContext.tsx +++ b/src/components/wired/WiredContext.tsx @@ -13,6 +13,7 @@ export interface IWiredContext setFurniIds: Dispatch>; actionDelay: number; setActionDelay: Dispatch>; + saveWired: () => void; } const WiredContext = createContext({ @@ -25,7 +26,8 @@ const WiredContext = createContext({ furniIds: null, setFurniIds: null, actionDelay: null, - setActionDelay: null + setActionDelay: null, + saveWired: null }); export const WiredContextProvider: FC> = props => diff --git a/src/components/wired/WiredMessageHandler.tsx b/src/components/wired/WiredMessageHandler.tsx index daa4c10f..de5371d1 100644 --- a/src/components/wired/WiredMessageHandler.tsx +++ b/src/components/wired/WiredMessageHandler.tsx @@ -2,7 +2,7 @@ import { WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent import { FC, useCallback } from 'react'; import { LocalizeText, NotificationAlertType, NotificationUtilities } from '../../api'; import { UseMessageEventHook } from '../../hooks/messages'; -import { useWiredContext } from './context/WiredContext'; +import { useWiredContext } from './WiredContext'; export const WiredMessageHandler: FC<{}> = props => { diff --git a/src/components/wired/WiredView.tsx b/src/components/wired/WiredView.tsx index c81a7643..fded27dc 100644 --- a/src/components/wired/WiredView.tsx +++ b/src/components/wired/WiredView.tsx @@ -1,10 +1,8 @@ import { ConditionDefinition, Triggerable, TriggerDefinition, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateTriggerMessageComposer, WiredActionDefinition } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useMemo, useState } from 'react'; -import { IsOwnerOfFloorFurniture, SendMessageComposer } from '../../api'; -import { WiredEvent } from '../../events'; -import { UseUiEvent } from '../../hooks'; +import { FC, useState } from 'react'; +import { IsOwnerOfFloorFurniture, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../api'; import { GetWiredLayout } from './common/GetWiredLayout'; -import { WiredContextProvider } from './context/WiredContext'; +import { WiredContextProvider } from './WiredContext'; import { WiredMessageHandler } from './WiredMessageHandler'; export const WiredView: FC<{}> = props => @@ -15,40 +13,46 @@ export const WiredView: FC<{}> = props => const [ furniIds, setFurniIds ] = useState([]); const [ actionDelay, setActionDelay ] = useState(null); - const wiredLayout = useMemo(() => + const saveWired = () => { - return GetWiredLayout(trigger); - }, [ trigger ]); + const save = (trigger: Triggerable) => + { + if(!trigger) return; + + if(trigger instanceof WiredActionDefinition) + { + SendMessageComposer(new UpdateActionMessageComposer(trigger.id, intParams, stringParam, furniIds, actionDelay, trigger.stuffTypeSelectionCode)); + } + + else if(trigger instanceof TriggerDefinition) + { + SendMessageComposer(new UpdateTriggerMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode)); + } + + else if(trigger instanceof ConditionDefinition) + { + SendMessageComposer(new UpdateConditionMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode)); + } + } - const onWiredEvent = useCallback((event: WiredEvent) => - { if(!IsOwnerOfFloorFurniture(trigger.id)) { - + NotificationUtilities.confirm(LocalizeText('wiredfurni.nonowner.change.confirm.body'), () => + { + save(trigger) + }, null, null, null, LocalizeText('wiredfurni.nonowner.change.confirm.title')); } - - if(trigger instanceof WiredActionDefinition) + else { - SendMessageComposer(new UpdateActionMessageComposer(trigger.id, intParams, stringParam, furniIds, actionDelay, trigger.stuffTypeSelectionCode)); + save(trigger); } - - else if(trigger instanceof TriggerDefinition) - { - SendMessageComposer(new UpdateTriggerMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode)); - } - - else if(trigger instanceof ConditionDefinition) - { - SendMessageComposer(new UpdateConditionMessageComposer(trigger.id, intParams, stringParam, furniIds, trigger.stuffTypeSelectionCode)); - } - }, [ trigger, intParams, stringParam, furniIds, actionDelay ]); - - UseUiEvent(WiredEvent.SAVE_WIRED, onWiredEvent); + } return ( - + - { wiredLayout } + { (trigger !== null) && + GetWiredLayout(trigger) } ); }; diff --git a/src/components/wired/common/GetWiredActionLayout.tsx b/src/components/wired/common/GetWiredActionLayout.tsx index a5072141..a5fc49e9 100644 --- a/src/components/wired/common/GetWiredActionLayout.tsx +++ b/src/components/wired/common/GetWiredActionLayout.tsx @@ -1,3 +1,4 @@ +import { WiredActionLayout } from '../../../api'; import { WiredActionBotChangeFigureView } from '../views/actions/WiredActionBotChangeFigureView'; import { WiredActionBotFollowAvatarView } from '../views/actions/WiredActionBotFollowAvatarView'; import { WiredActionBotGiveHandItemView } from '../views/actions/WiredActionBotGiveHandItemView'; @@ -23,7 +24,6 @@ import { WiredActionResetView } from '../views/actions/WiredActionResetView'; import { WiredActionSetFurniStateToView } from '../views/actions/WiredActionSetFurniStateToView'; import { WiredActionTeleportView } from '../views/actions/WiredActionTeleportView'; import { WiredActionToggleFurniStateView } from '../views/actions/WiredActionToggleFurniStateView'; -import { WiredActionLayout } from './WiredActionLayoutCode'; export const GetWiredActionLayout = (code: number) => { diff --git a/src/components/wired/common/GetWiredConditionLayout.tsx b/src/components/wired/common/GetWiredConditionLayout.tsx index 71dcd62c..4ea22f77 100644 --- a/src/components/wired/common/GetWiredConditionLayout.tsx +++ b/src/components/wired/common/GetWiredConditionLayout.tsx @@ -1,3 +1,4 @@ +import { WiredConditionlayout } from '../../../api'; import { WiredConditionActorHasHandItemView } from '../views/conditions/WiredConditionActorHasHandItem'; import { WiredConditionActorIsGroupMemberView } from '../views/conditions/WiredConditionActorIsGroupMemberView'; import { WiredConditionActorIsOnFurniView } from '../views/conditions/WiredConditionActorIsOnFurniView'; @@ -13,7 +14,6 @@ import { WiredConditionFurniMatchesSnapshotView } from '../views/conditions/Wire import { WiredConditionTimeElapsedLessView } from '../views/conditions/WiredConditionTimeElapsedLessView'; import { WiredConditionTimeElapsedMoreView } from '../views/conditions/WiredConditionTimeElapsedMoreView'; import { WiredConditionUserCountInRoomView } from '../views/conditions/WiredConditionUserCountInRoomView'; -import { WiredConditionlayout } from './WiredConditionLayoutCode'; export const GetWiredConditionLayout = (code: number) => { diff --git a/src/components/wired/common/GetWiredTriggerLayout.tsx b/src/components/wired/common/GetWiredTriggerLayout.tsx index c6c9b452..4e6d2fa2 100644 --- a/src/components/wired/common/GetWiredTriggerLayout.tsx +++ b/src/components/wired/common/GetWiredTriggerLayout.tsx @@ -1,3 +1,4 @@ +import { WiredTriggerLayout } from '../../../api'; import { WiredTriggerAvatarEnterRoomView } from '../views/triggers/WiredTriggerAvatarEnterRoomView'; import { WiredTriggerAvatarSaysSomethingView } from '../views/triggers/WiredTriggerAvatarSaysSomethingView'; import { WiredTriggerAvatarWalksOffFurniView } from '../views/triggers/WiredTriggerAvatarWalksOffFurniView'; @@ -12,7 +13,6 @@ import { WiredTriggerGameEndsView } from '../views/triggers/WiredTriggerGameEnds import { WiredTriggerGameStartsView } from '../views/triggers/WiredTriggerGameStartsView'; import { WiredTriggeScoreAchievedView } from '../views/triggers/WiredTriggerScoreAchievedView'; import { WiredTriggerToggleFurniView } from '../views/triggers/WiredTriggerToggleFurniView'; -import { WiredTriggerLayout } from './WiredTriggerLayoutCode'; export const GetWiredTriggerLayout = (code: number) => { diff --git a/src/components/wired/views/WiredBaseView.tsx b/src/components/wired/views/WiredBaseView.tsx index a40efe38..fd862e89 100644 --- a/src/components/wired/views/WiredBaseView.tsx +++ b/src/components/wired/views/WiredBaseView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { GetSessionDataManager, LocalizeText } from '../../../api'; +import { FC, useEffect, useState } from 'react'; +import { GetSessionDataManager, LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../api'; import { Button, Column, Flex, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common'; -import { WiredEvent } from '../../../events'; -import { BatchUpdates, DispatchUiEvent } from '../../../hooks'; -import { WiredFurniType } from '../common/WiredFurniType'; -import { WiredSelectionVisualizer } from '../common/WiredSelectionVisualizer'; -import { useWiredContext } from '../context/WiredContext'; +import { BatchUpdates } from '../../../hooks'; +import { useWiredContext } from '../WiredContext'; import { WiredFurniSelectorView } from './WiredFurniSelectorView'; export interface WiredBaseViewProps @@ -22,21 +19,21 @@ export const WiredBaseView: FC = props => const { wiredType = '', requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, validate = null, children = null, hasSpecialInput = false } = props; const [ wiredName, setWiredName ] = useState(null); const [ wiredDescription, setWiredDescription ] = useState(null); - const { trigger = null, setTrigger = null, setIntParams = null, setStringParam = null, setFurniIds = null } = useWiredContext(); + const { trigger = null, setTrigger = null, setIntParams = null, setStringParam = null, setFurniIds = null, saveWired = null } = useWiredContext(); - const onSave = useCallback(() => + const onSave = () => { if(validate && !validate()) return; if(save) save(); - setTimeout(() => DispatchUiEvent(new WiredEvent(WiredEvent.SAVE_WIRED)), 1); - }, [ save, validate ]); + saveWired(); + } - const close = useCallback(() => + const close = () => { setTrigger(null); - }, [ setTrigger ]); + } useEffect(() => { @@ -81,7 +78,22 @@ export const WiredBaseView: FC = props => }); } }); - }, [trigger, setIntParams, setStringParam, setFurniIds, hasSpecialInput, requiresFurni]); + + return () => + { + BatchUpdates(() => + { + setIntParams([]); + setStringParam(null); + setFurniIds(prevValue => + { + if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue); + + return []; + }); + }); + } + }, [ trigger, hasSpecialInput, requiresFurni, setIntParams, setStringParam, setFurniIds ]); return ( diff --git a/src/components/wired/views/WiredFurniSelectorView.tsx b/src/components/wired/views/WiredFurniSelectorView.tsx index 616261a2..8847ab30 100644 --- a/src/components/wired/views/WiredFurniSelectorView.tsx +++ b/src/components/wired/views/WiredFurniSelectorView.tsx @@ -1,10 +1,9 @@ -import { FC, useCallback, useEffect } from 'react'; -import { LocalizeText } from '../../../api'; +import { FC, useCallback } from 'react'; +import { LocalizeText, WiredSelectionVisualizer } from '../../../api'; import { Column, Text } from '../../../common'; import { WiredSelectObjectEvent } from '../../../events'; import { UseUiEvent } from '../../../hooks'; -import { WiredSelectionVisualizer } from '../common/WiredSelectionVisualizer'; -import { useWiredContext } from '../context/WiredContext'; +import { useWiredContext } from '../WiredContext'; export const WiredFurniSelectorView: FC<{}> = props => { @@ -14,13 +13,11 @@ export const WiredFurniSelectorView: FC<{}> = props => { const furniId = event.objectId; - if(furniId === -1) return; - - let newFurniIds: number[] = null; + if(furniId <= 0) return; setFurniIds(prevValue => { - newFurniIds = [ ...prevValue ]; + const newFurniIds = [ ...prevValue ]; const index = prevValue.indexOf(furniId); @@ -30,14 +27,12 @@ export const WiredFurniSelectorView: FC<{}> = props => WiredSelectionVisualizer.hide(furniId); } - else - { - if(newFurniIds.length < trigger.maximumItemSelectionCount) - { - newFurniIds.push(furniId); - WiredSelectionVisualizer.show(furniId); - } + else if(newFurniIds.length < trigger.maximumItemSelectionCount) + { + newFurniIds.push(furniId); + + WiredSelectionVisualizer.show(furniId); } return newFurniIds; @@ -45,35 +40,6 @@ export const WiredFurniSelectorView: FC<{}> = props => }, [ trigger, setFurniIds ]); UseUiEvent(WiredSelectObjectEvent.SELECT_OBJECT, onWiredSelectObjectEvent); - - useEffect(() => - { - if(!trigger) return; - - setFurniIds(prevValue => - { - if(prevValue && prevValue.length) WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue); - - if(trigger.selectedItems && trigger.selectedItems.length) - { - WiredSelectionVisualizer.applySelectionShaderToFurni(trigger.selectedItems); - - return trigger.selectedItems; - } - - return []; - }); - - return () => - { - setFurniIds(prevValue => - { - WiredSelectionVisualizer.clearSelectionShaderFromFurni(prevValue); - - return []; - }); - } - }, [ trigger, setFurniIds ]); return ( diff --git a/src/components/wired/views/actions/WiredActionBaseView.tsx b/src/components/wired/views/actions/WiredActionBaseView.tsx index f3904428..78f389fe 100644 --- a/src/components/wired/views/actions/WiredActionBaseView.tsx +++ b/src/components/wired/views/actions/WiredActionBaseView.tsx @@ -1,12 +1,9 @@ import { WiredActionDefinition } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredBaseView } from '../WiredBaseView'; export interface WiredActionBaseViewProps diff --git a/src/components/wired/views/actions/WiredActionBotChangeFigureView.tsx b/src/components/wired/views/actions/WiredActionBotChangeFigureView.tsx index 22c4f489..30ff3cd1 100644 --- a/src/components/wired/views/actions/WiredActionBotChangeFigureView.tsx +++ b/src/components/wired/views/actions/WiredActionBotChangeFigureView.tsx @@ -1,10 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { GetSessionDataManager, LocalizeText } from '../../../../api'; +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 { WiredFurniType } from '../../common/WiredFurniType'; -import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; const DEFAULT_FIGURE: string = 'hd-180-1.ch-210-66.lg-270-82.sh-290-81'; @@ -15,15 +13,7 @@ export const WiredActionBotChangeFigureView: FC<{}> = props => const [ figure, setFigure ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const copyLooks = useCallback(() => - { - setFigure(GetSessionDataManager().figure); - }, []); - - const save = useCallback(() => - { - setStringParam((botName + WIRED_STRING_DELIMETER + figure)); - }, [ botName, figure, setStringParam ]); + const save = () => setStringParam((botName + WIRED_STRING_DELIMETER + figure)); useEffect(() => { @@ -44,7 +34,7 @@ export const WiredActionBotChangeFigureView: FC<{}> = props => - + ); diff --git a/src/components/wired/views/actions/WiredActionBotFollowAvatarView.tsx b/src/components/wired/views/actions/WiredActionBotFollowAvatarView.tsx index 169be528..cdf8e6d9 100644 --- a/src/components/wired/views/actions/WiredActionBotFollowAvatarView.tsx +++ b/src/components/wired/views/actions/WiredActionBotFollowAvatarView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionBotFollowAvatarView: FC<{}> = props => @@ -14,14 +11,14 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props => const [ followMode, setFollowMode ] = useState(-1); const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setStringParam(botName); - setIntParams([followMode]); + setIntParams([ followMode ]); }); - }, [ followMode, botName, setStringParam, setIntParams ]); + } useEffect(() => { @@ -35,7 +32,7 @@ export const WiredActionBotFollowAvatarView: FC<{}> = props => return ( - + { LocalizeText('wiredfurni.params.bot.name') } setBotName(event.target.value) } /> diff --git a/src/components/wired/views/actions/WiredActionBotGiveHandItemView.tsx b/src/components/wired/views/actions/WiredActionBotGiveHandItemView.tsx index 82f942a1..a4006f69 100644 --- a/src/components/wired/views/actions/WiredActionBotGiveHandItemView.tsx +++ b/src/components/wired/views/actions/WiredActionBotGiveHandItemView.tsx @@ -1,10 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; const ALLOWED_HAND_ITEM_IDS: number[] = [ 2, 5, 7, 8, 9, 10, 27 ]; @@ -15,14 +13,14 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props => const [ handItemId, setHandItemId ] = useState(-1); const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setStringParam(botName); setIntParams([ handItemId ]); }); - }, [ handItemId, botName, setStringParam, setIntParams ]); + } useEffect(() => { @@ -43,10 +41,7 @@ export const WiredActionBotGiveHandItemView: FC<{}> = props => { LocalizeText('wiredfurni.params.handitem') } diff --git a/src/components/wired/views/actions/WiredActionBotMoveView.tsx b/src/components/wired/views/actions/WiredActionBotMoveView.tsx index 6c4ec9e4..414047c2 100644 --- a/src/components/wired/views/actions/WiredActionBotMoveView.tsx +++ b/src/components/wired/views/actions/WiredActionBotMoveView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionBotMoveView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredActionBotMoveView: FC<{}> = props => const [ botName, setBotName ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(botName); - }, [ botName, setStringParam ]); + const save = () => setStringParam(botName); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionBotTalkToAvatarView.tsx b/src/components/wired/views/actions/WiredActionBotTalkToAvatarView.tsx index 69182854..c41cc4ac 100644 --- a/src/components/wired/views/actions/WiredActionBotTalkToAvatarView.tsx +++ b/src/components/wired/views/actions/WiredActionBotTalkToAvatarView.tsx @@ -1,12 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +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 { WiredFurniType } from '../../common/WiredFurniType'; -import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionBotTalkToAvatarView: FC<{}> = props => @@ -16,14 +12,14 @@ export const WiredActionBotTalkToAvatarView: FC<{}> = props => const [ talkMode, setTalkMode ] = useState(-1); const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setStringParam(botName + WIRED_STRING_DELIMETER + message); setIntParams([ talkMode ]); }); - }, [ botName, message, talkMode, setStringParam, setIntParams ]); + } useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionBotTalkView.tsx b/src/components/wired/views/actions/WiredActionBotTalkView.tsx index b83a0bdc..20fc9cac 100644 --- a/src/components/wired/views/actions/WiredActionBotTalkView.tsx +++ b/src/components/wired/views/actions/WiredActionBotTalkView.tsx @@ -1,12 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +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 { WiredFurniType } from '../../common/WiredFurniType'; -import { WIRED_STRING_DELIMETER } from '../../common/WiredStringDelimeter'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionBotTalkView: FC<{}> = props => @@ -16,14 +12,14 @@ export const WiredActionBotTalkView: FC<{}> = props => const [ talkMode, setTalkMode ] = useState(-1); const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setStringParam(botName + WIRED_STRING_DELIMETER + message); setIntParams([ talkMode ]); }); - }, [ botName, message, talkMode, setStringParam, setIntParams ]); + } useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionBotTeleportView.tsx b/src/components/wired/views/actions/WiredActionBotTeleportView.tsx index 3db5a25e..a77c514f 100644 --- a/src/components/wired/views/actions/WiredActionBotTeleportView.tsx +++ b/src/components/wired/views/actions/WiredActionBotTeleportView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionBotTeleportView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredActionBotTeleportView: FC<{}> = props => const [ botName, setBotName ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(botName); - }, [ botName, setStringParam ]); + const save = () => setStringParam(botName); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionCallAnotherStackView.tsx b/src/components/wired/views/actions/WiredActionCallAnotherStackView.tsx index e254e6c9..ee6d5476 100644 --- a/src/components/wired/views/actions/WiredActionCallAnotherStackView.tsx +++ b/src/components/wired/views/actions/WiredActionCallAnotherStackView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionCallAnotherStackView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionChaseView.tsx b/src/components/wired/views/actions/WiredActionChaseView.tsx index 943a35b6..c4945038 100644 --- a/src/components/wired/views/actions/WiredActionChaseView.tsx +++ b/src/components/wired/views/actions/WiredActionChaseView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionChaseView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionChatView.tsx b/src/components/wired/views/actions/WiredActionChatView.tsx index 296b8328..cea1c02a 100644 --- a/src/components/wired/views/actions/WiredActionChatView.tsx +++ b/src/components/wired/views/actions/WiredActionChatView.tsx @@ -1,9 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; import { Column } from '../../../../common/Column'; import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionChatView: FC<{}> = props => @@ -11,10 +10,7 @@ export const WiredActionChatView: FC<{}> = props => const [ message, setMessage ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(message); - }, [ message, setStringParam ]); + const save = () => setStringParam(message); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionFleeView.tsx b/src/components/wired/views/actions/WiredActionFleeView.tsx index 478771b6..a80ab434 100644 --- a/src/components/wired/views/actions/WiredActionFleeView.tsx +++ b/src/components/wired/views/actions/WiredActionFleeView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionFleeView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionGiveRewardView.tsx b/src/components/wired/views/actions/WiredActionGiveRewardView.tsx index 075312d1..347abe9f 100644 --- a/src/components/wired/views/actions/WiredActionGiveRewardView.tsx +++ b/src/components/wired/views/actions/WiredActionGiveRewardView.tsx @@ -1,14 +1,13 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FC, useCallback, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; +import { LocalizeText, WiredFurniType } from '../../../../api'; 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 { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionGiveRewardView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionGiveScoreToPredefinedTeamView.tsx b/src/components/wired/views/actions/WiredActionGiveScoreToPredefinedTeamView.tsx index 8e99a8f2..1213d357 100644 --- a/src/components/wired/views/actions/WiredActionGiveScoreToPredefinedTeamView.tsx +++ b/src/components/wired/views/actions/WiredActionGiveScoreToPredefinedTeamView.tsx @@ -1,12 +1,9 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionGiveScoreToPredefinedTeamView: FC<{}> = props => @@ -16,10 +13,7 @@ export const WiredActionGiveScoreToPredefinedTeamView: FC<{}> = props => const [ selectedTeam, setSelectedTeam ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ points, time, selectedTeam ]); - }, [ points, time, selectedTeam, setIntParams ]); + const save = () => setIntParams([ points, time, selectedTeam ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionGiveScoreView.tsx b/src/components/wired/views/actions/WiredActionGiveScoreView.tsx index 22f338aa..7c41011d 100644 --- a/src/components/wired/views/actions/WiredActionGiveScoreView.tsx +++ b/src/components/wired/views/actions/WiredActionGiveScoreView.tsx @@ -1,11 +1,9 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionGiveScoreView: FC<{}> = props => @@ -14,10 +12,7 @@ export const WiredActionGiveScoreView: FC<{}> = props => const [ time, setTime ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ points, time ]); - }, [ points, time, setIntParams ]); + const save = () => setIntParams([ points, time ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionJoinTeamView.tsx b/src/components/wired/views/actions/WiredActionJoinTeamView.tsx index 48c1221e..197fc162 100644 --- a/src/components/wired/views/actions/WiredActionJoinTeamView.tsx +++ b/src/components/wired/views/actions/WiredActionJoinTeamView.tsx @@ -1,10 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionJoinTeamView: FC<{}> = props => @@ -12,10 +9,7 @@ export const WiredActionJoinTeamView: FC<{}> = props => const [ selectedTeam, setSelectedTeam ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ selectedTeam ]); - }, [ selectedTeam, setIntParams ]); + const save = () => setIntParams([ selectedTeam ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionKickFromRoomView.tsx b/src/components/wired/views/actions/WiredActionKickFromRoomView.tsx index 0c35e45b..81d03160 100644 --- a/src/components/wired/views/actions/WiredActionKickFromRoomView.tsx +++ b/src/components/wired/views/actions/WiredActionKickFromRoomView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionKickFromRoomView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredActionKickFromRoomView: FC<{}> = props => const [ message, setMessage ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(message); - }, [ message, setStringParam ]); + const save = () => setStringParam(message); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionLeaveTeamView.tsx b/src/components/wired/views/actions/WiredActionLeaveTeamView.tsx index f9c094c8..eaa834ff 100644 --- a/src/components/wired/views/actions/WiredActionLeaveTeamView.tsx +++ b/src/components/wired/views/actions/WiredActionLeaveTeamView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionLeaveTeamView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionMoveAndRotateFurniView.tsx b/src/components/wired/views/actions/WiredActionMoveAndRotateFurniView.tsx index e9002466..8f33d2a3 100644 --- a/src/components/wired/views/actions/WiredActionMoveAndRotateFurniView.tsx +++ b/src/components/wired/views/actions/WiredActionMoveAndRotateFurniView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; const directionOptions: { value: number, icon: string }[] = [ @@ -35,10 +32,7 @@ export const WiredActionMoveAndRotateFurniView: FC<{}> = props => const [ rotation, setRotation ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ movement, rotation ]); - }, [ movement, rotation, setIntParams ]); + const save = () => setIntParams([ movement, rotation ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionMoveFurniToView.tsx b/src/components/wired/views/actions/WiredActionMoveFurniToView.tsx index 5d9d413c..7dfc5dc4 100644 --- a/src/components/wired/views/actions/WiredActionMoveFurniToView.tsx +++ b/src/components/wired/views/actions/WiredActionMoveFurniToView.tsx @@ -1,12 +1,9 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; const directionOptions: { value: number, icon: string }[] = [ @@ -34,10 +31,7 @@ export const WiredActionMoveFurniToView: FC<{}> = props => const [ movement, setMovement ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ movement, spacing ]); - }, [ movement, spacing, setIntParams ]); + const save = () => setIntParams([ movement, spacing ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionMoveFurniView.tsx b/src/components/wired/views/actions/WiredActionMoveFurniView.tsx index 2c24d371..7d221fb4 100644 --- a/src/components/wired/views/actions/WiredActionMoveFurniView.tsx +++ b/src/components/wired/views/actions/WiredActionMoveFurniView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; const directionOptions: { value: number, icon: string }[] = [ @@ -47,10 +44,7 @@ export const WiredActionMoveFurniView: FC<{}> = props => const [ rotation, setRotation ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ movement, rotation ]); - }, [ movement, rotation, setIntParams ]); + const save = () => setIntParams([ movement, rotation ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionMuteUserView.tsx b/src/components/wired/views/actions/WiredActionMuteUserView.tsx index c01db914..9ac241a8 100644 --- a/src/components/wired/views/actions/WiredActionMuteUserView.tsx +++ b/src/components/wired/views/actions/WiredActionMuteUserView.tsx @@ -1,11 +1,9 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionMuteUserView: FC<{}> = props => @@ -14,14 +12,14 @@ export const WiredActionMuteUserView: FC<{}> = props => const [ message, setMessage ] = useState(''); const { trigger = null, setIntParams = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setIntParams([ time ]); setStringParam(message); }); - }, [ time, message, setIntParams, setStringParam ]); + } useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionResetView.tsx b/src/components/wired/views/actions/WiredActionResetView.tsx index ad095822..9245c673 100644 --- a/src/components/wired/views/actions/WiredActionResetView.tsx +++ b/src/components/wired/views/actions/WiredActionResetView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionResetView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx b/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx index d161a04c..8916de4a 100644 --- a/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx +++ b/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionSetFurniStateToView: FC<{}> = props => @@ -15,10 +12,7 @@ export const WiredActionSetFurniStateToView: FC<{}> = props => const [ positionFlag, setPositionFlag ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ stateFlag, directionFlag, positionFlag ]); - }, [ directionFlag, positionFlag, stateFlag, setIntParams ]); + const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]); useEffect(() => { diff --git a/src/components/wired/views/actions/WiredActionTeleportView.tsx b/src/components/wired/views/actions/WiredActionTeleportView.tsx index 0cd24c6f..652da616 100644 --- a/src/components/wired/views/actions/WiredActionTeleportView.tsx +++ b/src/components/wired/views/actions/WiredActionTeleportView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionTeleportView: FC<{}> = props => diff --git a/src/components/wired/views/actions/WiredActionToggleFurniStateView.tsx b/src/components/wired/views/actions/WiredActionToggleFurniStateView.tsx index 4bf8abd9..37b5d2e2 100644 --- a/src/components/wired/views/actions/WiredActionToggleFurniStateView.tsx +++ b/src/components/wired/views/actions/WiredActionToggleFurniStateView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionToggleFurniStateView: FC<{}> = props => diff --git a/src/components/wired/views/conditions/WiredConditionActorHasHandItem.tsx b/src/components/wired/views/conditions/WiredConditionActorHasHandItem.tsx index d0d00858..8272b690 100644 --- a/src/components/wired/views/conditions/WiredConditionActorHasHandItem.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorHasHandItem.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; const ALLOWED_HAND_ITEM_IDS: number[] = [ 2, 5, 7, 8, 9, 10, 27 ]; @@ -13,10 +11,7 @@ export const WiredConditionActorHasHandItemView: FC<{}> = props => const [ handItemId, setHandItemId ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ handItemId ]); - }, [ handItemId, setIntParams ]); + const save = () => setIntParams([ handItemId ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionActorIsGroupMemberView.tsx b/src/components/wired/views/conditions/WiredConditionActorIsGroupMemberView.tsx index 1ba3ac5e..e278eabe 100644 --- a/src/components/wired/views/conditions/WiredConditionActorIsGroupMemberView.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorIsGroupMemberView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionActorIsGroupMemberView: FC<{}> = props => diff --git a/src/components/wired/views/conditions/WiredConditionActorIsOnFurniView.tsx b/src/components/wired/views/conditions/WiredConditionActorIsOnFurniView.tsx index cf1a49c5..10cddf56 100644 --- a/src/components/wired/views/conditions/WiredConditionActorIsOnFurniView.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorIsOnFurniView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionActorIsOnFurniView: FC<{}> = props => diff --git a/src/components/wired/views/conditions/WiredConditionActorIsTeamMemberView.tsx b/src/components/wired/views/conditions/WiredConditionActorIsTeamMemberView.tsx index 76e401fa..300858c3 100644 --- a/src/components/wired/views/conditions/WiredConditionActorIsTeamMemberView.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorIsTeamMemberView.tsx @@ -1,10 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; const teamIds: number[] = [ 1, 2, 3, 4 ]; @@ -14,10 +11,7 @@ export const WiredConditionActorIsTeamMemberView: FC<{}> = props => const [ selectedTeam, setSelectedTeam ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ selectedTeam ]); - }, [ selectedTeam, setIntParams ]); + const save = () => setIntParams([ selectedTeam ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionActorIsWearingBadgeView.tsx b/src/components/wired/views/conditions/WiredConditionActorIsWearingBadgeView.tsx index 975a2573..f06175d7 100644 --- a/src/components/wired/views/conditions/WiredConditionActorIsWearingBadgeView.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorIsWearingBadgeView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionActorIsWearingBadgeView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredConditionActorIsWearingBadgeView: FC<{}> = props => const [ badge, setBadge ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(badge); - }, [ badge, setStringParam ]); + const save = () => setStringParam(badge); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionActorIsWearingEffectView.tsx b/src/components/wired/views/conditions/WiredConditionActorIsWearingEffectView.tsx index 71c91893..f715d3cc 100644 --- a/src/components/wired/views/conditions/WiredConditionActorIsWearingEffectView.tsx +++ b/src/components/wired/views/conditions/WiredConditionActorIsWearingEffectView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionActorIsWearingEffectView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredConditionActorIsWearingEffectView: FC<{}> = props => const [ effect, setEffect ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ effect ]); - }, [ effect, setIntParams ]); + const save = () => setIntParams([ effect ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionBaseView.tsx b/src/components/wired/views/conditions/WiredConditionBaseView.tsx index ff984026..d4e73266 100644 --- a/src/components/wired/views/conditions/WiredConditionBaseView.tsx +++ b/src/components/wired/views/conditions/WiredConditionBaseView.tsx @@ -1,5 +1,5 @@ -import { FC, useCallback } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { FC } from 'react'; +import { WiredFurniType } from '../../../../api'; import { WiredBaseView } from '../WiredBaseView'; export interface WiredConditionBaseViewProps @@ -13,10 +13,7 @@ export const WiredConditionBaseView: FC = props => { const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null } = props; - const onSave = useCallback(() => - { - if(save) save(); - }, [ save ]); + const onSave = () => (save && save()); return ( diff --git a/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx b/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx index c1f843f1..a3b177cd 100644 --- a/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx +++ b/src/components/wired/views/conditions/WiredConditionDateRangeView.tsx @@ -1,10 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredDateToString, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionDateRangeView: FC<{}> = props => @@ -13,12 +11,7 @@ export const WiredConditionDateRangeView: FC<{}> = props => const [ endDate, setEndDate ] = useState(''); const { trigger = null, setIntParams = null } = useWiredContext(); - const dateToString = useCallback((date: Date) => - { - return `${date.getFullYear()}/${('0' + (date.getMonth() + 1)).slice(-2)}/${('0' + date.getDate()).slice(-2)}${('0' + date.getHours()).slice(-2)}:${('0' + date.getMinutes()).slice(-2)}`; - }, []); - - const save = useCallback(() => + const save = () => { let startDateMili = 0; let endDateMili = 0; @@ -33,7 +26,7 @@ export const WiredConditionDateRangeView: FC<{}> = props => } setIntParams([startDateMili, endDateMili]); - }, [ startDate, endDate, setIntParams ]); + } useEffect(() => { @@ -48,11 +41,11 @@ export const WiredConditionDateRangeView: FC<{}> = props => BatchUpdates(() => { - setStartDate(dateToString(startDate)); - setEndDate(dateToString(endDate)); + setStartDate(WiredDateToString(startDate)); + setEndDate(WiredDateToString(endDate)); }); } - }, [ trigger, dateToString ]); + }, [ trigger ]); return ( diff --git a/src/components/wired/views/conditions/WiredConditionFurniHasAvatarOnView.tsx b/src/components/wired/views/conditions/WiredConditionFurniHasAvatarOnView.tsx index 01912ec9..aa3ba141 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniHasAvatarOnView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniHasAvatarOnView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniHasAvatarOnView: FC<{}> = props => diff --git a/src/components/wired/views/conditions/WiredConditionFurniHasFurniOnView.tsx b/src/components/wired/views/conditions/WiredConditionFurniHasFurniOnView.tsx index c498cc00..3bc1e424 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniHasFurniOnView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniHasFurniOnView.tsx @@ -1,10 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniHasFurniOnView: FC<{}> = props => @@ -12,10 +9,7 @@ export const WiredConditionFurniHasFurniOnView: FC<{}> = props => const [ requireAll, setRequireAll ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ requireAll ]); - }, [ requireAll, setIntParams ]); + const save = () => setIntParams([ requireAll ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionFurniHasNotFurniOnView.tsx b/src/components/wired/views/conditions/WiredConditionFurniHasNotFurniOnView.tsx index b15be97c..6e4af909 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniHasNotFurniOnView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniHasNotFurniOnView.tsx @@ -1,10 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniHasNotFurniOnView: FC<{}> = props => @@ -12,10 +9,7 @@ export const WiredConditionFurniHasNotFurniOnView: FC<{}> = props => const [ requireAll, setRequireAll ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ requireAll ]); - }, [ requireAll, setIntParams ]); + const save = () => setIntParams([ requireAll ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionFurniIsOfTypeView.tsx b/src/components/wired/views/conditions/WiredConditionFurniIsOfTypeView.tsx index b8f8e3a5..2b0ddf4d 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniIsOfTypeView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniIsOfTypeView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniIsOfTypeView: FC<{}> = props => diff --git a/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx b/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx index 14ed53a3..74420669 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props => @@ -15,10 +12,7 @@ export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props => const [ positionFlag, setPositionFlag ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ stateFlag, directionFlag, positionFlag ]); - }, [ directionFlag, positionFlag, stateFlag, setIntParams ]); + const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionTimeElapsedLessView.tsx b/src/components/wired/views/conditions/WiredConditionTimeElapsedLessView.tsx index 085666b4..ab180b79 100644 --- a/src/components/wired/views/conditions/WiredConditionTimeElapsedLessView.tsx +++ b/src/components/wired/views/conditions/WiredConditionTimeElapsedLessView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionTimeElapsedLessView: FC<{}> = props => @@ -13,10 +10,7 @@ export const WiredConditionTimeElapsedLessView: FC<{}> = props => const [ time, setTime ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ time ]); - }, [ time, setIntParams ]); + const save = () => setIntParams([ time ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionTimeElapsedMoreView.tsx b/src/components/wired/views/conditions/WiredConditionTimeElapsedMoreView.tsx index fb1c459a..43e5559e 100644 --- a/src/components/wired/views/conditions/WiredConditionTimeElapsedMoreView.tsx +++ b/src/components/wired/views/conditions/WiredConditionTimeElapsedMoreView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionTimeElapsedMoreView: FC<{}> = props => @@ -13,10 +10,7 @@ export const WiredConditionTimeElapsedMoreView: FC<{}> = props => const [ time, setTime ] = useState(-1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ time ]); - }, [ time, setIntParams ]); + const save = () => setIntParams([ time ]); useEffect(() => { diff --git a/src/components/wired/views/conditions/WiredConditionUserCountInRoomView.tsx b/src/components/wired/views/conditions/WiredConditionUserCountInRoomView.tsx index 14da500f..1560fe42 100644 --- a/src/components/wired/views/conditions/WiredConditionUserCountInRoomView.tsx +++ b/src/components/wired/views/conditions/WiredConditionUserCountInRoomView.tsx @@ -1,11 +1,9 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionUserCountInRoomView: FC<{}> = props => @@ -14,10 +12,7 @@ export const WiredConditionUserCountInRoomView: FC<{}> = props => const [ max, setMax ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ min, max ]); - }, [ min, max, setIntParams ]); + const save = () => setIntParams([ min, max ]); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerAvatarEnterRoomView.tsx b/src/components/wired/views/triggers/WiredTriggerAvatarEnterRoomView.tsx index 3fca00ea..00ac2982 100644 --- a/src/components/wired/views/triggers/WiredTriggerAvatarEnterRoomView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerAvatarEnterRoomView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerAvatarEnterRoomView: FC<{}> = props => @@ -14,11 +11,7 @@ export const WiredTriggerAvatarEnterRoomView: FC<{}> = props => const [ avatarMode, setAvatarMode ] = useState(0); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - if(avatarMode === 1) setStringParam(username); - else setStringParam(''); - }, [ username, avatarMode, setStringParam ]); + const save = () => setStringParam((avatarMode === 1) ? username : ''); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerAvatarSaysSomethingView.tsx b/src/components/wired/views/triggers/WiredTriggerAvatarSaysSomethingView.tsx index 97da5be9..ba6e3fbc 100644 --- a/src/components/wired/views/triggers/WiredTriggerAvatarSaysSomethingView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerAvatarSaysSomethingView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { GetSessionDataManager, LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Flex } from '../../../../common/Flex'; -import { Text } from '../../../../common/Text'; +import { FC, useEffect, useState } from 'react'; +import { GetSessionDataManager, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Flex, Text } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props => @@ -14,14 +11,14 @@ export const WiredTriggerAvatarSaysSomethingView: FC<{}> = props => const [ triggererAvatar, setTriggererAvatar ] = useState(-1); const { trigger = null, setStringParam = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => + const save = () => { BatchUpdates(() => { setStringParam(message); setIntParams([ triggererAvatar ]); }); - }, [ message, triggererAvatar, setStringParam, setIntParams ]); + } useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerAvatarWalksOffFurniView.tsx b/src/components/wired/views/triggers/WiredTriggerAvatarWalksOffFurniView.tsx index db16a694..0b98a566 100644 --- a/src/components/wired/views/triggers/WiredTriggerAvatarWalksOffFurniView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerAvatarWalksOffFurniView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerAvatarWalksOffFurniView: FC<{}> = props => diff --git a/src/components/wired/views/triggers/WiredTriggerAvatarWalksOnFurni.tsx b/src/components/wired/views/triggers/WiredTriggerAvatarWalksOnFurni.tsx index 2299c8a2..25572e7c 100644 --- a/src/components/wired/views/triggers/WiredTriggerAvatarWalksOnFurni.tsx +++ b/src/components/wired/views/triggers/WiredTriggerAvatarWalksOnFurni.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerAvatarWalksOnFurniView: FC<{}> = props => diff --git a/src/components/wired/views/triggers/WiredTriggerBaseView.tsx b/src/components/wired/views/triggers/WiredTriggerBaseView.tsx index 30b9ee25..9b4dcbf2 100644 --- a/src/components/wired/views/triggers/WiredTriggerBaseView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerBaseView.tsx @@ -1,5 +1,5 @@ -import { FC, useCallback } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { FC } from 'react'; +import { WiredFurniType } from '../../../../api'; import { WiredBaseView } from '../WiredBaseView'; export interface WiredTriggerBaseViewProps @@ -13,10 +13,7 @@ export const WiredTriggerBaseView: FC = props => { const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, hasSpecialInput = false, children = null } = props; - const onSave = useCallback(() => - { - if(save) save(); - }, [ save ]); + const onSave = () => (save && save()); return ( diff --git a/src/components/wired/views/triggers/WiredTriggerBotReachedAvatarView.tsx b/src/components/wired/views/triggers/WiredTriggerBotReachedAvatarView.tsx index 2a93f65e..c3d4c3e0 100644 --- a/src/components/wired/views/triggers/WiredTriggerBotReachedAvatarView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerBotReachedAvatarView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerBotReachedAvatarView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredTriggerBotReachedAvatarView: FC<{}> = props => const [ botName, setBotName ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(botName); - }, [ botName, setStringParam ]); + const save = () => setStringParam(botName); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerBotReachedStuffView.tsx b/src/components/wired/views/triggers/WiredTriggerBotReachedStuffView.tsx index bf4a1710..d09ccb2d 100644 --- a/src/components/wired/views/triggers/WiredTriggerBotReachedStuffView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerBotReachedStuffView.tsx @@ -1,9 +1,7 @@ -import { FC, useCallback, useEffect, useState } from 'react'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { FC, useEffect, useState } from 'react'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerBotReachedStuffView: FC<{}> = props => @@ -11,10 +9,7 @@ export const WiredTriggerBotReachedStuffView: FC<{}> = props => const [ botName, setBotName ] = useState(''); const { trigger = null, setStringParam = null } = useWiredContext(); - const save = useCallback(() => - { - setStringParam(botName); - }, [ botName, setStringParam ]); + const save = () => setStringParam(botName); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerCollisionView.tsx b/src/components/wired/views/triggers/WiredTriggerCollisionView.tsx index 868e212f..be23a6b1 100644 --- a/src/components/wired/views/triggers/WiredTriggerCollisionView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerCollisionView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerCollisionView: FC<{}> = props => diff --git a/src/components/wired/views/triggers/WiredTriggerExecuteOnceView.tsx b/src/components/wired/views/triggers/WiredTriggerExecuteOnceView.tsx index 032fcb77..6b465261 100644 --- a/src/components/wired/views/triggers/WiredTriggerExecuteOnceView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerExecuteOnceView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggeExecuteOnceView: FC<{}> = props => @@ -13,10 +10,7 @@ export const WiredTriggeExecuteOnceView: FC<{}> = props => const [ time, setTime ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ time ]); - }, [ time, setIntParams ]); + const save = () => setIntParams([ time ]); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyLongView.tsx b/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyLongView.tsx index 40cc903a..e13241dc 100644 --- a/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyLongView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyLongView.tsx @@ -1,11 +1,9 @@ import { FriendlyTime } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props => @@ -13,10 +11,7 @@ export const WiredTriggeExecutePeriodicallyLongView: FC<{}> = props => const [ time, setTime ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ time ]); - }, [ time, setIntParams ]); + const save = () => setIntParams([ time ]); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyView.tsx b/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyView.tsx index 0bfc42dd..64540a98 100644 --- a/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerExecutePeriodicallyView.tsx @@ -1,11 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { GetWiredTimeLocale } from '../../common/GetWiredTimeLocale'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { GetWiredTimeLocale, LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggeExecutePeriodicallyView: FC<{}> = props => @@ -13,10 +10,7 @@ export const WiredTriggeExecutePeriodicallyView: FC<{}> = props => const [ time, setTime ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ time ]); - }, [ time, setIntParams ]); + const save = () => setIntParams([ time ]); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerGameEndsView.tsx b/src/components/wired/views/triggers/WiredTriggerGameEndsView.tsx index b616021f..c6f1c67f 100644 --- a/src/components/wired/views/triggers/WiredTriggerGameEndsView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerGameEndsView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerGameEndsView: FC<{}> = props => diff --git a/src/components/wired/views/triggers/WiredTriggerGameStartsView.tsx b/src/components/wired/views/triggers/WiredTriggerGameStartsView.tsx index a55e3c30..6e43a2ce 100644 --- a/src/components/wired/views/triggers/WiredTriggerGameStartsView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerGameStartsView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerGameStartsView: FC<{}> = props => diff --git a/src/components/wired/views/triggers/WiredTriggerScoreAchievedView.tsx b/src/components/wired/views/triggers/WiredTriggerScoreAchievedView.tsx index a4011248..473641bc 100644 --- a/src/components/wired/views/triggers/WiredTriggerScoreAchievedView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerScoreAchievedView.tsx @@ -1,10 +1,8 @@ -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useEffect, useState } from 'react'; import ReactSlider from 'react-slider'; -import { LocalizeText } from '../../../../api'; -import { Column } from '../../../../common/Column'; -import { Text } from '../../../../common/Text'; -import { WiredFurniType } from '../../common/WiredFurniType'; -import { useWiredContext } from '../../context/WiredContext'; +import { LocalizeText, WiredFurniType } from '../../../../api'; +import { Column, Text } from '../../../../common'; +import { useWiredContext } from '../../WiredContext'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggeScoreAchievedView: FC<{}> = props => @@ -12,10 +10,7 @@ export const WiredTriggeScoreAchievedView: FC<{}> = props => const [ points, setPoints ] = useState(1); const { trigger = null, setIntParams = null } = useWiredContext(); - const save = useCallback(() => - { - setIntParams([ points ]); - }, [ points, setIntParams ]); + const save = () => setIntParams([ points ]); useEffect(() => { diff --git a/src/components/wired/views/triggers/WiredTriggerToggleFurniView.tsx b/src/components/wired/views/triggers/WiredTriggerToggleFurniView.tsx index 4b421bb3..865006b9 100644 --- a/src/components/wired/views/triggers/WiredTriggerToggleFurniView.tsx +++ b/src/components/wired/views/triggers/WiredTriggerToggleFurniView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { WiredFurniType } from '../../common/WiredFurniType'; +import { WiredFurniType } from '../../../../api'; import { WiredTriggerBaseView } from './WiredTriggerBaseView'; export const WiredTriggerToggleFurniView: FC<{}> = props =>