|
|
|
@ -23,7 +23,7 @@ const messages = defineMessages({
|
|
|
|
|
|
|
|
|
|
interface IMediaModal {
|
|
|
|
|
media: ImmutableList<Attachment>,
|
|
|
|
|
status: Status,
|
|
|
|
|
status?: Status,
|
|
|
|
|
account: Account,
|
|
|
|
|
index: number,
|
|
|
|
|
time?: number,
|
|
|
|
@ -96,17 +96,17 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
|
|
|
|
const handleStatusClick: React.MouseEventHandler = e => {
|
|
|
|
|
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
history.push(`/@${account.acct}/posts/${status.id}`);
|
|
|
|
|
history.push(`/@${account.acct}/posts/${status?.id}`);
|
|
|
|
|
onClose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleCloserClick: React.MouseEventHandler = ({ currentTarget }) => {
|
|
|
|
|
const handleCloserClick: React.MouseEventHandler = ({ target }) => {
|
|
|
|
|
const whitelist = ['zoomable-image'];
|
|
|
|
|
const activeSlide = document.querySelector('.media-modal .react-swipeable-view-container > div[aria-hidden="false"]');
|
|
|
|
|
|
|
|
|
|
const isClickOutside = currentTarget === activeSlide || !activeSlide?.contains(currentTarget);
|
|
|
|
|
const isWhitelisted = whitelist.some(w => currentTarget.classList.contains(w));
|
|
|
|
|
const isClickOutside = target === activeSlide || !activeSlide?.contains(target as Element);
|
|
|
|
|
const isWhitelisted = whitelist.some(w => (target as Element).classList.contains(w));
|
|
|
|
|
|
|
|
|
|
if (isClickOutside || isWhitelisted) {
|
|
|
|
|
onClose();
|
|
|
|
@ -209,7 +209,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
|
|
|
|
<Audio
|
|
|
|
|
src={attachment.url}
|
|
|
|
|
alt={attachment.description}
|
|
|
|
|
poster={attachment.preview_url !== attachment.url ? attachment.preview_url : (status.getIn(['account', 'avatar_static'])) as string | undefined}
|
|
|
|
|
poster={attachment.preview_url !== attachment.url ? attachment.preview_url : (status?.getIn(['account', 'avatar_static'])) as string | undefined}
|
|
|
|
|
backgroundColor={attachment.meta.getIn(['colors', 'background']) as string | undefined}
|
|
|
|
|
foregroundColor={attachment.meta.getIn(['colors', 'foreground']) as string | undefined}
|
|
|
|
|
accentColor={attachment.meta.getIn(['colors', 'accent']) as string | undefined}
|
|
|
|
|