Fix 'View context' button
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e9a2b65963
commit
519c4fb252
|
@ -56,7 +56,7 @@ const MediaItem: React.FC<IMediaItem> = ({ attachment, displayWidth, onOpenMedia
|
||||||
const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`;
|
const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`;
|
||||||
const height = width;
|
const height = width;
|
||||||
const status = attachment.get('status');
|
const status = attachment.get('status');
|
||||||
const title = status.get('spoiler_text') || attachment.get('description');
|
const title = status.get('spoiler_text') || attachment.get('description');
|
||||||
|
|
||||||
let thumbnail: React.ReactNode = '';
|
let thumbnail: React.ReactNode = '';
|
||||||
let icon;
|
let icon;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Icon from 'soapbox/components/icon';
|
||||||
import IconButton from 'soapbox/components/icon-button';
|
import IconButton from 'soapbox/components/icon-button';
|
||||||
import Audio from 'soapbox/features/audio';
|
import Audio from 'soapbox/features/audio';
|
||||||
import Video from 'soapbox/features/video';
|
import Video from 'soapbox/features/video';
|
||||||
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
import ImageLoader from '../image-loader';
|
import ImageLoader from '../image-loader';
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [index, setIndex] = useState<number | null>(null);
|
const [index, setIndex] = useState<number | null>(null);
|
||||||
const [navigationHidden, setNavigationHidden] = useState(false);
|
const [navigationHidden, setNavigationHidden] = useState(false);
|
||||||
|
@ -94,8 +96,14 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
const handleStatusClick: React.MouseEventHandler = e => {
|
const handleStatusClick: React.MouseEventHandler = e => {
|
||||||
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status?.id}`);
|
|
||||||
onClose();
|
dispatch((_, getState) => {
|
||||||
|
const account = typeof status.account === 'string' ? getState().accounts.get(status.account) : status.account;
|
||||||
|
if (!account) return;
|
||||||
|
|
||||||
|
history.push(`/@${account.acct}/posts/${status?.id}`);
|
||||||
|
onClose();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,7 +121,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
|
|
||||||
let pagination: React.ReactNode[] = [];
|
let pagination: React.ReactNode[] = [];
|
||||||
|
|
||||||
const leftNav = media.size > 1 && (
|
const leftNav = media.size > 1 && (
|
||||||
<button
|
<button
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
className='media-modal__nav media-modal__nav--left'
|
className='media-modal__nav media-modal__nav--left'
|
||||||
|
|
|
@ -159,7 +159,7 @@ const handlePush = (event: PushEvent) => {
|
||||||
options.data.hiddenImage = notification.status?.media_attachments[0]?.preview_url;
|
options.data.hiddenImage = notification.status?.media_attachments[0]?.preview_url;
|
||||||
|
|
||||||
if (notification.status?.spoiler_text) {
|
if (notification.status?.spoiler_text) {
|
||||||
options.body = notification.status.spoiler_text;
|
options.body = notification.status.spoiler_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
options.image = undefined;
|
options.image = undefined;
|
||||||
|
|
Loading…
Reference in New Issue