diff --git a/packages/pl-fe/src/features/account-gallery/components/media-item.tsx b/packages/pl-fe/src/features/account-gallery/components/media-item.tsx index 31bfe069f..86c070fb4 100644 --- a/packages/pl-fe/src/features/account-gallery/components/media-item.tsx +++ b/packages/pl-fe/src/features/account-gallery/components/media-item.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import React, { useState } from 'react'; +import { Link } from 'react-router-dom'; import Blurhash from 'pl-fe/components/blurhash'; import Icon from 'pl-fe/components/icon'; @@ -118,7 +119,7 @@ const MediaItem: React.FC = ({ attachment, onOpenMedia, isLast }) => return (
- + = ({ attachment, onOpenMedia, isLast }) => /> {visible && thumbnail} {!visible && icon} - +
); }; diff --git a/packages/pl-fe/src/features/account-gallery/index.tsx b/packages/pl-fe/src/features/account-gallery/index.tsx index de36a5e1b..434c06949 100644 --- a/packages/pl-fe/src/features/account-gallery/index.tsx +++ b/packages/pl-fe/src/features/account-gallery/index.tsx @@ -48,7 +48,7 @@ const AccountGallery = () => { const handleOpenMedia = (attachment: AccountGalleryAttachment) => { if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status.id, account: attachment.account }); + openModal('VIDEO', { media: attachment, statusId: attachment.status.id }); } else { const media = attachment.status.media_attachments; const index = media.findIndex((x) => x.id === attachment.id); diff --git a/packages/pl-fe/src/features/group/group-gallery.tsx b/packages/pl-fe/src/features/group/group-gallery.tsx index 4f24cb2b9..71f3ee3b1 100644 --- a/packages/pl-fe/src/features/group/group-gallery.tsx +++ b/packages/pl-fe/src/features/group/group-gallery.tsx @@ -38,7 +38,7 @@ const GroupGallery: React.FC = (props) => { const handleOpenMedia = (attachment: AccountGalleryAttachment) => { if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status.id, account: attachment.account }); + openModal('VIDEO', { media: attachment, statusId: attachment.status.id }); } else { const media = (attachment.status as Status).media_attachments; const index = media.findIndex((x) => x.id === attachment.id); diff --git a/packages/pl-fe/src/features/ui/components/modals/media-modal.tsx b/packages/pl-fe/src/features/ui/components/modals/media-modal.tsx index 4af22505c..3bd866cd2 100644 --- a/packages/pl-fe/src/features/ui/components/modals/media-modal.tsx +++ b/packages/pl-fe/src/features/ui/components/modals/media-modal.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React, { useCallback, useEffect, useState } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; -import { useHistory } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import ReactSwipeableViews from 'react-swipeable-views'; import { fetchStatusWithContext } from 'pl-fe/actions/statuses'; @@ -59,7 +59,6 @@ const MediaModal: React.FC = (props) => { } = props; const dispatch = useAppDispatch(); - const history = useHistory(); const intl = useIntl(); const getStatus = useCallback(makeGetStatus(), []); @@ -104,14 +103,6 @@ const MediaModal: React.FC = (props) => { setNavigationHidden(value => !value && userTouching.matches); }; - const handleStatusClick: React.MouseEventHandler = e => { - if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) { - e.preventDefault(); - history.push(`/@${status.account.acct}/posts/${status?.id}`); - onClose(); - } - }; - const content = media.map((attachment, i) => { let width: number | undefined, height: number | undefined; if (attachment.type === 'image' || attachment.type === 'gifv' || attachment.type === 'video') { @@ -120,9 +111,9 @@ const MediaModal: React.FC = (props) => { } const link = (status && ( - + - + )); if (attachment.type === 'image') { diff --git a/packages/pl-fe/src/features/ui/components/modals/video-modal.tsx b/packages/pl-fe/src/features/ui/components/modals/video-modal.tsx index a45d83d13..ff4ef992b 100644 --- a/packages/pl-fe/src/features/ui/components/modals/video-modal.tsx +++ b/packages/pl-fe/src/features/ui/components/modals/video-modal.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; -import { useHistory } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import Video from 'pl-fe/features/video'; import { useAppSelector } from 'pl-fe/hooks'; @@ -8,34 +8,22 @@ import { makeGetStatus } from 'pl-fe/selectors'; import type { BaseModalProps } from '../modal-root'; import type { MediaAttachment } from 'pl-api'; -import type { Account } from 'pl-fe/normalizers'; type VideoModalProps = { media: MediaAttachment; statusId: string; - account?: Pick; time?: number; }; -const VideoModal: React.FC = ({ statusId, account, media, time }) => { +const VideoModal: React.FC = ({ statusId, media, time }) => { const getStatus = useCallback(makeGetStatus(), []); const status = useAppSelector(state => getStatus(state, { id: statusId }))!; - const history = useHistory(); - const handleStatusClick: React.MouseEventHandler = e => { - if (!account) return; - - if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { - e.preventDefault(); - history.push(`/@${account.acct}/posts/${status.id}`); - } - }; - - const link = status && account && ( - + const link = status && ( + - + ); return (