type discover components

This commit is contained in:
2026-04-26 07:48:34 +03:00
parent c746ce1b7c
commit 9641dfc1a9
8 changed files with 52 additions and 53 deletions
+10 -11
View File
@@ -27,22 +27,21 @@ export function SpotlightHero({ kind = 'all' }: { kind?: 'all' | 'movie' | 'tv'
const pick = useMemo(() => {
const list = trending.data?.results || []
const filtered = filterToMissing(list, lib.data, hideAdult, m => !!(m as any).adult)
return filtered.find(m => (m as any).backdrop_path && (m as any).overview) || null
const filtered = filterToMissing(list, lib.data, hideAdult, m => !!m.adult)
return filtered.find(m => m.backdrop_path && m.overview) || null
}, [trending.data, lib.data, hideAdult])
if (!pick) return null
const p = pick as any
const title: string = p.title || p.name || 'Untitled'
const overview: string = p.overview || ''
const backdrop = `${TMDB_IMG}/w1280${p.backdrop_path}`
const year = (p.release_date || p.first_air_date || '').slice(0, 4)
const rating = typeof p.vote_average === 'number' ? p.vote_average.toFixed(1) : null
const mediaType: 'movie' | 'tv' = p.media_type === 'tv' || p.first_air_date ? 'tv' : 'movie'
const title: string = pick.title || pick.name || 'Untitled'
const overview: string = pick.overview || ''
const backdrop = `${TMDB_IMG}/w1280${pick.backdrop_path}`
const year = (pick.release_date || pick.first_air_date || '').slice(0, 4)
const rating = typeof pick.vote_average === 'number' ? pick.vote_average.toFixed(1) : null
const mediaType: 'movie' | 'tv' = pick.media_type === 'tv' || pick.first_air_date ? 'tv' : 'movie'
function open() {
navigate(`/item/tmdb-${mediaType}-${p.id}`)
navigate(`/item/tmdb-${mediaType}-${pick.id}`)
}
return (
@@ -54,7 +53,7 @@ export function SpotlightHero({ kind = 'all' }: { kind?: 'all' | 'movie' | 'tv'
style={{ aspectRatio: '21/9', maxHeight: '440px' }}
>
<motion.img
key={p.id}
key={pick.id}
initial={{ scale: 1.04, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 1.2, ease: [0.16, 1, 0.3, 1] }}