fix(mod-tools): Room Chatlog button now renders a loading state

ModToolsChatlogView returned null whenever roomChatlog was undefined
— including the entire window between click and server response (up
to a 15-second NitroQuery timeout). Result: clicking the Chatlog
button in the launcher or in Room Info appeared to do nothing at all
on any session where the server reply was slow or the accept-filter
correlation didn't match.

The other two chatlog wrappers (ModToolsUserChatlogView,
CfhChatlogView) already render a spinner while data is loading after
yesterday's redesign — this view was the one I missed.

Apply the same fix: always render the NitroCardView, and show the
FaSpinner loading state inside until useNitroQuery resolves.
This commit is contained in:
simoleo89
2026-05-20 21:07:07 +02:00
committed by simoleo89
parent 75815fa022
commit 65af9a564d
@@ -1,5 +1,6 @@
import { ChatRecordData, GetRoomChatlogMessageComposer, RoomChatlogEvent } from '@nitrots/nitro-renderer';
import { FC } from 'react';
import { FaSpinner } from 'react-icons/fa';
import { LocalizeText } from '../../../../api';
import { useNitroQuery } from '../../../../api/nitro-query';
import { DraggableWindowPosition, NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../common';
@@ -24,13 +25,16 @@ export const ModToolsChatlogView: FC<ModToolsChatlogViewProps> = props =>
enabled: roomId !== null
});
if(!roomChatlog) return null;
return (
<NitroCardView className="nitro-mod-tools-chatlog min-w-[460px] max-w-[520px] max-h-[500px]" theme="primary-slim" windowPosition={ DraggableWindowPosition.TOP_LEFT }>
<NitroCardHeaderView headerText={ LocalizeText('modtools.room.chatlog.title') } onCloseClick={ onCloseClick } />
<NitroCardContentView className="text-black" gap={ 1 } overflow="auto">
<ChatlogView records={ [ roomChatlog ] } />
{ roomChatlog
? <ChatlogView records={ [ roomChatlog ] } />
: <div className="flex flex-col items-center justify-center gap-2 py-8 opacity-50 text-sm">
<FaSpinner className="animate-spin" size={ 22 } />
<span>{ LocalizeText('modtools.user.chatlog.loading') }</span>
</div> }
</NitroCardContentView>
</NitroCardView>
);