From c3adad3fc4d73a2c0eb25e0022040a74b92bd104 Mon Sep 17 00:00:00 2001 From: ner Date: Wed, 5 Aug 2026 18:45:17 +0300 Subject: [PATCH] extract YearHint component; fix fetchPriority casing --- components/Poster/index.tsx | 4 +-- .../Preview/components/YearHint/index.tsx | 31 +++++++++++++++++++ components/Preview/index.tsx | 7 ++--- 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 components/Preview/components/YearHint/index.tsx diff --git a/components/Poster/index.tsx b/components/Poster/index.tsx index c1a6061..fefb26b 100644 --- a/components/Poster/index.tsx +++ b/components/Poster/index.tsx @@ -12,10 +12,10 @@ interface Props { priority?: boolean; } -type FetchPriorityProps = ImgHTMLAttributes & { fetchpriority?: 'high' | 'low' | 'auto' }; +type FetchPriorityProps = ImgHTMLAttributes & { fetchPriority?: 'high' | 'low' | 'auto' }; const Poster: FC = ({ show, onClick, className, lazy = true, priority = false }) => { - const fetchPriorityProps: FetchPriorityProps = priority ? { fetchpriority: 'high' } : {}; + const fetchPriorityProps: FetchPriorityProps = priority ? { fetchPriority: 'high' } : {}; return (
}> = ({ show }) => { + const state = getAvailabilityState(show.availability!); + if (!state) return {new Date(show.release).getFullYear()}; + + return ( + + {new Date(show.release).getFullYear()} + + ); +}; + +export default YearHint; diff --git a/components/Preview/index.tsx b/components/Preview/index.tsx index 33302b0..c374e95 100644 --- a/components/Preview/index.tsx +++ b/components/Preview/index.tsx @@ -11,7 +11,7 @@ import { cn } from '@/lib/utils'; import Actions from './components/Actions'; import Airing from './components/Airing'; -import Availability from './components/Availability'; +import YearHint from './components/YearHint'; interface Props { show?: Show & Partial
; @@ -55,10 +55,7 @@ const Preview: FC = ({ {show.title}
- {new Date(show.release).getFullYear()} - {Boolean(show.availability) && ( - - )} + {Boolean(show.availability) ? : {new Date(show.release).getFullYear()}} {Boolean(show.airing) && } {Boolean(show.runtime) && ( {show.runtime} minutes