From 553fd4f783c5365c7cebcde5dac3d6f41ffc6db6 Mon Sep 17 00:00:00 2001 From: sajjad isvand Date: Sat, 5 Sep 2026 09:41:56 +0330 Subject: [PATCH] refactor(gallery): rename item to photo-item and use skeleton class --- ...terest-item.tsx => gallery-photo-item.tsx} | 12 ++++------- .../gallery/gallery-picker-modal.tsx | 20 +++++++++---------- src/components/gallery/index.ts | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) rename src/components/gallery/{gallery-pinterest-item.tsx => gallery-photo-item.tsx} (94%) diff --git a/src/components/gallery/gallery-pinterest-item.tsx b/src/components/gallery/gallery-photo-item.tsx similarity index 94% rename from src/components/gallery/gallery-pinterest-item.tsx rename to src/components/gallery/gallery-photo-item.tsx index 3e0c039d4..6959ef987 100644 --- a/src/components/gallery/gallery-pinterest-item.tsx +++ b/src/components/gallery/gallery-photo-item.tsx @@ -5,17 +5,13 @@ import { UserCoin } from '@/layouts/setting/tabs/account/components/user-coin' import { useLazyLoad } from '@/layouts/setting/tabs/wallpapers/hooks/use-lazy-load' import type { GalleryAsset } from '@/services/hooks/gallery/get-gallery-assets.hook' -interface GalleryPinterestItemProps { +interface GalleryPhotoItemProps { asset: GalleryAsset isSelected: boolean onClick: () => void } -export function GalleryPinterestItem({ - asset, - isSelected, - onClick, -}: GalleryPinterestItemProps) { +export function GalleryPhotoItem({ asset, isSelected, onClick }: GalleryPhotoItemProps) { const [loaded, setLoaded] = useState(false) const [error, setError] = useState(false) const imgRef = useRef(null) @@ -39,13 +35,13 @@ export function GalleryPinterestItem({ className={`break-inside-avoid relative rounded-2xl cursor-pointer group overflow-hidden bg-base-200/50 ${itemOutlineStyle} transition-all duration-200 active:scale-98`} > {!loaded && ( -
+
)} {error && ( -
+

خطا در بارگذاری

diff --git a/src/components/gallery/gallery-picker-modal.tsx b/src/components/gallery/gallery-picker-modal.tsx index 7675ebeb9..62e59da9d 100644 --- a/src/components/gallery/gallery-picker-modal.tsx +++ b/src/components/gallery/gallery-picker-modal.tsx @@ -11,7 +11,7 @@ import { type GalleryAssetType, } from '@/services/hooks/gallery/get-gallery-assets.hook' import { GalleryAssetPurchaseModal } from './gallery-asset-purchase-modal' -import { GalleryPinterestItem } from './gallery-pinterest-item' +import { GalleryPhotoItem } from './gallery-photo-item' import { GalleryBookmarkIconItem } from './gallery-bookmark-icon-item' interface GalleryPickerModalProps { @@ -93,7 +93,7 @@ export function GalleryPickerModal({ direction="rtl" closeOnBackdropClick={true} > -
+
{categories.length > 0 && (
)} -
+
{isLoading ? ( - type === 'BOOKMARK_ICON' ? ( + type === 'BOOKMARK_ICON' || type === 'AVATAR' ? (
- {[...Array(10)].map((_, idx) => ( + {[...Array(15)].map((_, idx) => (
))}
@@ -132,9 +132,9 @@ export function GalleryPickerModal({ {[...Array(8)].map((_, idx) => (
))} @@ -149,7 +149,7 @@ export function GalleryPickerModal({ />

هیچ تصویری پیدا نشد

- ) : type === 'BOOKMARK_ICON' ? ( + ) : type === 'BOOKMARK_ICON' || type === 'AVATAR' ? (
{assets.map((asset) => ( {assets.map((asset) => ( -