From c5424b2303b79019ed8926ce221f078058ef7dfb Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Sat, 12 Jun 2021 02:37:59 -0300 Subject: [PATCH] Change widgets from functions to consts --- src/views/inventory/utils/FurnitureItem.ts | 24 +++++++++---------- .../high-score/FurnitureHighScoreView.tsx | 3 ++- .../mannequin/FurnitureMannequinView.tsx | 3 ++- .../present/FurniturePresentView.tsx | 3 ++- .../stickie/FurnitureStickieView.tsx | 8 +++---- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/views/inventory/utils/FurnitureItem.ts b/src/views/inventory/utils/FurnitureItem.ts index 621cb16e..702b46c3 100644 --- a/src/views/inventory/utils/FurnitureItem.ts +++ b/src/views/inventory/utils/FurnitureItem.ts @@ -38,15 +38,15 @@ export class FurnitureItem implements IFurnitureItem this._recyclable = parser.isRecycleable; this._sellable = parser.sellable; this._stuffData = parser.stuffData; - this._extra = parser._Str_2794; + this._extra = parser.extra; this._secondsToExpiration = parser.secondsToExpiration; - this._expirationTimeStamp = parser._Str_10616; + this._expirationTimeStamp = parser.expirationTimeStamp; this._hasRentPeriodStarted = parser.hasRentPeriodStarted; - this._creationDay = parser._Str_8932; - this._creationMonth = parser._Str_9050; - this._creationYear = parser._Str_9408; + this._creationDay = parser.creationDay; + this._creationMonth = parser.creationMonth; + this._creationYear = parser.creationYear; this._slotId = parser.slotId; - this._songId = parser._Str_3951; + this._songId = parser.songId; this._flatId = parser.flatId; this._isRented = parser.rentable; this._isWallItem = parser.isWallItem; @@ -197,15 +197,15 @@ export class FurnitureItem implements IFurnitureItem this._recyclable = parser.isRecycleable; this._sellable = parser.sellable; this._stuffData = parser.stuffData; - this._extra = parser._Str_2794; + this._extra = parser.extra; this._secondsToExpiration = parser.secondsToExpiration; - this._expirationTimeStamp = parser._Str_10616; + this._expirationTimeStamp = parser.expirationTimeStamp; this._hasRentPeriodStarted = parser.hasRentPeriodStarted; - this._creationDay = parser._Str_8932; - this._creationMonth = parser._Str_9050; - this._creationYear = parser._Str_9408; + this._creationDay = parser.creationDay; + this._creationMonth = parser.creationMonth; + this._creationYear = parser.creationYear; this._slotId = parser.slotId; - this._songId = parser._Str_3951; + this._songId = parser.songId; this._flatId = parser.flatId; this._isRented = parser.rentable; this._isWallItem = parser.isWallItem; diff --git a/src/views/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx b/src/views/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx index bb7120dd..6d77fe7b 100644 --- a/src/views/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx +++ b/src/views/room/widgets/furniture/high-score/FurnitureHighScoreView.tsx @@ -1,8 +1,9 @@ import { RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent } from 'nitro-renderer'; +import { FC } from 'react'; import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event'; import { FurnitureHighScoreViewProps } from './FurnitureHighScoreView.types'; -export function FurnitureHighScoreView(props: FurnitureHighScoreViewProps): JSX.Element +export const FurnitureHighScoreView: FC = props => { const onRoomEngineObjectEvent = (event: RoomEngineObjectEvent) => { diff --git a/src/views/room/widgets/furniture/mannequin/FurnitureMannequinView.tsx b/src/views/room/widgets/furniture/mannequin/FurnitureMannequinView.tsx index 49b837b9..8c2d8e17 100644 --- a/src/views/room/widgets/furniture/mannequin/FurnitureMannequinView.tsx +++ b/src/views/room/widgets/furniture/mannequin/FurnitureMannequinView.tsx @@ -1,8 +1,9 @@ import { RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent } from 'nitro-renderer'; +import { FC } from 'react'; import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event'; import { FurnitureMannequinViewProps } from './FurnitureMannequinView.types'; -export function FurnitureMannequinView(props: FurnitureMannequinViewProps): JSX.Element +export const FurnitureMannequinView: FC = props => { const onRoomEngineObjectEvent = (event: RoomEngineObjectEvent) => { diff --git a/src/views/room/widgets/furniture/present/FurniturePresentView.tsx b/src/views/room/widgets/furniture/present/FurniturePresentView.tsx index a1057c15..7b3616b3 100644 --- a/src/views/room/widgets/furniture/present/FurniturePresentView.tsx +++ b/src/views/room/widgets/furniture/present/FurniturePresentView.tsx @@ -1,8 +1,9 @@ import { RoomEngineObjectEvent, RoomEngineTriggerWidgetEvent } from 'nitro-renderer'; +import { FC } from 'react'; import { useRoomEngineEvent } from '../../../../../hooks/events/nitro/room/room-engine-event'; import { FurniturePresentViewProps } from './FurniturePresentView.types'; -export function FurniturePresentView(props: FurniturePresentViewProps): JSX.Element +export const FurniturePresentView: FC = props => { const onRoomEngineObjectEvent = (event: RoomEngineObjectEvent) => { diff --git a/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx b/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx index 12523b95..cdac016d 100644 --- a/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx +++ b/src/views/room/widgets/furniture/stickie/FurnitureStickieView.tsx @@ -1,5 +1,5 @@ import { NitroEvent, RoomEngineTriggerWidgetEvent, RoomObjectVariable } from 'nitro-renderer'; -import { useCallback, useState } from 'react'; +import { FC, useCallback, useState } from 'react'; import { GetRoomEngine, GetRoomSession, GetSessionDataManager } from '../../../../../api'; import { DraggableWindow } from '../../../../../hooks/draggable-window/DraggableWindow'; import { CreateEventDispatcherHook } from '../../../../../hooks/events/event-dispatcher.base'; @@ -10,10 +10,8 @@ import { FurnitureStickieData } from './FurnitureStickieData'; import { getStickieColorName, STICKIE_COLORS } from './FurnitureStickieUtils'; import { FurnitureStickieViewProps } from './FurnitureStickieView.types'; -export function FurnitureStickieView(props: FurnitureStickieViewProps): JSX.Element +export const FurnitureStickieView: FC = props => { - const { events = null } = props; - const [ stickieData, setStickieData ] = useState(null); const onNitroEvent = useCallback((event: NitroEvent) => @@ -62,7 +60,7 @@ export function FurnitureStickieView(props: FurnitureStickieViewProps): JSX.Elem }, []); useRoomEngineEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, onNitroEvent); - CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, events, onNitroEvent); + CreateEventDispatcherHook(RoomWidgetRoomObjectUpdateEvent.FURNI_REMOVED, props.events, onNitroEvent); const processAction = useCallback((type: string, value: string = null) => {