mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
Sweep targeted typecheck errors: 11 fixes across 9 files
- ProductImageUtility: 'CatalogPageMessageProductData.I' was clearly a placeholder/typo in the WALL branch — getProductCategory's first param is FurnitureType, so use the enclosing productType. - YouTubePlayerView: IRoomUserData has webID, not userId. Two spectator/watcher-list sites used the wrong field. - AvatarInfoWidgetView REQUEST_MANIPULATION handler: avatarInfo is IAvatarInfo (union); .category / .id only exist on AvatarInfoFurni. Type-guard before reading. - InfoStandWidgetPetView: deleted the duplicate local 'interface AvatarInfoPet' — was shadowing the imported one. Drop AvatarInfoPet from the import (local interface stands alone). - FurnitureExternalImageView: missing GetSessionDataManager import (the reportedUserId field reads it inline). Added. - GroupCreatorView setGroupData call: null values for groupName / groupDescription / groupColors / groupBadgeParts where IGroupData expects string / number[] / GroupBadgePart[]. Empty defaults. Also added the previously-omitted groupHasForum field. - ContextMenuView + WiredCreatorToolsView: 'return () => ticker.remove(updateOverlays)' — Pixi Ticker.remove() returns the ticker, leaking the value to React's EffectCallback cleanup which expects 'void | (() => void)'. Wrap in block body. - Deleted src/components/room/widgets/chat/ChatWidgetWindowView_old.tsx — dead code (zero references in the codebase), tripping the NitroCardHeaderView onCloseClick prop change. Net tsgo error count: -11.
This commit is contained in:
@@ -13,7 +13,7 @@ export class ProductImageUtility
|
||||
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(furniClassId);
|
||||
break;
|
||||
case FurnitureType.WALL:
|
||||
const productCategory = this.getProductCategory(CatalogPageMessageProductData.I, furniClassId);
|
||||
const productCategory = this.getProductCategory(productType, furniClassId);
|
||||
|
||||
if(productCategory === 1)
|
||||
{
|
||||
|
||||
@@ -108,13 +108,14 @@ export const GroupCreatorView: FC<GroupCreatorViewProps> = props =>
|
||||
|
||||
setGroupData({
|
||||
groupId: -1,
|
||||
groupName: null,
|
||||
groupDescription: null,
|
||||
groupName: '',
|
||||
groupDescription: '',
|
||||
groupHomeroomId: -1,
|
||||
groupState: 1,
|
||||
groupCanMembersDecorate: true,
|
||||
groupColors: null,
|
||||
groupBadgeParts: null
|
||||
groupHasForum: false,
|
||||
groupColors: [],
|
||||
groupBadgeParts: []
|
||||
});
|
||||
|
||||
SendMessageComposer(new GroupBuyDataComposer());
|
||||
|
||||
@@ -81,7 +81,8 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
||||
|
||||
useNitroEvent<RoomEngineObjectEvent>(RoomEngineObjectEvent.REQUEST_MANIPULATION, event =>
|
||||
{
|
||||
if(event.category !== avatarInfo?.category || event.objectId !== avatarInfo?.id) return;
|
||||
if(!(avatarInfo instanceof AvatarInfoFurni)) return;
|
||||
if(event.category !== avatarInfo.category || event.objectId !== avatarInfo.id) return;
|
||||
|
||||
setMobileFurniDetailsOpen(false);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CreateLinkEvent, PetRespectComposer, PetType } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useState, useCallback } from 'react';
|
||||
import { FaTimes } from 'react-icons/fa';
|
||||
import { AvatarInfoPet, ConvertSeconds, GetConfigurationValue, LocalizeText, SendMessageComposer } from '../../../../../api';
|
||||
import { ConvertSeconds, GetConfigurationValue, LocalizeText, SendMessageComposer } from '../../../../../api';
|
||||
import { Button, Column, Flex, LayoutCounterTimeView, LayoutPetImageView, LayoutRarityLevelView, Text, UserProfileIconView } from '../../../../../common';
|
||||
import { useRoom, useSessionInfo } from '../../../../../hooks';
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
import { FC, UIEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { ChatEntryType } from '../../../../api';
|
||||
import { DraggableWindowPosition, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
|
||||
import { useChatHistory } from '../../../../hooks';
|
||||
import { useRoom } from '../../../../hooks/rooms';
|
||||
|
||||
const BOTTOM_SCROLL_THRESHOLD = 20;
|
||||
|
||||
export const ChatWidgetWindowView: FC<{}> = () =>
|
||||
{
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const lastScrollTop = useRef(0);
|
||||
const [ isAutoScrollEnabled, setIsAutoScrollEnabled ] = useState(true);
|
||||
const { chatHistory = [] } = useChatHistory();
|
||||
const { roomSession = null } = useRoom();
|
||||
|
||||
const roomChatHistory = useMemo(() => chatHistory.filter(chat => ((chat.type === ChatEntryType.TYPE_CHAT) && (chat.roomId === roomSession?.roomId))), [ chatHistory, roomSession?.roomId ]);
|
||||
|
||||
const isAtBottom = useCallback((element: HTMLDivElement) =>
|
||||
{
|
||||
const distanceToBottom = (element.scrollHeight - element.clientHeight - element.scrollTop);
|
||||
|
||||
return (distanceToBottom <= BOTTOM_SCROLL_THRESHOLD);
|
||||
}, []);
|
||||
|
||||
const scrollToLatest = useCallback((smooth: boolean = true) =>
|
||||
{
|
||||
if(!contentRef.current) return;
|
||||
|
||||
const element = contentRef.current;
|
||||
|
||||
element.scrollTo({ top: element.scrollHeight, behavior: smooth ? 'smooth' : 'auto' });
|
||||
}, []);
|
||||
|
||||
const onScroll = useCallback((event: UIEvent<HTMLDivElement>) =>
|
||||
{
|
||||
const element = event.currentTarget;
|
||||
const atBottom = isAtBottom(element);
|
||||
const isScrollingUp = (element.scrollTop < lastScrollTop.current);
|
||||
|
||||
lastScrollTop.current = element.scrollTop;
|
||||
|
||||
if(atBottom)
|
||||
{
|
||||
if(!isAutoScrollEnabled) setIsAutoScrollEnabled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(isAutoScrollEnabled && isScrollingUp) setIsAutoScrollEnabled(false);
|
||||
}, [ isAtBottom, isAutoScrollEnabled ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!contentRef.current || !isAutoScrollEnabled) return;
|
||||
|
||||
scrollToLatest();
|
||||
}, [ roomChatHistory.length, isAutoScrollEnabled, scrollToLatest ]);
|
||||
|
||||
return (
|
||||
<NitroCardView
|
||||
className="w-[460px] h-[240px]"
|
||||
disableDrag={ false }
|
||||
style={ { pointerEvents: 'auto' } }
|
||||
theme="primary-slim"
|
||||
uniqueKey="chat-widget-window"
|
||||
windowPosition={ DraggableWindowPosition.TOP_LEFT }>
|
||||
<NitroCardHeaderView headerText="Chat window" />
|
||||
<NitroCardContentView className="bg-[#f2f2f2] relative" overflow="hidden">
|
||||
<div ref={ contentRef } className="h-full overflow-y-auto px-2 py-1 text-black text-[13px] leading-4" onScroll={ onScroll }>
|
||||
{ roomChatHistory.map(chat => (
|
||||
<div key={ `${ chat.timestamp }-${ chat.id }` } className="mb-1 flex items-start gap-1 break-words">
|
||||
<div className="w-[65px] h-[50px] shrink-0 mt-[-8px] rounded-sm bg-no-repeat bg-center scale-70" style={ chat.imageUrl ? { backgroundImage: `url(${ chat.imageUrl })` } : undefined } />
|
||||
<div>
|
||||
<b dangerouslySetInnerHTML={ { __html: `${ chat.name }: ` } } />
|
||||
<span dangerouslySetInnerHTML={ { __html: chat.message } } />
|
||||
</div>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
{ !isAutoScrollEnabled && (
|
||||
<button className="absolute bottom-2 right-2 px-2 py-1 text-white text-[11px] rounded bg-black/45 hover:bg-black/60" onClick={ () =>
|
||||
{
|
||||
setIsAutoScrollEnabled(true);
|
||||
scrollToLatest();
|
||||
} } type="button">
|
||||
Go to latest message
|
||||
</button>
|
||||
) }
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
);
|
||||
};
|
||||
@@ -134,7 +134,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = ({
|
||||
const ticker = GetTicker();
|
||||
ticker.add(update);
|
||||
|
||||
return () => ticker.remove(update);
|
||||
return () => { ticker.remove(update); };
|
||||
}, [objectId, category, updatePosition, onClose]);
|
||||
|
||||
useEffect(() =>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { FC } from 'react';
|
||||
import { GetSessionDataManager } from '@nitrots/nitro-renderer';
|
||||
import { GetConfigurationValue, LocalizeText, ReportType } from '../../../../api';
|
||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
|
||||
import { useFurnitureExternalImageWidget, useHelp } from '../../../../hooks';
|
||||
|
||||
@@ -117,10 +117,10 @@ export const YouTubePlayerView: FC<{}> = () =>
|
||||
for (let i = 0; i < 500; i++)
|
||||
{
|
||||
const userData = roomSession.userDataManager.getUserDataByIndex(i);
|
||||
if (userData && userData.name && userData.type === 1 && !seen.has(userData.userId))
|
||||
if (userData && userData.name && userData.type === 1 && !seen.has(userData.webID))
|
||||
{
|
||||
seen.add(userData.userId);
|
||||
users.push({ id: userData.userId, name: userData.name, look: userData.figure });
|
||||
seen.add(userData.webID);
|
||||
users.push({ id: userData.webID, name: userData.name, look: userData.figure });
|
||||
}
|
||||
}
|
||||
setSpectators(users);
|
||||
@@ -663,7 +663,7 @@ export const YouTubePlayerView: FC<{}> = () =>
|
||||
const ud = rs.userDataManager.getUserData(uid);
|
||||
if (ud && ud.name)
|
||||
{
|
||||
watchers.push({ id: ud.userId, name: ud.name, look: ud.figure });
|
||||
watchers.push({ id: ud.webID, name: ud.name, look: ud.figure });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1975,7 +1975,7 @@ export const WiredCreatorToolsView: FC<{}> = () =>
|
||||
|
||||
ticker.add(updateOverlays);
|
||||
|
||||
return () => ticker.remove(updateOverlays);
|
||||
return () => { ticker.remove(updateOverlays); };
|
||||
}, [ isVariableHighlightActive, roomSession?.roomId, variableHighlightTargets ]);
|
||||
const variableManageTypeOptions = useMemo(() =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user