This commit is contained in:
@ -33,14 +33,14 @@ export default function HomePage() {
|
||||
if (activeCategory === "all") {
|
||||
return photos
|
||||
}
|
||||
return photos.filter((photo) => photo.category === activeCategory)
|
||||
return photos.filter((photo: Photo) => photo.category === activeCategory)
|
||||
}, [photos, activeCategory])
|
||||
|
||||
const handleFilter = (category: string) => {
|
||||
setActiveCategory(category)
|
||||
}
|
||||
|
||||
const handlePhotoClick = (photo: any) => {
|
||||
const handlePhotoClick = (photo: Photo) => {
|
||||
setSelectedPhoto(photo)
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ export default function HomePage() {
|
||||
const handlePrevPhoto = () => {
|
||||
if (!selectedPhoto) return
|
||||
const currentPhotos = activeTab === "gallery" ? filteredPhotos : photos
|
||||
const currentIndex = currentPhotos.findIndex((p) => p.id === selectedPhoto.id)
|
||||
const currentIndex = currentPhotos.findIndex((p: Photo) => p.id === selectedPhoto.id)
|
||||
const prevIndex = currentIndex > 0 ? currentIndex - 1 : currentPhotos.length - 1
|
||||
setSelectedPhoto(currentPhotos[prevIndex])
|
||||
}
|
||||
@ -59,7 +59,7 @@ export default function HomePage() {
|
||||
const handleNextPhoto = () => {
|
||||
if (!selectedPhoto) return
|
||||
const currentPhotos = activeTab === "gallery" ? filteredPhotos : photos
|
||||
const currentIndex = currentPhotos.findIndex((p) => p.id === selectedPhoto.id)
|
||||
const currentIndex = currentPhotos.findIndex((p: Photo) => p.id === selectedPhoto.id)
|
||||
const nextIndex = currentIndex < currentPhotos.length - 1 ? currentIndex + 1 : 0
|
||||
setSelectedPhoto(currentPhotos[nextIndex])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user