From f398c32ed125813e4c6d00f51653dbc5dfe97ad8 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 04:33:13 -0400 Subject: [PATCH 1/6] Fix missing key prop --- .../widgets/room-tools/RoomToolsWidgetView.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/room/widgets/room-tools/RoomToolsWidgetView.tsx b/src/components/room/widgets/room-tools/RoomToolsWidgetView.tsx index b35cd7bd..451e3b4f 100644 --- a/src/components/room/widgets/room-tools/RoomToolsWidgetView.tsx +++ b/src/components/room/widgets/room-tools/RoomToolsWidgetView.tsx @@ -9,12 +9,12 @@ import { useRoomContext } from '../../RoomContext'; export const RoomToolsWidgetView: FC<{}> = props => { - const [ isZoomedIn, setIsZoomedIn ] = useState(false); - const [ roomName, setRoomName ] = useState(null); - const [ roomOwner, setRoomOwner ] = useState(null); - const [ roomTags, setRoomTags ] = useState(null); - const [ roomInfoDisplay, setRoomInfoDisplay ] = useState(false); - const [ isOpen, setIsOpen ] = useState(false); + const [ isZoomedIn, setIsZoomedIn ] = useState(false); + const [ roomName, setRoomName ] = useState(null); + const [ roomOwner, setRoomOwner ] = useState(null); + const [ roomTags, setRoomTags ] = useState(null); + const [ roomInfoDisplay, setRoomInfoDisplay ] = useState(false); + const [ isOpen, setIsOpen ] = useState(false); const [ navigatorData, setNavigatorData ] = useSharedState('@navigatorData'); const { widgetHandler = null } = useRoomContext(); @@ -85,7 +85,7 @@ export const RoomToolsWidgetView: FC<{}> = props => { roomTags && roomTags.length > 0 && - { roomTags.map((tag: string) => #{ tag }) } + { roomTags.map((tag, index) => #{ tag }) } } From 17262d502a74d6f480d4c7b478a4446ceca358d9 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 04:48:33 -0400 Subject: [PATCH 2/6] Add bot name & motto max length --- public/ui-config.json.example | 2 ++ .../widgets/avatar-info/AvatarInfoWidgetRentableBotView.tsx | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/public/ui-config.json.example b/public/ui-config.json.example index d9934672..0497155b 100644 --- a/public/ui-config.json.example +++ b/public/ui-config.json.example @@ -14,6 +14,8 @@ "camera.publish.disabled": false, "hc.disabled": false, "badge.descriptions.enabled": true, + "motto.max.length": 38, + "bot.name.max.length": 15, "hotelview": { "show.avatar": true, "widgets": { diff --git a/src/components/room/widgets/avatar-info/AvatarInfoWidgetRentableBotView.tsx b/src/components/room/widgets/avatar-info/AvatarInfoWidgetRentableBotView.tsx index 1aa4f8fd..0822cff9 100644 --- a/src/components/room/widgets/avatar-info/AvatarInfoWidgetRentableBotView.tsx +++ b/src/components/room/widgets/avatar-info/AvatarInfoWidgetRentableBotView.tsx @@ -1,6 +1,6 @@ import { BotCommandConfigurationEvent, BotRemoveComposer, BotSkillSaveComposer, RequestBotCommandConfigurationComposer, RoomObjectCategory, RoomObjectType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; -import { GetNitroInstance, LocalizeText, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateRentableBotChatEvent, SendMessageComposer } from '../../../../api'; +import { GetConfiguration, GetNitroInstance, LocalizeText, RoomWidgetUpdateInfostandRentableBotEvent, RoomWidgetUpdateRentableBotChatEvent, SendMessageComposer } from '../../../../api'; import { Button, Column, Flex, Text } from '../../../../common'; import { UseMessageEventHook } from '../../../../hooks'; import { useRoomContext } from '../../RoomContext'; @@ -182,7 +182,7 @@ export const AvatarInfoWidgetRentableBotView: FC { LocalizeText('bot.skill.name.configuration.new.name') } - setNewName(event.target.value) } /> + ('bot.name.max.length', 15) } onChange={ event => setNewName(event.target.value) } /> @@ -191,7 +191,7 @@ export const AvatarInfoWidgetRentableBotView: FC { LocalizeText('bot.skill.name.configuration.new.motto') } - setNewMotto(event.target.value) } /> + ('motto.max.legnth', 38) } onChange={ event => setNewMotto(event.target.value) } /> From 39c2fd424629956d74f54e7804a373ca322d57b6 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 05:07:34 -0400 Subject: [PATCH 3/6] Fix badge inventory css --- src/components/inventory/views/badge/InventoryBadgeView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/inventory/views/badge/InventoryBadgeView.tsx b/src/components/inventory/views/badge/InventoryBadgeView.tsx index 8471d39d..b000e874 100644 --- a/src/components/inventory/views/badge/InventoryBadgeView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeView.tsx @@ -91,7 +91,7 @@ export const InventoryBadgeView: FC = props => { badge && (badge.length > 0) && - + { LocalizeBadgeName(badge) } From 924ea0de68aa5ba047160448a27ca85c03c4be98 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 05:09:17 -0400 Subject: [PATCH 4/6] Add context menu freeze on hover --- .../room/widgets/context-menu/ContextMenuView.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/room/widgets/context-menu/ContextMenuView.tsx b/src/components/room/widgets/context-menu/ContextMenuView.tsx index 7a10c8ee..3583d521 100644 --- a/src/components/room/widgets/context-menu/ContextMenuView.tsx +++ b/src/components/room/widgets/context-menu/ContextMenuView.tsx @@ -28,7 +28,7 @@ export const ContextMenuView: FC = props => const [ opacity, setOpacity ] = useState(1); const [ isFading, setIsFading ] = useState(false); const [ fadeTime, setFadeTime ] = useState(0); - const [ frozen, setFrozen ] = useState(false); + const [ isFrozen, setIsFrozen ] = useState(false); const elementRef = useRef(); const getOffset = useCallback((bounds: NitroRectangle) => @@ -156,7 +156,7 @@ export const ContextMenuView: FC = props => { let added = false; - if(!frozen) + if(!isFrozen) { added = true; @@ -167,7 +167,7 @@ export const ContextMenuView: FC = props => { if(added) GetTicker().remove(update); } - }, [ frozen, update ]); + }, [ isFrozen, update ]); useEffect(() => { @@ -178,5 +178,5 @@ export const ContextMenuView: FC = props => return () => clearTimeout(timeout); }, [ fades ]); - return ; + return setIsFrozen(true) } onMouseOut={ event => setIsFrozen(false) } { ...rest } />; } From 4f27d0b82ccbb27a86a06c33523d9793e2dc924f Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 23 Mar 2022 05:09:56 -0400 Subject: [PATCH 5/6] Add motto max length --- .../room/widgets/infostand/InfoStandWidgetUserView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/room/widgets/infostand/InfoStandWidgetUserView.tsx b/src/components/room/widgets/infostand/InfoStandWidgetUserView.tsx index 60b97b31..6846e60d 100644 --- a/src/components/room/widgets/infostand/InfoStandWidgetUserView.tsx +++ b/src/components/room/widgets/infostand/InfoStandWidgetUserView.tsx @@ -25,7 +25,7 @@ export const InfoStandWidgetUserView: FC = props = const saveMotto = (motto: string) => { - if(!isEditingMotto || (motto.length > 38)) return; + if(!isEditingMotto || (motto.length > GetConfiguration('motto.max.legnth', 38))) return; widgetHandler.processWidgetMessage(new RoomWidgetChangeMottoMessage(motto)); @@ -195,7 +195,7 @@ export const InfoStandWidgetUserView: FC = props = { !isEditingMotto && setIsEditingMotto(true) }>{ motto }  } { isEditingMotto && - setMotto(event.target.value) } onBlur={ onMottoBlur } onKeyDown={ onMottoKeyDown } autoFocus={ true } /> } + ('motto.max.legnth', 38) } value={ motto } onChange={ event => setMotto(event.target.value) } onBlur={ onMottoBlur } onKeyDown={ onMottoKeyDown } autoFocus={ true } /> } } From 01a77db0fd7aed51dbfeaf511fd940e731cf56d9 Mon Sep 17 00:00:00 2001 From: dank074 Date: Wed, 23 Mar 2022 04:15:27 -0500 Subject: [PATCH 6/6] fix hex color string padding --- src/api/utils/ColorUtils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/api/utils/ColorUtils.ts b/src/api/utils/ColorUtils.ts index ccb6e27a..126d271d 100644 --- a/src/api/utils/ColorUtils.ts +++ b/src/api/utils/ColorUtils.ts @@ -7,7 +7,16 @@ export class ColorUtils public static makeColorNumberHex(color: number): string { - return ( '#' + color.toString(16)); + let val = color.toString(16); + if(val.length < 6) + { + const diff = 6 - val.length; + for(let i = 0; i < diff; i++) + { + val = '0' + val; + } + } + return ( '#' + val); } public static convertFromHex(color: string): number