Browse Source

Some fixes

master
morethanwords 3 years ago
parent
commit
bd7350ac74
  1. 10
      src/components/appMediaPlaybackController.ts
  2. 2
      src/components/audio.ts
  3. 12
      src/components/chat/pinnedContainer.ts
  4. 4
      src/components/chat/pinnedMessage.ts
  5. 2
      src/components/wrappers.ts
  6. 12
      src/scss/partials/_chatPinned.scss

10
src/components/appMediaPlaybackController.ts

@ -703,10 +703,12 @@ class AppMediaPlaybackController {
return () => { return () => {
this.toggleSwitchers(true); this.toggleSwitchers(true);
if(this.mediaDetails.get(playingMedia)) { if(playingMedia) {
this.setMedia(playingMedia, this.getMessageByMedia(playingMedia)); if(this.mediaDetails.get(playingMedia)) {
} else { this.setMedia(playingMedia, this.getMessageByMedia(playingMedia));
this.next() || this.previous(); } else {
this.next() || this.previous();
}
} }
if(this.playingMedia === media) { if(this.playingMedia === media) {

2
src/components/audio.ts

@ -246,7 +246,7 @@ function wrapAudio(audioEl: AudioElement) {
} }
if(withTime) { if(withTime) {
parts.push(formatFullSentTime(doc.date)); parts.push(formatFullSentTime(message.date));
} else if(!parts.length) { } else if(!parts.length) {
parts.push(formatBytes(doc.size)); parts.push(formatBytes(doc.size));
} }

12
src/components/chat/pinnedContainer.ts

@ -32,7 +32,7 @@ export default class PinnedContainer {
protected floating = false; protected floating = false;
protected onClose?: () => void | Promise<boolean>; public onClose?: () => void | Promise<boolean>;
constructor(options: { constructor(options: {
topbar: PinnedContainer['topbar'], topbar: PinnedContainer['topbar'],
@ -45,7 +45,7 @@ export default class PinnedContainer {
}) { }) {
safeAssign(this, options); safeAssign(this, options);
const {divAndCaption, className, onClose} = this; const {divAndCaption, className} = this;
divAndCaption.container.classList.add(CLASSNAME_BASE, 'hide'); divAndCaption.container.classList.add(CLASSNAME_BASE, 'hide');
divAndCaption.title.classList.add(CLASSNAME_BASE + '-title'); divAndCaption.title.classList.add(CLASSNAME_BASE + '-title');
divAndCaption.subtitle.classList.add(CLASSNAME_BASE + '-subtitle'); divAndCaption.subtitle.classList.add(CLASSNAME_BASE + '-subtitle');
@ -66,10 +66,14 @@ export default class PinnedContainer {
divAndCaption.container.append(this.wrapper/* , this.close */); divAndCaption.container.append(this.wrapper/* , this.close */);
attachClickEvent(this.btnClose, (e) => { this.attachOnCloseEvent(this.btnClose);
}
public attachOnCloseEvent(elem: HTMLElement) {
attachClickEvent(elem, (e) => {
cancelEvent(e); cancelEvent(e);
((onClose ? onClose() : null) || Promise.resolve(true)).then(needClose => { ((this.onClose ? this.onClose() : null) || Promise.resolve(true)).then(needClose => {
if(needClose) { if(needClose) {
this.toggle(true); this.toggle(true);
} }

4
src/components/chat/pinnedMessage.ts

@ -288,7 +288,9 @@ export default class ChatPinnedMessage {
this.animatedCounter = new AnimatedCounter(true); this.animatedCounter = new AnimatedCounter(true);
dAC.title.append(i18n('PinnedMessage'), ' ', this.animatedCounter.container); dAC.title.append(i18n('PinnedMessage'), ' ', this.animatedCounter.container);
dAC.container.prepend(this.pinnedMessageContainer.btnClose); const btnClose = this.pinnedMessageContainer.btnClose.cloneNode(true) as HTMLElement;
this.pinnedMessageContainer.attachOnCloseEvent(btnClose);
dAC.container.prepend(btnClose);
this.btnOpen = ButtonIcon('pinlist pinned-container-close pinned-message-pinlist', {noRipple: true}); this.btnOpen = ButtonIcon('pinlist pinned-container-close pinned-message-pinlist', {noRipple: true});

2
src/components/wrappers.ts

@ -611,7 +611,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
const descriptionParts: (HTMLElement | string | DocumentFragment)[] = [formatBytes(doc.size)]; const descriptionParts: (HTMLElement | string | DocumentFragment)[] = [formatBytes(doc.size)];
if(withTime) { if(withTime) {
descriptionParts.push(formatFullSentTime(doc.date)); descriptionParts.push(formatFullSentTime(message.date));
} }
if(showSender) { if(showSender) {

12
src/scss/partials/_chatPinned.scss

@ -271,6 +271,7 @@
height: 100%; height: 100%;
border-radius: 0; border-radius: 0;
z-index: 0; z-index: 0;
max-width: 100%;
@include respond-to(handhelds) { @include respond-to(handhelds) {
padding: 0 .5rem; padding: 0 .5rem;
@ -334,10 +335,6 @@
flex: 0 0 auto; flex: 0 0 auto;
} }
&-close {
display: none;
}
&-wrapper { &-wrapper {
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 auto;
@ -421,7 +418,11 @@
margin-right: 2.25rem; margin-right: 2.25rem;
} */ } */
.pinned-message-close { .pinned-container-wrapper-utils {
display: none;
}
> .pinned-message-close {
display: flex; display: flex;
margin-right: .75rem; margin-right: .75rem;
order: 0; order: 0;
@ -582,6 +583,7 @@
&.is-floating { &.is-floating {
--container-height: var(--pinned-audio-height); --container-height: var(--pinned-audio-height);
z-index: 1; // fix z-index for volume selector
} }
&:not(.is-floating) { &:not(.is-floating) {

Loading…
Cancel
Save