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 images improvements #16605

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
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const ImageAsset: React.FC<ImageAssetProps> = ({

const imageContainerStyle: CSSObject = {
aspectRatio: isFileSharingReceivingEnabled ? `${asset.ratio}` : undefined,
maxWidth: '100%',
maxWidth: 'var(--conversation-message-asset-width)',
width: asset.width,
maxHeight: '80vh',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ const ContentAsset = ({

switch (asset.type) {
case AssetType.TEXT:
const shouldRenderText = (asset as Text).should_render_text();
const renderText = (asset as Text).render(selfId, message.accent_color());

return (
<>
{(asset as Text).should_render_text() && (
{shouldRenderText && (
<TextMessageRenderer
onMessageClick={onClickMessage}
text={(asset as Text).render(selfId, message.accent_color())}
text={renderText}
className={cx('text', {
'text-foreground': [StatusType.FAILED, StatusType.FEDERATION_ERROR, StatusType.SENDING].includes(
status,
Expand All @@ -90,18 +93,30 @@ const ContentAsset = ({
isFocusable={isMessageFocused}
/>
)}

{shouldRenderText && (
<ReadIndicator
message={message}
is1to1Conversation={is1to1Conversation}
isLastDeliveredMessage={isLastDeliveredMessage}
onClick={onClickDetails}
/>
)}

{(asset as Text).previews().map(preview => (
<div key={asset.id} className="message-asset">
<LinkPreviewAsset message={message} isFocusable={isMessageFocused} />

{!shouldRenderText && (
<ReadIndicator
message={message}
is1to1Conversation={is1to1Conversation}
isLastDeliveredMessage={isLastDeliveredMessage}
onClick={onClickDetails}
/>
)}
</div>
))}

<ReadIndicator
message={message}
is1to1Conversation={is1to1Conversation}
isLastDeliveredMessage={isLastDeliveredMessage}
onClick={onClickDetails}
/>
</>
);
case AssetType.FILE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {CSSObject} from '@emotion/react';
export const ReadReceiptText: CSSObject = {
display: 'inline-flex',
alignItems: 'center',
verticalAlign: 'bottom',
verticalAlign: 'text-bottom',
};

export const ReadIndicatorStyles = (showIconOnly = false): CSSObject => ({
Expand All @@ -45,7 +45,6 @@ export const ReadIndicatorStyles = (showIconOnly = false): CSSObject => ({
}),

'.message-asset &': {
marginTop: '8px',
marginLeft: '12px',
},

Expand Down
3 changes: 1 addition & 2 deletions src/style/components/asset/link-preview-asset.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
// variables
@link-preview-height: 88px;

link-preview-asset,
.link-preview-asset {
.asset-container-style;
width: 100%;
}

.link-preview-asset {
display: flex;
width: 100%;
max-width: var(--conversation-message-asset-width);
cursor: pointer;

&.ephemeral-asset-expired {
Expand Down
2 changes: 2 additions & 0 deletions src/style/components/asset/video-asset.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
.video-asset {
position: relative;
display: block;
max-width: var(--conversation-message-asset-width);
flex: 1 1 auto;

&__container {
.asset-container-style;
Expand Down
29 changes: 12 additions & 17 deletions src/style/content/conversation/message-list.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
// MESSAGE
.message {
position: relative;
margin-bottom: 16px;

& * {
.accent-selection;
Expand Down Expand Up @@ -315,6 +314,11 @@
&-content {
width: 100%;
max-width: calc(@conversation-max-width - var(--conversation-message-sender-width));
height: fit-content;

.text:has(> .iframe-container) {
margin-right: 0;
}
}

.text {
Expand Down Expand Up @@ -342,23 +346,14 @@
line-height: 2.5rem;
}

.iframe-container {
embed,
iframe,
object {
max-width: var(--conversation-message-asset-width);
margin-top: 16px;
margin-bottom: 24px;
aspect-ratio: 16 / 9;
}

.iframe-container-video {
position: relative;
padding-bottom: 75%;

embed,
iframe,
object {
position: absolute;
left: 0;
max-width: 100%;
}
}
.message-ephemeral-timer {
position: absolute;
top: 2px;
Expand Down Expand Up @@ -388,7 +383,8 @@
.image-asset {
position: relative;
display: flex;
margin: 8px 0 24px;
max-width: var(--conversation-message-asset-width);
margin: 0 0 24px;
cursor: pointer;

&--no-image {
Expand Down Expand Up @@ -727,7 +723,6 @@
// MESSAGE SPACING
.message-asset {
display: flex;
max-width: var(--conversation-message-asset-width);
align-items: flex-start;
margin-top: 8px;
}
Expand Down
Loading