Random changes

This commit is contained in:
Bill 2022-03-21 02:11:18 -04:00
parent 567d3fdb66
commit 51960f7e50
9 changed files with 42 additions and 27 deletions

View File

@ -0,0 +1,14 @@
export const CloneObject = <T>(object: T): T =>
{
if((object == null) || ('object' != typeof object)) return object;
// @ts-ignore
const copy = new object.constructor();
for(const attr in object)
{
if(object.hasOwnProperty(attr)) copy[attr] = object[attr];
}
return copy;
}

View File

@ -1,3 +1,4 @@
export * from './CloneObject';
export * from './ColorUtils';
export * from './LocalizeBadgeDescription';
export * from './LocalizeBageName';

View File

@ -1,9 +1,9 @@
import { CSSProperties, DetailedHTMLProps, FC, HTMLAttributes, LegacyRef, useMemo } from 'react';
import { CSSProperties, DetailedHTMLProps, FC, HTMLAttributes, MutableRefObject, useMemo } from 'react';
import { ColorVariantType, DisplayType, FloatType, OverflowType, PositionType } from './types';
export interface BaseProps<T = HTMLElement> extends DetailedHTMLProps<HTMLAttributes<T>, T>
{
innerRef?: LegacyRef<T>;
innerRef?: MutableRefObject<T>;
display?: DisplayType;
fit?: boolean;
grow?: boolean;

View File

@ -1,3 +1,4 @@
import { NitroLogger } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { AddEventLinkTracker, GetConfiguration, NotificationUtilities, RemoveLinkEventTracker } from '../../api';
import { Base, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common';
@ -13,19 +14,28 @@ export const NitropediaView: FC<{}> = props =>
const openPage = useCallback(async (link: string) =>
{
const response = await fetch(link);
if(!response) return;
const text = await response.text();
const splitData = text.split(NEW_LINE_REGEX);
BatchUpdates(() =>
console.log(link);
try
{
setHeader(splitData.shift());
setContent(splitData.join(''));
});
const response = await fetch(link);
if(!response) return;
const text = await response.text();
const splitData = text.split(NEW_LINE_REGEX);
BatchUpdates(() =>
{
setHeader(splitData.shift());
setContent(splitData.join(''));
});
}
catch (error)
{
NitroLogger.error(`Failed to fetch ${ link }`);
}
}, []);
const onLinkReceived = useCallback((link: string) =>

View File

@ -121,7 +121,7 @@ export const RoomView: FC<RoomViewProps> = props =>
GetNitroInstance().render();
}
if(elementRef && elementRef.current) elementRef.current.appendChild(canvas);
if(elementRef && elementRef.current) elementRef.current.replaceChildren(canvas);
setCanvasId(canvasId);
}, [ roomSession ]);

View File

@ -199,7 +199,6 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
break;
case 'rship_none':
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_NONE;
console.log('here')
break;
}

View File

@ -23,11 +23,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props =>
const canOpenBackgroundToner = useCallback(() =>
{
const isRoomOwner = roomSession.isRoomOwner;
const hasLevel = (roomSession.controllerLevel >= RoomControllerLevel.GUEST);
const isGodMode = GetSessionDataManager().isGodMode;
return (isRoomOwner || hasLevel || isGodMode);
return (roomSession.isRoomOwner || (roomSession.controllerLevel >= RoomControllerLevel.GUEST) || GetSessionDataManager().isModerator);
}, [ roomSession ]);
const onRoomEngineObjectEvent = useCallback((event: RoomEngineObjectEvent) =>

View File

@ -30,7 +30,7 @@ export const InfoStandWidgetUserRelationshipsView: FC<InfoStandWidgetUserRelatio
<i className={`nitro-friends-spritesheet icon-${relationshipName}`} />
<Flex alignItems="center" gap={ 0 }>
<Text small variant="white" onClick={ event => GetUserProfile(relationshipInfo.randomFriendId) }>
{ relationshipInfo.randomFriendName }
<u>{ relationshipInfo.randomFriendName }</u>
{ (relationshipInfo.friendCount > 1) && (' ' + LocalizeText(`extendedprofile.relstatus.others.${ relationshipName }`, [ 'count' ], [ (relationshipInfo.friendCount - 1).toString() ])) }
</Text>
</Flex>

View File

@ -65,11 +65,6 @@ export const RoomToolsWidgetView: FC<{}> = props =>
return () => clearTimeout(timeout);
}, [ roomName, roomOwner, roomTags ]);
useEffect(() =>
{
console.log(navigatorData);
}, [ navigatorData ]);
return (
<Flex className="nitro-room-tools-container" gap={ 2 }>