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:
Innei
2025-11-17 23:29:07 +08:00
parent 739b1e48b0
commit 855decbe77
2 changed files with 4 additions and 4 deletions

View File

@@ -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'

View File

@@ -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 (