mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
refactor: update photo data handling and types
- Changed the PhotoManifest type to PhotoManifestItem across various components and services for consistency. - Removed the views property from the PhotoInfo interface to streamline photo data. - Updated rules in color.mdc and project.mdc to adjust glob patterns and application behavior. - Enhanced the feed-sitemap plugin to utilize the new PhotoManifestItem type for better data management. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import type { PhotoManifestItem } from '@afilmory/builder'
|
||||
|
||||
import PhotosManifest from './photos-manifest.json'
|
||||
import type { PhotoManifest } from './types'
|
||||
|
||||
class PhotoLoader {
|
||||
private photos: PhotoManifest[] = []
|
||||
private photoMap: Record<string, PhotoManifest> = {}
|
||||
private photos: PhotoManifestItem[] = []
|
||||
private photoMap: Record<string, PhotoManifestItem> = {}
|
||||
|
||||
constructor() {
|
||||
this.getAllTags = this.getAllTags.bind(this)
|
||||
this.getPhotos = this.getPhotos.bind(this)
|
||||
this.getPhoto = this.getPhoto.bind(this)
|
||||
|
||||
this.photos = PhotosManifest.data as unknown as PhotoManifest[]
|
||||
this.photos = PhotosManifest.data as unknown as PhotoManifestItem[]
|
||||
|
||||
this.photos.forEach((photo) => {
|
||||
this.photoMap[photo.id] = photo
|
||||
@@ -35,5 +36,4 @@ class PhotoLoader {
|
||||
}
|
||||
export const photoLoader = new PhotoLoader()
|
||||
|
||||
export type { PhotoManifest } from './types'
|
||||
export type { PickedExif, ToneAnalysis } from '@afilmory/builder'
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import type { PickedExif, ToneAnalysis } from '@afilmory/builder'
|
||||
|
||||
export interface PhotoManifest {
|
||||
id: string
|
||||
title: string
|
||||
description: string
|
||||
views: number
|
||||
tags: string[]
|
||||
originalUrl: string
|
||||
thumbnailUrl: string
|
||||
blurhash: string
|
||||
width: number
|
||||
height: number
|
||||
aspectRatio: number
|
||||
s3Key: string
|
||||
lastModified: string
|
||||
size: number
|
||||
exif: PickedExif
|
||||
toneAnalysis: ToneAnalysis | null // 影调分析结果
|
||||
isLivePhoto?: boolean
|
||||
livePhotoVideoUrl?: string
|
||||
livePhotoVideoS3Key?: string
|
||||
}
|
||||
Reference in New Issue
Block a user