From d21241165f04fcf53d89008a552f7f8b413041f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 30 Sep 2024 17:51:48 +0200 Subject: [PATCH 1/7] pl-fe: Remove unused code(?) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/features/account-gallery/index.tsx | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/packages/pl-fe/src/features/account-gallery/index.tsx b/packages/pl-fe/src/features/account-gallery/index.tsx index 0139403aa..7de4eb42d 100644 --- a/packages/pl-fe/src/features/account-gallery/index.tsx +++ b/packages/pl-fe/src/features/account-gallery/index.tsx @@ -14,21 +14,6 @@ import { useModalsStore } from 'pl-fe/stores'; import MediaItem from './components/media-item'; -interface ILoadMoreMedia { - maxId: string | null; - onLoadMore: (value: string | null) => void; -} - -const LoadMoreMedia: React.FC = ({ maxId, onLoadMore }) => { - const handleLoadMore = () => { - onLoadMore(maxId); - }; - - return ( - - ); -}; - const AccountGallery = () => { const dispatch = useAppDispatch(); const { username } = useParams<{ username: string }>(); @@ -97,7 +82,7 @@ const AccountGallery = () => { let loadOlder = null; if (hasMore && !(isLoading && attachments.size === 0)) { - loadOlder = ; + loadOlder = ; } if (isUnavailable) { @@ -113,9 +98,7 @@ const AccountGallery = () => { return (
- {attachments.map((attachment, index) => attachment === null ? ( - 0 ? (attachments.get(index - 1)?.id || null) : null} onLoadMore={handleLoadMore} /> - ) : ( + {attachments.map((attachment, index) => ( {
)} - - {loadOlder} + {loadOlder} + {isLoading && attachments.size === 0 && (
From 961044a4c6147b6ac85d0b08939259db80ca850c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 30 Sep 2024 17:59:57 +0200 Subject: [PATCH 2/7] pl-fe: Disable no-custom-classname eslint rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/.eslintrc.json | 2 +- packages/pl-fe/src/styles/components/media-gallery.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/pl-fe/.eslintrc.json b/packages/pl-fe/.eslintrc.json index d73821133..bd3d2475f 100644 --- a/packages/pl-fe/.eslintrc.json +++ b/packages/pl-fe/.eslintrc.json @@ -316,7 +316,7 @@ } ], "tailwindcss/migration-from-tailwind-2": "error", - + "tailwindcss/no-custom-classname": "off", "formatjs/enforce-default-message": "error", "formatjs/enforce-id": "error", diff --git a/packages/pl-fe/src/styles/components/media-gallery.scss b/packages/pl-fe/src/styles/components/media-gallery.scss index fbb750f53..5e46c7ea3 100644 --- a/packages/pl-fe/src/styles/components/media-gallery.scss +++ b/packages/pl-fe/src/styles/components/media-gallery.scss @@ -21,7 +21,7 @@ @apply text-gray-400 cursor-zoom-in block no-underline leading-[0] relative z-[1] h-full w-full; video { - @apply w-full h-full object-cover + @apply w-full h-full object-cover; } } } From 5e4e515cedb2ceb6b8af7999b0f5eb3edefdb3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 30 Sep 2024 18:12:18 +0200 Subject: [PATCH 3/7] pl-fe: Minor changes to gallery display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/features/account-gallery/components/media-item.tsx | 7 ++++--- packages/pl-fe/src/features/account-gallery/index.tsx | 7 +++---- packages/pl-fe/src/features/group/group-gallery.tsx | 5 +++-- .../features/ui/components/panels/group-media-panel.tsx | 5 +++-- .../features/ui/components/panels/profile-media-panel.tsx | 5 +++-- packages/pl-fe/src/styles/components/media-gallery.scss | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) 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 9721238f2..ddb814385 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 @@ -12,9 +12,10 @@ import type { AccountGalleryAttachment } from 'pl-fe/selectors'; interface IMediaItem { attachment: AccountGalleryAttachment; onOpenMedia: (attachment: AccountGalleryAttachment) => void; + isLast?: boolean; } -const MediaItem: React.FC = ({ attachment, onOpenMedia }) => { +const MediaItem: React.FC = ({ attachment, onOpenMedia, isLast }) => { const { autoPlayGif, displayMedia } = useSettings(); const [visible, setVisible] = useState(displayMedia !== 'hide_all' && !attachment.status?.sensitive || displayMedia === 'show_all'); @@ -66,7 +67,7 @@ const MediaItem: React.FC = ({ attachment, onOpenMedia }) => { src={attachment.preview_url} alt={attachment.description} style={{ objectPosition: `${x}% ${y}%` }} - className='size-full overflow-hidden rounded-lg' + className={clsx('size-full overflow-hidden', { 'rounded-br-md': isLast })} /> ); } else if (['gifv', 'video'].indexOf(attachment.type) !== -1) { @@ -80,7 +81,7 @@ const MediaItem: React.FC = ({ attachment, onOpenMedia }) => { thumbnail = (