mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 21:36:27 +01:00
Merge branch 'dev' of https://git.krews.org/nitro/nitro-react into dev
This commit is contained in:
commit
16c6c0dab3
@ -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": {
|
||||
|
@ -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
|
||||
|
@ -91,7 +91,7 @@ export const InventoryBadgeView: FC<InventoryBadgeViewProps> = props =>
|
||||
{ badge && (badge.length > 0) &&
|
||||
<Column grow justifyContent="end" gap={ 2 }>
|
||||
<Flex alignItems="center" gap={ 2 }>
|
||||
<LayoutBadgeImageView badgeCode={ badge } />
|
||||
<LayoutBadgeImageView shrink badgeCode={ badge } />
|
||||
<Text>{ LocalizeBadgeName(badge) }</Text>
|
||||
</Flex>
|
||||
<Button variant={ (isWearingBadge(badge) ? 'danger' : 'success') } disabled={ !isWearingBadge(badge) && !canWearBadges() } onClick={ toggleBadge }>{ LocalizeText(isWearingBadge(badge) ? 'inventory.badges.clearbadge' : 'inventory.badges.wearbadge') }</Button>
|
||||
|
@ -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<AvatarInfoWidgetRentableBotView
|
||||
{ (mode === MODE_CHANGE_NAME) &&
|
||||
<Column className="menu-item" onClick={ null } gap={ 1 }>
|
||||
<Text variant="white">{ LocalizeText('bot.skill.name.configuration.new.name') }</Text>
|
||||
<input type="text" className="form-control form-control-sm" value={ newName } onChange={ event => setNewName(event.target.value) } />
|
||||
<input type="text" className="form-control form-control-sm" value={ newName } maxLength={ GetConfiguration<number>('bot.name.max.length', 15) } onChange={ event => setNewName(event.target.value) } />
|
||||
<Flex alignItems="center" justifyContent="between" gap={ 1 }>
|
||||
<Button fullWidth variant="secondary" onClick={ event => processAction(null) }>{ LocalizeText('cancel') }</Button>
|
||||
<Button fullWidth variant="success" onClick={ event => processAction('save_bot_name') }>{ LocalizeText('save') }</Button>
|
||||
@ -191,7 +191,7 @@ export const AvatarInfoWidgetRentableBotView: FC<AvatarInfoWidgetRentableBotView
|
||||
{ (mode === MODE_CHANGE_MOTTO) &&
|
||||
<Column className="menu-item" onClick={ null } gap={ 1 }>
|
||||
<Text variant="white">{ LocalizeText('bot.skill.name.configuration.new.motto') }</Text>
|
||||
<input type="text" className="form-control form-control-sm" value={ newMotto } onChange={ event => setNewMotto(event.target.value) } />
|
||||
<input type="text" className="form-control form-control-sm" value={ newMotto } maxLength={ GetConfiguration<number>('motto.max.legnth', 38) } onChange={ event => setNewMotto(event.target.value) } />
|
||||
<Flex alignItems="center" justifyContent="between" gap={ 1 }>
|
||||
<Button fullWidth variant="secondary" onClick={ event => processAction(null) }>{ LocalizeText('cancel') }</Button>
|
||||
<Button fullWidth variant="success" onClick={ event => processAction('save_bot_motto') }>{ LocalizeText('save') }</Button>
|
||||
|
@ -28,7 +28,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = 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<HTMLDivElement>();
|
||||
|
||||
const getOffset = useCallback((bounds: NitroRectangle) =>
|
||||
@ -156,7 +156,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
|
||||
{
|
||||
let added = false;
|
||||
|
||||
if(!frozen)
|
||||
if(!isFrozen)
|
||||
{
|
||||
added = true;
|
||||
|
||||
@ -167,7 +167,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
|
||||
{
|
||||
if(added) GetTicker().remove(update);
|
||||
}
|
||||
}, [ frozen, update ]);
|
||||
}, [ isFrozen, update ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -178,5 +178,5 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
|
||||
return () => clearTimeout(timeout);
|
||||
}, [ fades ]);
|
||||
|
||||
return <Base innerRef={ elementRef } position={ position } classNames={ getClassNames } style={ getStyle } { ...rest } />;
|
||||
return <Base innerRef={ elementRef } position={ position } classNames={ getClassNames } style={ getStyle } onMouseOver={ event => setIsFrozen(true) } onMouseOut={ event => setIsFrozen(false) } { ...rest } />;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export const InfoStandWidgetUserView: FC<InfoStandWidgetUserViewProps> = props =
|
||||
|
||||
const saveMotto = (motto: string) =>
|
||||
{
|
||||
if(!isEditingMotto || (motto.length > 38)) return;
|
||||
if(!isEditingMotto || (motto.length > GetConfiguration<number>('motto.max.legnth', 38))) return;
|
||||
|
||||
widgetHandler.processWidgetMessage(new RoomWidgetChangeMottoMessage(motto));
|
||||
|
||||
@ -195,7 +195,7 @@ export const InfoStandWidgetUserView: FC<InfoStandWidgetUserViewProps> = props =
|
||||
{ !isEditingMotto &&
|
||||
<Text fullWidth pointer wrap textBreak small variant="white" onClick={ event => setIsEditingMotto(true) }>{ motto } </Text> }
|
||||
{ isEditingMotto &&
|
||||
<input type="text" className="motto-input" maxLength={ 38 } value={ motto } onChange={ event => setMotto(event.target.value) } onBlur={ onMottoBlur } onKeyDown={ onMottoKeyDown } autoFocus={ true } /> }
|
||||
<input type="text" className="motto-input" maxLength={ GetConfiguration<number>('motto.max.legnth', 38) } value={ motto } onChange={ event => setMotto(event.target.value) } onBlur={ onMottoBlur } onKeyDown={ onMottoKeyDown } autoFocus={ true } /> }
|
||||
</Flex>
|
||||
</Flex> }
|
||||
</Flex>
|
||||
|
@ -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<boolean>(false);
|
||||
const [ roomName, setRoomName ] = useState<string>(null);
|
||||
const [ roomOwner, setRoomOwner ] = useState<string>(null);
|
||||
const [ roomTags, setRoomTags ] = useState<string[]>(null);
|
||||
const [ roomInfoDisplay, setRoomInfoDisplay ] = useState<boolean>(false);
|
||||
const [ isOpen, setIsOpen ] = useState<boolean>(false);
|
||||
const [ navigatorData, setNavigatorData ] = useSharedState<NavigatorData>('@navigatorData');
|
||||
const { widgetHandler = null } = useRoomContext();
|
||||
|
||||
@ -85,7 +85,7 @@ export const RoomToolsWidgetView: FC<{}> = props =>
|
||||
</Column>
|
||||
{ roomTags && roomTags.length > 0 &&
|
||||
<Flex gap={ 2 }>
|
||||
{ roomTags.map((tag: string) => <Text small variant="white" className="rounded bg-primary p-1">#{ tag }</Text>) }
|
||||
{ roomTags.map((tag, index) => <Text key={ index } small variant="white" className="rounded bg-primary p-1">#{ tag }</Text>) }
|
||||
</Flex> }
|
||||
</Column>
|
||||
</Column>
|
||||
|
Loading…
Reference in New Issue
Block a user