Browse Source

Fix bubble time white space

master
morethanwords 3 years ago
parent
commit
08cf99e749
  1. 4
      .env
  2. 31
      src/components/chat/messageRender.ts
  3. 6
      src/scss/partials/_chatBubble.scss

4
.env

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
API_ID=1025907
API_HASH=452b0359b988148995f22ff0f4229750
VERSION=0.9.1
VERSION_FULL=0.9.1 (28)
BUILD=28
VERSION_FULL=0.9.1 (29)
BUILD=29

31
src/components/chat/messageRender.ts

@ -15,6 +15,15 @@ import { wrapReply } from "../wrappers"; @@ -15,6 +15,15 @@ import { wrapReply } from "../wrappers";
import Chat from "./chat";
import RepliesElement from "./replies";
const NBSP = ' ';
const makeEdited = () => {
const edited = document.createElement('i');
edited.classList.add('edited');
_i18n(edited, 'EditedMessage');
return edited;
};
export namespace MessageRender {
/* export const setText = () => {
@ -32,26 +41,24 @@ export namespace MessageRender { @@ -32,26 +41,24 @@ export namespace MessageRender {
const postViewsSpan = document.createElement('span');
postViewsSpan.classList.add('post-views');
postViewsSpan.innerText = formatNumber(message.views, 1);
postViewsSpan.innerHTML = formatNumber(message.views, 1);
const channelViews = document.createElement('i');
channelViews.classList.add('tgico-channelviews', 'time-icon');
args.push(postViewsSpan, ' ', channelViews);
args.push(postViewsSpan, channelViews);
if(postAuthor) {
const span = document.createElement('span');
span.innerHTML = RichTextProcessor.wrapEmojiText(postAuthor);
args.push(span, ', ');
span.innerHTML = RichTextProcessor.wrapEmojiText(postAuthor) + ',' + NBSP;
args.push(span);
}
}
let editedSpan: HTMLElement;
if(message.edit_date && chat.type !== 'scheduled' && !message.pFlags.edit_hide) {
bubble.classList.add('is-edited');
const edited = document.createElement('i');
edited.classList.add('edited');
_i18n(edited, 'EditedMessage');
args.unshift(edited);
args.unshift(editedSpan = makeEdited());
}
if(chat.type !== 'pinned' && message.pFlags.pinned) {
@ -77,8 +84,12 @@ export namespace MessageRender { @@ -77,8 +84,12 @@ export namespace MessageRender {
inner.classList.add('inner', 'tgico');
inner.title = title;
const clonedArgs = args.slice(0, -1).map(a => a instanceof HTMLElement ? a.cloneNode(true) : a);
clonedArgs.push(formatTime(date)); // clone time
let clonedArgs = args;
if(editedSpan) {
clonedArgs[clonedArgs.indexOf(editedSpan)] = makeEdited();
}
clonedArgs = clonedArgs.map(a => a instanceof HTMLElement && !a.classList.contains('i18n') ? a.cloneNode(true) as HTMLElement : a);
clonedArgs[clonedArgs.length - 1] = formatTime(date); // clone time
inner.append(...clonedArgs);
timeSpan.append(inner);

6
src/scss/partials/_chatBubble.scss

@ -1558,8 +1558,8 @@ $bubble-beside-button-width: 38px; @@ -1558,8 +1558,8 @@ $bubble-beside-button-width: 38px;
cursor: pointer;
i {
font-size: 1.15rem;
margin-right: .4rem;
font-size: 1.125rem;
margin-right: .375rem;
}
&-icon {
@ -1569,7 +1569,7 @@ $bubble-beside-button-width: 38px; @@ -1569,7 +1569,7 @@ $bubble-beside-button-width: 38px;
i.edited {
overflow: visible;
font-size: .8rem;
font-size: inherit;
}
.inner {

Loading…
Cancel
Save