Fix 'View context' button

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
deduplicate
marcin mikołajczak 2023-01-08 21:37:20 +01:00
rodzic e9a2b65963
commit 519c4fb252
3 zmienionych plików z 13 dodań i 5 usunięć

Wyświetl plik

@ -56,7 +56,7 @@ const MediaItem: React.FC<IMediaItem> = ({ attachment, displayWidth, onOpenMedia
const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`;
const height = width;
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 icon;

Wyświetl plik

@ -9,6 +9,7 @@ import Icon from 'soapbox/components/icon';
import IconButton from 'soapbox/components/icon-button';
import Audio from 'soapbox/features/audio';
import Video from 'soapbox/features/video';
import { useAppDispatch } from 'soapbox/hooks';
import ImageLoader from '../image-loader';
@ -39,6 +40,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
const intl = useIntl();
const history = useHistory();
const dispatch = useAppDispatch();
const [index, setIndex] = useState<number | null>(null);
const [navigationHidden, setNavigationHidden] = useState(false);
@ -94,8 +96,14 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
const handleStatusClick: React.MouseEventHandler = e => {
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
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[] = [];
const leftNav = media.size > 1 && (
const leftNav = media.size > 1 && (
<button
tabIndex={0}
className='media-modal__nav media-modal__nav--left'

Wyświetl plik

@ -159,7 +159,7 @@ const handlePush = (event: PushEvent) => {
options.data.hiddenImage = notification.status?.media_attachments[0]?.preview_url;
if (notification.status?.spoiler_text) {
options.body = notification.status.spoiler_text;
options.body = notification.status.spoiler_text;
}
options.image = undefined;