Skip to content
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

fix: Read indicator design improvements #16591

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/script/components/InputBar/InputBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,11 @@ export const InputBar = ({
</>
) : (
<>
<ul className="controls-right buttons-group">
<ul
className={cx('controls-right buttons-group', {
'controls-right-shrinked': textValue.length !== 0,
})}
>
<ControlButtons {...controlButtonsProps} showGiphyButton={showGiphyButton} />
<SendMessageButton disabled={!enableSending} onSend={handleSendMessage} />
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ export const ContentMessageComponent: React.FC<ContentMessageProps> = ({
{was_edited && (
<span className="message-header-label-icon icon-edit" title={message.displayEditedTimestamp()}></span>
)}

<span className="content-message-timestamp">
<MessageTime timestamp={timestamp} className="label-xs" data-timestamp-type="normal">
<MessageTime timestamp={timestamp} data-timestamp-type="normal">
{timeAgo}
</MessageTime>
</span>
Expand All @@ -196,18 +197,19 @@ export const ContentMessageComponent: React.FC<ContentMessageProps> = ({
message={message}
is1to1Conversation={conversation.is1to1()}
isLastDeliveredMessage={isLastDeliveredMessage}
onClick={onClickDetails}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be able to click the read icon next to the username anymore?
In that case cursor: pointer is wrongly assigned to that element

showIconOnly
/>
</MessageHeader>
)}

<div className="message-body">
<div className="message-body-content" title={ephemeral_caption}>
{ephemeral_status === EphemeralStatusType.ACTIVE && (
<div className="message-ephemeral-timer">
<EphemeralTimer message={message} />
</div>
)}

{quote && (
<Quote
conversation={conversation}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ import {CSSObject} from '@emotion/react';
export const messageReactionWrapper: CSSObject = {
display: 'flex',
gap: '0.5rem',
paddingLeft: 'var(--conversation-message-sender-width)',
paddingInline: 'var(--conversation-message-sender-width)',
flexWrap: 'wrap',
maxWidth: '100%',
marginRight: 'var(--conversation-message-timestamp-width)',
'.tooltip-content': {
backgroundColor: 'var(--white) !important',
marginBottom: '0 !important',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const ReadReceiptText: CSSObject = {
};

export const ReadIndicatorStyles = (showIconOnly = false): CSSObject => ({
color: 'var(--gray-70)',
color: 'var(--content-message-timestamp)',
fontSize: 'var(--font-size-small)',
fontWeight: 'var(--font-weight-medium)',
fontWeight: 'var(--font-weight-regular)',
lineHeight: 'var(--line-height-sm)',

svg: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface ReadIndicatorProps {
is1to1Conversation?: boolean;
isLastDeliveredMessage?: boolean;
showIconOnly?: boolean;
onClick: (message: Message) => void;
onClick?: (message: Message) => void;
}

export const ReadIndicator = ({
Expand Down Expand Up @@ -69,24 +69,29 @@ export const ReadIndicator = ({
}

const readReceiptCount = readReceipts.length;
const showEyeIndicatorOnly = showIconOnly && readReceiptCount > 0;

if (readReceiptCount === 0) {
return null;
}

if (showIconOnly) {
return (
<span css={ReadIndicatorStyles(true)} data-uie-name="status-message-read-receipts-header">
<Icon.Read />
</span>
);
}

return (
<button
css={ReadIndicatorStyles(showIconOnly)}
onClick={() => onClick(message)}
className="button-reset-default"
css={ReadIndicatorStyles(false)}
onClick={() => onClick?.(message)}
className="button-reset-default read-indicator"
data-uie-name="status-message-read-receipts"
>
{showEyeIndicatorOnly ? (
<Icon.Read />
) : (
!!readReceiptCount && (
<div css={ReadReceiptText} data-uie-name="status-message-read-receipt-count">
<Icon.Read /> {readReceiptCount}
</div>
)
)}
<div css={ReadReceiptText} data-uie-name="status-message-read-receipt-count">
<Icon.Read /> {readReceiptCount}
</div>
</button>
);
};
5 changes: 0 additions & 5 deletions src/style/common/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,6 @@ body {
body {
--conversation-message-sender-width: @conversation-message-sender-width;
--conversation-message-asset-width: 800px;

--conversation-message-timestamp-width: 140px;
@media (max-width: @screen-md-min) {
--conversation-message-timestamp-width: 60px;
}
}

// ----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/style/content/conversation.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
}

.readonly-message-container {
max-width: calc(800 - var(--conversation-message-timestamp-width));
margin-bottom: 16px;
}

Expand Down
9 changes: 5 additions & 4 deletions src/style/content/conversation/input-bar.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
.reset-textarea;

width: 100%;
max-width: calc(
@conversation-max-width - @conversation-message-sender-width - var(--conversation-message-timestamp-width)
);
max-width: @conversation-max-width;
height: auto;
min-height: @conversation-input-line-height;
max-height: @conversation-input-max-height;
Expand Down Expand Up @@ -108,11 +106,14 @@
.list-unstyled;

display: flex;
min-width: var(--conversation-message-timestamp-width);
align-items: center;
justify-content: flex-end;
margin: 0;

&.controls-right-shrinked {
min-width: auto;
}

.conversation-button {
padding: 0;
}
Expand Down
64 changes: 1 addition & 63 deletions src/style/content/conversation/message-list.less
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
max-width: @conversation-max-width;
justify-content: space-between;
padding-left: @conversation-message-sender-width;
padding-block: 4px 8px;

&-content {
width: 100%;
Expand Down Expand Up @@ -420,72 +421,9 @@
}
}

// MESSAGE FOOTER
.message-footer {
display: flex;
flex-wrap: wrap;
line-height: @avatar-diameter-xs;
}

.message-footer-text {
color: var(--gray-70);
font-size: @font-size-xsmall;

body.theme-dark & {
color: var(--gray-60);
}
}

.message-footer-icon {
.flex-center;

width: @conversation-message-sender-width;
}

.message-footer-label {
display: flex;
overflow: hidden;
flex: 1;
align-items: center;
font-size: @font-size-xs;

& > span {
overflow: hidden;
text-overflow: ellipsis;
white-space: pre;
}

> * + * {
margin-left: 8px;
}
}

.message-footer-bottom {
display: flex;
width: 100%;
flex-wrap: wrap;
margin-top: 4px;
margin-right: var(--conversation-message-timestamp-width);
margin-left: @conversation-message-sender-width;

> *:not(:last-child) {
margin-right: 8px;
margin-bottom: 8px;
}
}

.message-footer-close-button {
.square(@avatar-diameter-xs);
.flex-center;

cursor: pointer;
font-size: @font-size-xs;
}

// MESSAGE - ACTIONS
.message-body-actions {
display: flex;
min-width: var(--conversation-message-timestamp-width);
align-items: flex-start;
justify-content: flex-start;
padding: 5px;
Expand Down
5 changes: 1 addition & 4 deletions src/style/content/conversation/message-quote.less
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
.message-quote {
position: relative;
max-width: calc(
@conversation-max-width - var(--conversation-message-timestamp-width) - @conversation-message-sender-width - 16px
);
padding-right: var(--conversation-message-timestamp-width);
max-width: calc(@conversation-max-width - @conversation-message-sender-width - 16px);
padding-left: 16px;
margin-bottom: 10px;
font-size: @font-size-medium;
Expand Down
Loading