Skip to content
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
87 changes: 8 additions & 79 deletions src/components/Attachment/styling/Attachment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,37 +143,6 @@
/* Box shadow applied to file attachments */
--str-chat__file-attachment-box-shadow: none;

/* Border radius applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-border-radius: calc(
var(--str-chat__message-bubble-border-radius) - var(--str-chat__attachment-margin)
);

/* Text color used in audio recording widget */
--str-chat__voice-recording-attachment-widget-color: var(--str-chat__text-color);

/* Border radius applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-secondary-color: var(
--str-chat__text-low-emphasis-color
);

/* The text/icon color for low emphasis texts (for example file size) in audio recording widget */
--str-chat__voice-recording-attachment-widget-background-color: transparent;

/* Top border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-block-start: none;

/* Bottom border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-block-end: none;

/* Left (right in RTL layout) border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-inline-start: none;

/* Right (left in RTL layout) border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-inline-end: none;

/* Box shadow applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-box-shadow: none;

/* Border radius applied to the play / pause button of audio widget */
--str-chat__audio-attachment-controls-button-border-radius: var(
--str-chat__border-radius-circle
Expand Down Expand Up @@ -382,49 +351,6 @@
@include utils.component-layer-overrides('file-attachment');
}

.str-chat__message-attachment__voice-recording-widget {
@include utils.component-layer-overrides('voice-recording-attachment-widget');
display: flex;
align-items: center;
justify-content: center;
padding-block: var(--spacing-xs);
padding-inline-start: var(--spacing-xs);
padding-inline-end: var(--spacing-sm);
min-height: 60px;

.str-chat__message-attachment__voice-recording-widget__play-button-container {
padding: var(--spacing-xxs);
}

.str-chat__message-attachment__voice-recording-widget__metadata {
flex: 1;
min-width: 180px;
padding-inline: var(--spacing-xs);

a {
cursor: pointer;
text-decoration: none;
color: var(--str-chat__voice-recording-attachment-widget-color);
}

.str-chat__message-attachment-download-icon {
svg {
width: calc(var(--str-chat__spacing-px) * 24);
height: calc(var(--str-chat__spacing-px) * 16);
}
}
}

.str-chat__message-attachment__voice-recording-widget__right-section {
}

.str-chat__message-attachment__voice-recording-widget__timer {
min-width: calc(var(--str-chat__spacing-px) * 40);
width: calc(var(--str-chat__spacing-px) * 40);
font: var(--str-chat__metadata-emphasis-text);
}
}

.str-chat__message-attachment-with-actions.str-chat__message-attachment--giphy {
}

Expand All @@ -433,6 +359,14 @@
}
}

.str-chat__message.str-chat__message--has-single-attachment.str-chat__message--has-no-text:not(
.str-chat__message--has-quoted-message
) {
.str-chat__message-bubble {
padding: 0;
}
}

.str-chat__message.str-chat__message--has-single-attachment.str-chat__message--has-no-text {
.str-chat__message-bubble {
border: 1px solid var(--chat-border-incoming);
Expand All @@ -441,11 +375,6 @@

.str-chat__message-attachment {
background-color: var(--chat-bg-incoming);

.str-chat__message-attachment__voice-recording-widget {
padding: unset;
padding-inline-end: var(--spacing-xxs);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Attachment/styling/Audio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

.str-chat__message-attachment-file--item-size {
line-height: calc(var(--str-chat__spacing-px) * 14);
font: var(--str-chat__font-metadata-default);
}
}
}
74 changes: 74 additions & 0 deletions src/components/Attachment/styling/VoiceRecording.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@use '../../../styling/utils';

.str-chat {
/* Border radius applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-border-radius: calc(
var(--str-chat__message-bubble-border-radius) - var(--str-chat__attachment-margin)
);

/* Text color used in audio recording widget */
--str-chat__voice-recording-attachment-widget-color: var(--str-chat__text-color);

/* Border radius applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-secondary-color: var(
--str-chat__text-low-emphasis-color
);

/* The text/icon color for low emphasis texts (for example file size) in audio recording widget */
--str-chat__voice-recording-attachment-widget-background-color: transparent;

/* Top border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-block-start: none;

/* Bottom border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-block-end: none;

/* Left (right in RTL layout) border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-inline-start: none;

/* Right (left in RTL layout) border of audio recording widget */
--str-chat__voice-recording-attachment-widget-border-inline-end: none;

/* Box shadow applied to audio recording widget */
--str-chat__voice-recording-attachment-widget-box-shadow: none;
}

.str-chat__message-attachment__voice-recording-widget {
@include utils.component-layer-overrides('voice-recording-attachment-widget');
display: flex;
align-items: center;
justify-content: center;
min-height: 60px;
padding: var(--spacing-xs);

.str-chat__message-attachment__voice-recording-widget__play-button-container {
padding: var(--spacing-xxs);
}

.str-chat__message-attachment__voice-recording-widget__metadata {
flex: 1;
min-width: 180px;

a {
cursor: pointer;
text-decoration: none;
color: var(--str-chat__voice-recording-attachment-widget-color);
}

.str-chat__message-attachment-download-icon {
svg {
width: calc(var(--str-chat__spacing-px) * 24);
height: calc(var(--str-chat__spacing-px) * 16);
}
}
}

.str-chat__message-attachment__voice-recording-widget__right-section {
}

.str-chat__message-attachment__voice-recording-widget__timer {
min-width: calc(var(--str-chat__spacing-px) * 40);
width: calc(var(--str-chat__spacing-px) * 40);
font: var(--str-chat__metadata-emphasis-text);
}
}
1 change: 1 addition & 0 deletions src/components/Attachment/styling/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
@use 'LinkPreview';
@use 'ModalGallery';
@use 'UnsupportedAttachment';
@use 'VoiceRecording';
6 changes: 4 additions & 2 deletions src/components/Message/MessageUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
isMessageErrorRetryable,
messageHasAttachments,
messageHasGiphyAttachment,
messageHasQuotedMessage,
messageHasReactions,
messageHasSingleAttachment,
messageTextHasEmojisOnly,
Expand Down Expand Up @@ -125,6 +126,7 @@ const MessageUIWithContext = ({
const hasSingleAttachment = !isDeleted && messageHasSingleAttachment(message);
const hasGiphyAttachment = !isDeleted && messageHasGiphyAttachment(message);
const hasReactions = !isDeleted && messageHasReactions(message);
const hasQuotedMessage = !isDeleted && messageHasQuotedMessage(message);
const textHasEmojisOnly = !isDeleted && messageTextHasEmojisOnly(message);

const allowRetry = isMessageErrorRetryable(message);
Expand All @@ -142,9 +144,9 @@ const MessageUIWithContext = ({
'str-chat__message--has-attachment': hasAttachment,
'str-chat__message--has-giphy-attachment': hasGiphyAttachment,
'str-chat__message--has-no-text': !message.text,
'str-chat__message--has-text': !!message.text,
// eslint-disable-next-line sort-keys
'str-chat__message--has-quoted-message': hasQuotedMessage,
'str-chat__message--has-single-attachment': hasSingleAttachment,
'str-chat__message--has-text': !!message.text,
'str-chat__message--highlighted': highlighted,
'str-chat__message--is-emoji-only': textHasEmojisOnly,
[`str-chat__message--is-emoji-only-count-${countEmojis(message.text)}`]:
Expand Down
3 changes: 3 additions & 0 deletions src/components/Message/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ export const areMessageUIPropsEqual = (
export const messageHasReactions = (message?: LocalMessage) =>
Object.values(message?.reaction_groups ?? {}).some(({ count }) => count > 0);

export const messageHasQuotedMessage = (message?: LocalMessage) =>
!!message?.quoted_message;

export const messageHasAttachments = (message?: LocalMessage) =>
!!message?.attachments && !!message.attachments.length;

Expand Down
Loading