From 8b5622f2a7f8f9f62dc070327939ab2f3dc3d5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Wed, 29 Oct 2025 11:16:14 +0100 Subject: [PATCH] pl-fe: remove video modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/components/status.tsx | 9 +--- .../src/features/status/components/thread.tsx | 8 +--- .../src/features/ui/components/modal-root.tsx | 3 +- .../components/panels/group-media-panel.tsx | 6 +-- .../components/panels/profile-media-panel.tsx | 7 +-- packages/pl-fe/src/modals/video-modal.tsx | 46 ------------------- .../src/pages/accounts/account-gallery.tsx | 6 +-- .../pl-fe/src/pages/groups/group-gallery.tsx | 6 +-- packages/pl-fe/src/stores/modals.ts | 4 +- 9 files changed, 9 insertions(+), 86 deletions(-) delete mode 100644 packages/pl-fe/src/modals/video-modal.tsx diff --git a/packages/pl-fe/src/components/status.tsx b/packages/pl-fe/src/components/status.tsx index 5e57f3190..b548d89a8 100644 --- a/packages/pl-fe/src/components/status.tsx +++ b/packages/pl-fe/src/components/status.tsx @@ -125,16 +125,11 @@ const Status: React.FC = (props) => { const handleHotkeyOpenMedia = (e?: KeyboardEvent) => { const status = actualStatus; - const firstAttachment = status.media_attachments[0]; e?.preventDefault(); - if (firstAttachment) { - if (firstAttachment.type === 'video') { - openModal('VIDEO', { statusId: status.id, media: firstAttachment, time: 0 }); - } else { - openModal('MEDIA', { statusId: status.id, media: status.media_attachments, index: 0 }); - } + if (status.media_attachments.length > 0) { + openModal('MEDIA', { statusId: status.id, media: status.media_attachments, index: 0 }); } }; diff --git a/packages/pl-fe/src/features/status/components/thread.tsx b/packages/pl-fe/src/features/status/components/thread.tsx index b1486611a..39f3752f8 100644 --- a/packages/pl-fe/src/features/status/components/thread.tsx +++ b/packages/pl-fe/src/features/status/components/thread.tsx @@ -195,13 +195,7 @@ const Thread = ({ e?.preventDefault(); if (media && media.length) { - const firstAttachment = media[0]; - - if (media.length === 1 && firstAttachment.type === 'video') { - openModal('VIDEO', { media: firstAttachment, statusId: status.id }); - } else { - openModal('MEDIA', { media, index: 0, statusId: status.id }); - } + openModal('MEDIA', { media, index: 0, statusId: status.id }); } }; diff --git a/packages/pl-fe/src/features/ui/components/modal-root.tsx b/packages/pl-fe/src/features/ui/components/modal-root.tsx index 91791f79f..197bc2ff1 100644 --- a/packages/pl-fe/src/features/ui/components/modal-root.tsx +++ b/packages/pl-fe/src/features/ui/components/modal-root.tsx @@ -47,7 +47,6 @@ const MODAL_COMPONENTS = { SELECT_BOOKMARK_FOLDER: lazy(() => import('pl-fe/modals/select-bookmark-folder-modal')), TEXT_FIELD: lazy(() => import('pl-fe/modals/text-field-modal')), UNAUTHORIZED: lazy(() => import('pl-fe/modals/unauthorized-modal')), - VIDEO: lazy(() => import('pl-fe/modals/video-modal')), }; type ModalType = keyof typeof MODAL_COMPONENTS | null; @@ -58,7 +57,7 @@ type BaseModalProps = { }; const ModalRoot: React.FC = () => { - const renderLoading = (modalId: string) => !['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM'].includes(modalId) ? : null; + const renderLoading = (modalId: string) => !['MEDIA', 'BOOST', 'CONFIRM'].includes(modalId) ? : null; const dispatch = useAppDispatch(); const modals = useModals(); diff --git a/packages/pl-fe/src/features/ui/components/panels/group-media-panel.tsx b/packages/pl-fe/src/features/ui/components/panels/group-media-panel.tsx index b45f1aee3..1f01ca6ba 100644 --- a/packages/pl-fe/src/features/ui/components/panels/group-media-panel.tsx +++ b/packages/pl-fe/src/features/ui/components/panels/group-media-panel.tsx @@ -20,11 +20,7 @@ const GroupMediaPanel: React.FC = ({ group }) => { const { data: attachments, isLoading } = useGroupGallery(group.id); const handleOpenMedia = (attachment: AccountGalleryAttachment): void => { - if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status_id }); - } else { - openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); - } + openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); }; const renderAttachments = () => { diff --git a/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx b/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx index 799fa0619..2badd1ca5 100644 --- a/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx +++ b/packages/pl-fe/src/features/ui/components/panels/profile-media-panel.tsx @@ -20,12 +20,7 @@ const ProfileMediaPanel: React.FC = ({ account }) => { const { data: attachments, isLoading } = useAccountGallery(account?.id!); const handleOpenMedia = (attachment: AccountGalleryAttachment): void => { - if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status_id }); - } else { - - openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); - } + openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); }; const renderAttachments = () => { diff --git a/packages/pl-fe/src/modals/video-modal.tsx b/packages/pl-fe/src/modals/video-modal.tsx deleted file mode 100644 index 415f28532..000000000 --- a/packages/pl-fe/src/modals/video-modal.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useCallback } from 'react'; -import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; - -import Video from 'pl-fe/features/video'; -import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; -import { makeGetStatus } from 'pl-fe/selectors'; - -import type { MediaAttachment } from 'pl-api'; -import type { BaseModalProps } from 'pl-fe/features/ui/components/modal-root'; - -type VideoModalProps = { - media: MediaAttachment; - statusId: string; - time?: number; -}; - -const VideoModal: React.FC = ({ statusId, media, time }) => { - const getStatus = useCallback(makeGetStatus(), []); - - const status = useAppSelector(state => getStatus(state, { id: statusId }))!; - - const link = status && ( - - - - ); - - return ( -
-
- ); -}; - -export { type VideoModalProps, VideoModal as default }; diff --git a/packages/pl-fe/src/pages/accounts/account-gallery.tsx b/packages/pl-fe/src/pages/accounts/account-gallery.tsx index 1204857bb..f102cf9ba 100644 --- a/packages/pl-fe/src/pages/accounts/account-gallery.tsx +++ b/packages/pl-fe/src/pages/accounts/account-gallery.tsx @@ -169,11 +169,7 @@ const AccountGalleryPage = () => { }; const handleOpenMedia = (attachment: AccountGalleryAttachment) => { - if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status_id }); - } else { - openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); - } + openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); }; if (accountLoading || isLoading) { diff --git a/packages/pl-fe/src/pages/groups/group-gallery.tsx b/packages/pl-fe/src/pages/groups/group-gallery.tsx index b1e649df0..a1852a7ba 100644 --- a/packages/pl-fe/src/pages/groups/group-gallery.tsx +++ b/packages/pl-fe/src/pages/groups/group-gallery.tsx @@ -24,11 +24,7 @@ const GroupGallery: React.FC = (props) => { const { data: attachments, isFetching, isLoading, hasNextPage, fetchNextPage } = useGroupGallery(groupId); const handleOpenMedia = (attachment: AccountGalleryAttachment) => { - if (attachment.type === 'video') { - openModal('VIDEO', { media: attachment, statusId: attachment.status_id }); - } else { - openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); - } + openModal('MEDIA', { index: attachment.index, statusId: attachment.status_id }); }; if (isLoading || groupIsLoading) { diff --git a/packages/pl-fe/src/stores/modals.ts b/packages/pl-fe/src/stores/modals.ts index d8a3871a9..59c782d74 100644 --- a/packages/pl-fe/src/stores/modals.ts +++ b/packages/pl-fe/src/stores/modals.ts @@ -37,7 +37,6 @@ import type { ReportModalProps } from 'pl-fe/modals/report-modal'; import type { SelectBookmarkFolderModalProps } from 'pl-fe/modals/select-bookmark-folder-modal'; import type { TextFieldModalProps } from 'pl-fe/modals/text-field-modal'; import type { UnauthorizedModalProps } from 'pl-fe/modals/unauthorized-modal'; -import type { VideoModalProps } from 'pl-fe/modals/video-modal'; type OpenModalProps = | [type: 'ALT_TEXT', props: AltTextModalProps] @@ -75,8 +74,7 @@ type OpenModalProps = | [type: 'REPORT', props: ReportModalProps] | [type: 'SELECT_BOOKMARK_FOLDER', props: SelectBookmarkFolderModalProps] | [type: 'TEXT_FIELD', props: TextFieldModalProps] - | [type: 'UNAUTHORIZED', props?: UnauthorizedModalProps] - | [type: 'VIDEO', props: VideoModalProps]; + | [type: 'UNAUTHORIZED', props?: UnauthorizedModalProps]; type Modals = Array<{ modalType: ModalType;