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

2
src/components/audio.ts

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

12
src/components/chat/pinnedContainer.ts

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

4
src/components/chat/pinnedMessage.ts

@ -288,7 +288,9 @@ export default class ChatPinnedMessage { @@ -288,7 +288,9 @@ export default class ChatPinnedMessage {
this.animatedCounter = new AnimatedCounter(true);
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});

2
src/components/wrappers.ts

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

12
src/scss/partials/_chatPinned.scss

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

Loading…
Cancel
Save