Chats: improve attachments, make modal work

better-thread-display
Alex Gleason 2020-09-05 16:39:57 -05:00
rodzic d8d5186a01
commit 84e5175481
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 18 dodań i 4 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import { fetchChatMessages } from 'soapbox/actions/chats';
import emojify from 'soapbox/features/emoji/emoji';
import classNames from 'classnames';
import { openModal } from 'soapbox/actions/modal';
import { escape, throttle } from 'lodash';
import { MediaGallery } from 'soapbox/features/ui/util/async-components';
import Bundle from 'soapbox/features/ui/components/bundle';
@ -117,6 +118,10 @@ class ChatMessageList extends ImmutablePureComponent {
trailing: true,
});
onOpenMedia = (media, index) => {
this.props.dispatch(openModal('MEDIA', { media, index }));
};
maybeRenderMedia = chatMessage => {
const attachment = chatMessage.get('attachment');
if (!attachment) return null;
@ -125,7 +130,8 @@ class ChatMessageList extends ImmutablePureComponent {
{Component => (
<Component
media={ImmutableList([attachment])}
height={100}
height={120}
onOpenMedia={this.onOpenMedia}
/>
)}
</Bundle>

Wyświetl plik

@ -291,7 +291,15 @@
}
}
.chat-message .media-gallery__item-thumbnail img,
.chat-message .media-gallery__item-thumbnail .still-image img {
object-fit: contain;
.chat-message .media-gallery {
height: 120px !important;
.spoiler-button {
display: none;
}
&__item-thumbnail img,
&__item-thumbnail .still-image img {
object-fit: contain;
}
}