Skip to content

Commit

Permalink
Change duration to countdown in MessageAudio
Browse files Browse the repository at this point in the history
Message Audio UI should display remaining time not the duration of the
audio.
  • Loading branch information
indutny-signal committed Mar 22, 2021
1 parent 544e20e commit d6063d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions stylesheets/components/MessageAudio.scss
Expand Up @@ -228,9 +228,12 @@
}
}

.module-message__audio-attachment__duration {
.module-message__audio-attachment__countdown {
flex-shrink: 1;
margin-left: 12px;

/* Prevent text from jumping when countdown changes */
min-width: 32px;
text-align: right;

@include font-caption;

Expand Down Expand Up @@ -277,8 +280,8 @@
margin-left: 4px;
}

/* Clip the duration text when it is too long on small screens */
.module-message__audio-attachment__duration {
/* Clip the countdown text when it is too long on small screens */
.module-message__audio-attachment__countdown {
margin-left: 4px;

max-width: 46px;
Expand Down
4 changes: 3 additions & 1 deletion ts/components/conversation/MessageAudio.tsx
Expand Up @@ -523,6 +523,8 @@ export const MessageAudio: React.FC<Props> = (props: Props) => {
);
}

const countDown = duration - currentTime;

return (
<div
className={classNames(
Expand All @@ -534,7 +536,7 @@ export const MessageAudio: React.FC<Props> = (props: Props) => {
>
{button}
{waveform}
<div className={`${CSS_BASE}__duration`}>{timeToText(duration)}</div>
<div className={`${CSS_BASE}__countdown`}>{timeToText(countDown)}</div>
</div>
);
};

0 comments on commit d6063d7

Please sign in to comment.