Fix mod menu showing. Closes #1990

This commit is contained in:
Gabe Kangas 2022-08-10 21:41:56 -07:00
parent cf03a37aed
commit a7bbb06ea5
No known key found for this signature in database
GPG key ID: 9A56337728BC81EA
4 changed files with 7 additions and 5 deletions

View file

@ -87,6 +87,7 @@ export default function ChatContainer(props: Props) {
highlightString={usernameToHighlight} // What to highlight in the message
sentBySelf={message.user?.id === chatUserId} // The local user sent this message
sameUserAsLast={isSameUserAsLast(messages, index)}
isAuthorModerator={(message as ChatMessage).user.scopes.includes('MODERATOR')}
key={message.id}
/>
);

View file

@ -1,6 +1,7 @@
.root {
* {
z-index: 100; }
z-index: 100;
}
position: relative;
font-size: 0.9rem;
padding: 5px 15px 5px 5px;
@ -10,9 +11,6 @@
align-items: center;
font-family: var(--theme-header-font-family);
font-weight: bold;
.userName {
margin-left: 0.3rem;
}
}
.message {
color: var(--theme-text-primary);

View file

@ -16,6 +16,7 @@ interface Props {
highlightString: string;
sentBySelf: boolean;
sameUserAsLast: boolean;
isAuthorModerator: boolean;
}
export default function ChatUserMessage({
@ -24,6 +25,7 @@ export default function ChatUserMessage({
showModeratorMenu,
sentBySelf, // Move the border to the right and render a background
sameUserAsLast,
isAuthorModerator,
}: Props) {
const { body, user, timestamp } = message;
const { displayName, displayColor } = user;
@ -47,8 +49,8 @@ export default function ChatUserMessage({
>
{!sameUserAsLast && (
<div className={s.user} style={{ color }}>
{showModeratorMenu && <ModIcon />}
<span className={s.userName}>{displayName}</span>
{isAuthorModerator && <ModIcon />}
</div>
)}
<Highlight search={highlightString}>

View file

@ -85,6 +85,7 @@ export const FromModeratorUser = Template.bind({});
FromModeratorUser.args = {
message: moderatorMessage,
showModeratorMenu: false,
isAuthorModerator: true,
};
export const FromAuthenticatedUser = Template.bind({});