feat(mod-tools): reactive box + bug fixes in useModTools

ModToolsView
- Subscribe to useRoomUserListSnapshot so the selected user's
  "still in room" state is reactive — green dot when the user is
  in the current room, gray dot when they've left. Previously the
  selection was a static capture at click time.
- Add an inline X to clear the selected-user slot without having
  to click a different avatar.
- Report Tool button shows a count badge for OPEN tickets
  (IssueMessageData.STATE_OPEN) so a new ticket arriving while
  the panel is open is visible immediately. Caps display at 99+.
- Tooltip on the room-bound buttons explains why they're disabled
  ("Enter a room first") instead of showing a silent disabled state.
- Buttons grow their labels with `flex-grow text-start` so the
  trailing dot / badge / clear-X sits flush right.

useModTools
- Fix splice(index) → splice(index, 1) in close{Room,RoomChatlog,
  UserInfo,UserChatlog} — the omitted second argument was
  silently deleting EVERY subsequent open panel, not just the one
  being closed. Visible whenever a moderator had two or more panels
  of the same kind open.
- Fix toggleUserChatlog reading from openRoomChatlogs instead of
  openUserChatlogs — copy-paste typo made the toggle inconsistent
  with the underlying state.
This commit is contained in:
simoleo89
2026-05-19 22:12:19 +02:00
parent 888a6a3255
commit 5c3589c29e
2 changed files with 66 additions and 18 deletions
+5 -5
View File
@@ -30,7 +30,7 @@ const useModToolsState = () =>
const newValue = [ ...prevValue ];
const existingIndex = newValue.indexOf(roomId);
if(existingIndex >= 0) newValue.splice(existingIndex);
if(existingIndex >= 0) newValue.splice(existingIndex, 1);
return newValue;
});
@@ -56,7 +56,7 @@ const useModToolsState = () =>
const newValue = [ ...prevValue ];
const existingIndex = newValue.indexOf(roomId);
if(existingIndex >= 0) newValue.splice(existingIndex);
if(existingIndex >= 0) newValue.splice(existingIndex, 1);
return newValue;
});
@@ -82,7 +82,7 @@ const useModToolsState = () =>
const newValue = [ ...prevValue ];
const existingIndex = newValue.indexOf(userId);
if(existingIndex >= 0) newValue.splice(existingIndex);
if(existingIndex >= 0) newValue.splice(existingIndex, 1);
return newValue;
});
@@ -108,7 +108,7 @@ const useModToolsState = () =>
const newValue = [ ...prevValue ];
const existingIndex = newValue.indexOf(userId);
if(existingIndex >= 0) newValue.splice(existingIndex);
if(existingIndex >= 0) newValue.splice(existingIndex, 1);
return newValue;
});
@@ -116,7 +116,7 @@ const useModToolsState = () =>
const toggleUserChatlog = (userId: number) =>
{
if(openRoomChatlogs.indexOf(userId) >= 0) closeUserChatlog(userId);
if(openUserChatlogs.indexOf(userId) >= 0) closeUserChatlog(userId);
else openUserChatlog(userId);
};