Skip to content

Commit

Permalink
fix: added star icon to message header (#300)
Browse files Browse the repository at this point in the history
* fix: added star icon to message header

* fix: made changes

* removed unused imports
  • Loading branch information
anjy7 authored Nov 9, 2023
1 parent f9855d3 commit 32f9364
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/react/src/components/Message/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,34 @@ const Message = ({
width: '100%',
}}
>
{showAvatar && (
{!sequential && showAvatar ? (
<Box style={{ margin: '3px' }}>
<Avatar
url={getUserAvatarUrl(message.u.username)}
alt="avatar"
/>
</Box>
) : message.starred &&
message.starred.find((u) => u._id === authenticatedUserId) ? (
<Box
style={{
margin: '3px',
marginTop: '15px',
marginLeft: '20px',
}}
>
<Icon
style={{ opacity: 0.5 }}
name="star-filled"
size="1.2em"
/>
</Box>
) : (
<Box
style={{
marginLeft: '42px',
}}
></Box>
)}
<Box
style={{
Expand Down
9 changes: 9 additions & 0 deletions packages/react/src/components/Message/MessageHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const MessageHeaderTimestapCss = css`
color: #9ea2a8;
`;

const authenticatedUserId = useUserStore(state => state.userId);

const MessageHeader = ({ message }) => {
const { styleOverrides, classNames } = useComponentOverrides('MessageHeader');
const roles = useUserStore((state) => state.roles);
Expand Down Expand Up @@ -126,6 +128,13 @@ const MessageHeader = ({ message }) => {
size="1em"
/>
)}
{message.starred && message.starred.find((u) => u._id === authenticatedUserId) && (
<Icon
style={{ marginInlineEnd: '0.4rem', opacity: 0.5 }}
name="star"
size="1em"
/>
)}
</Box>
);
}
Expand Down

0 comments on commit 32f9364

Please sign in to comment.