mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-19 05:46:27 +01:00
Random changes
This commit is contained in:
parent
567d3fdb66
commit
51960f7e50
14
src/api/utils/CloneObject.ts
Normal file
14
src/api/utils/CloneObject.ts
Normal 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;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
export * from './CloneObject';
|
||||
export * from './ColorUtils';
|
||||
export * from './LocalizeBadgeDescription';
|
||||
export * from './LocalizeBageName';
|
||||
|
@ -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;
|
||||
|
@ -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) =>
|
||||
|
@ -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 ]);
|
||||
|
@ -199,7 +199,6 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
break;
|
||||
case 'rship_none':
|
||||
messageType = RoomWidgetUserActionMessage.RELATIONSHIP_NONE;
|
||||
console.log('here')
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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) =>
|
||||
|
@ -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>
|
||||
|
@ -66,11 +66,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 }>
|
||||
<Column center className="nitro-room-tools p-2">
|
||||
|
Loading…
Reference in New Issue
Block a user