mirror of
https://github.com/Afilmory/afilmory
synced 2026-02-01 22:48:17 +00:00
refactor(photo): optimize photo loading and improve component imports
- Changed photo loading methods to remove unnecessary await for synchronous operations. - Updated import path for icons in PhotoItem component for better clarity and organization. - Adjusted class names for consistency in styling. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
MaterialSymbolsShutterSpeed,
|
||||
StreamlineImageAccessoriesLensesPhotosCameraShutterPicturePhotographyPicturesPhotoLens,
|
||||
TablerAperture,
|
||||
} from '@afilmory/ui'
|
||||
} from '@afilmory/ui/icons/index.tsx'
|
||||
import { clsxm as cn } from '@afilmory/utils'
|
||||
import { thumbHashToDataURL } from 'thumbhash'
|
||||
|
||||
|
||||
@@ -13,20 +13,20 @@ export default async function Page({ searchParams }: NextPageExtractedParams<unk
|
||||
|
||||
if (!id) return notFound()
|
||||
if (typeof id === 'string') {
|
||||
const photo = await photoLoader.getPhoto(id)
|
||||
const photo = photoLoader.getPhoto(id)
|
||||
if (!photo) {
|
||||
notFound()
|
||||
}
|
||||
photos = [photo]
|
||||
} else {
|
||||
photos = await photoLoader.getPhotos(id)
|
||||
photos = photoLoader.getPhotos(id)
|
||||
if (photos.length === 0) {
|
||||
notFound()
|
||||
}
|
||||
}
|
||||
|
||||
if (photos.length === 1) {
|
||||
return <PhotoItem photo={photos[0]} className="absolute inset-0 size-full !pt-0" />
|
||||
return <PhotoItem photo={photos[0]} className="absolute inset-0 size-full pt-0!" />
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user