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
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 highlightString={usernameToHighlight} // What to highlight in the message
sentBySelf={message.user?.id === chatUserId} // The local user sent this message sentBySelf={message.user?.id === chatUserId} // The local user sent this message
sameUserAsLast={isSameUserAsLast(messages, index)} sameUserAsLast={isSameUserAsLast(messages, index)}
isAuthorModerator={(message as ChatMessage).user.scopes.includes('MODERATOR')}
key={message.id} key={message.id}
/> />
); );

View File

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

View File

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

View File

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