mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
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:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user