-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Improved delivered status indicator WPB-9170 #17553
base: dev
Are you sure you want to change the base?
Conversation
fontSize: 'var(--font-size-small)', | ||
fontWeight: 'var(--font-weight-regular)', | ||
wordWrap: 'normal', | ||
width: 'min-content', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One translation of "Delivered" is two words, here I make sure they will be wrapped
boxSizing: 'border-box', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
position: 'absolute', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's another self-positioned component
isLastDeliveredMessage, | ||
onClickDetails, | ||
}: ReadReceiptStatusProps) => { | ||
export const ReadReceiptStatus = ({message, is1to1Conversation, onClickDetails}: ReadReceiptStatusProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one can be moved to the ReadIndicator
folder, which will make it easier to not forget about one of them when the other should be changed
@@ -22,7 +22,7 @@ | |||
width: 100%; | |||
flex-wrap: wrap; | |||
align-self: center; | |||
padding: 12px; | |||
padding: 12px 0 12px 12px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the general designer's idea was to introduce additional whitespace at the right of the conversation, I guess we don't need the right padding of the message bodies
})} | ||
{...(ephemeralCaption && {title: ephemeralCaption})} | ||
aria-label={messageAriaLabel} | ||
className="content-message-wrapper" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding here className={cx('content-message-wrapper', { 'width': `calc(100% - ${deliveryIndicatorRef?.offsetWidth || 0}px)` })}
doesn't work
aria-label={messageAriaLabel} | ||
className="content-message-wrapper" | ||
css={{ | ||
width: `calc(100% - ${deliveryIndicatorRef?.offsetWidth || 0}px)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried playing with display: flex
and overflow
etc. and with some of the message content (images, pre
) the message was stretching outside of the screen
/> | ||
)} | ||
</div> | ||
<DeliveredIndicator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option was to add it on the level of the MessageWrapper
, but I'm not sure it won't break again the stretching of the message for content like pre
, and maybe we will need completely different behaviour for different kinds of messages. Also, it avoids additional div
containers
fontWeight: 'var(--font-weight-regular)', | ||
wordWrap: 'normal', | ||
width: 'min-content', | ||
visibility: isLastDeliveredMessage ? 'unset' : 'hidden', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how else to add the empty space of the dynamic width (the width of the translated longest word of "Delivered" plus padding). I guess it is possible to set the width once for all somewhere globally, even set the global right margin for the messages container, and only add one span
for the last delivered message.
@@ -274,7 +274,6 @@ | |||
// MESSAGE - BODY | |||
.message-body { | |||
position: relative; | |||
padding-right: 40px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - we already have one big whitespace at the right, we don't need this one anymore
0e07132
to
37704a7
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #17553 +/- ##
==========================================
+ Coverage 46.11% 46.13% +0.01%
==========================================
Files 760 762 +2
Lines 25016 25025 +9
Branches 5721 5722 +1
==========================================
+ Hits 11537 11546 +9
+ Misses 12036 12035 -1
- Partials 1443 1444 +1 |
09c9a8e
to
b29dcc4
Compare
b29dcc4
to
cd20f5a
Compare
display: 'inline-flex', | ||
alignItems: 'center', | ||
minHeight: '32px', | ||
minWidth: '40px', | ||
position: 'absolute', | ||
right: '16px', | ||
right: `${16 - rightMarginWidth}px`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to position reactions menu to look in the old way - 16px from the right of the screen, not of the message container. I can't use position: fixed
as I need it only horizontally, and vertically it should still be relative to the parent, to be scrolled. I also tried to play with left: (100vw - 100% - 16px)
, but 100%
is a message container, already resized to the right margin of the MessageList
container with margin, so it gives the same result as right: 16px
.
cd20f5a
to
5127b89
Compare
message: ContentMessage; | ||
onClickButton: (message: CompositeMessage, buttonId: string) => void; | ||
onRetry: (message: ContentMessage) => void; | ||
quotedMessage?: ContentMessage; | ||
selfId: QualifiedId; | ||
isMsgElementsFocusable: boolean; | ||
onClickReaction: (emoji: string) => void; | ||
rightMarginWidth: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this implementation, rightMarginWidth
gets calculated in MessageList
and must be used to correctly position MessageActionsMenu
(in old way, aligned to the screen, ignoring the new margin). It can be made as a context to not do this long chain-propsing
return ( | ||
<> | ||
{rightMarginWidth === 0 && <DeliveredIndicator ref={setDeliveredIndicatorWidth} isLastDeliveredMessage={false} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we agree on this approach, it can be modified to
if(rightMarginWidth === 0) return <DeliveredIndicator ref={setDeliveredIndicatorWidth} isLastDeliveredMessage={false} />
return ( ...
to avoid one extra render. Then the MessageList.test
must be adjusted to ignore the first render
@@ -121,6 +122,8 @@ export const MessagesList: FC<MessagesListParams> = ({ | |||
const [highlightedMessage, setHighlightedMessage] = useState<string | undefined>(conversation.initialMessage()?.id); | |||
const conversationLastReadTimestamp = useRef(conversation.last_read_timestamp()); | |||
|
|||
const [rightMarginWidth, setRightMarginWidth] = useState<number>(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also can be ref, to avoid each time getting recalculated and re-rendered all the time, but should be recalculated on the language switch.
5127b89
to
450d23b
Compare
|
Description
Now the conversation should have additional empty space at the right, and the last delivered message should contain a translated "Delivered" indicator, visible always (instead of on mouse over).
This feature design was made considering that most of the webapp/desktop users use it on res 800px+, design improvements for smaller screens will be defined later.
After this version is deployed, we might implement another design with checkboxes (under a separate ticket) that can be toggled using debug
Note 1: for the first implementation, where each message had an additional div to the right: I assumed that any message header would be short enough to not wrap it into the container that takes
100% - ${deliveredIndicatorWidth}px
. It might be the improvement for the next design iteration to address the small screen lookNote 2: for the second implementation, where the entire
MessageList
has a margin: Now theMessageList
has to add and immediately remove the "Delivered" indicator to identify its width. Another option could be to add a static margin (of ~100px) and listen to the message components when one of them will have to add this indicator, then adjust the margin width. Another option could be that each message component could have a margin, but I'm not sure what we will win hereScreenshots/Screencast (for UI changes)
Checklist