@@ -7,7 +7,6 @@ import { cn, makeThumbnailUrl, resizeChannelPhoto } from "@/lib/utils";
7
7
import React , { Suspense , useCallback , useMemo , useState } from "react" ;
8
8
import { useTranslation } from "react-i18next" ;
9
9
import { useDuration } from "@/hooks/useDuration" ;
10
- import { clsx } from "clsx" ;
11
10
import { VideoThumbnail } from "./VideoThumbnail" ;
12
11
import { usePreferredName } from "@/store/settings" ;
13
12
import { useAtomValue } from "jotai" ;
@@ -51,6 +50,8 @@ interface VideoCardProps {
51
50
*/
52
51
onClick ?: OnClickHandler ;
53
52
showDuration ?: boolean ;
53
+ // showing the status of the video object (live now, # watching, or available_at time)
54
+ showStatus ?: boolean | "available_at_only" ;
54
55
}
55
56
56
57
const LazyVideoCardPlaceholder = React . lazy (
@@ -64,6 +65,7 @@ export function VideoCard({
64
65
size,
65
66
onClick,
66
67
showDuration = true ,
68
+ showStatus = true ,
67
69
} : VideoCardProps ) {
68
70
const isTwitchPlaceholder = video . link ?. includes ( "twitch" ) ;
69
71
const videoHref =
@@ -119,36 +121,37 @@ export function VideoCard({
119
121
120
122
const videoCardClasses = useMemo (
121
123
( ) => ( {
122
- outerLayer : clsx ( [
123
- "starting: opacity-0 opacity- 100 transition-opacity duration-300" ,
124
+ outerLayer : cn ( [
125
+ "opacity-100 transition-opacity duration-300 starting:opacity-0 " ,
124
126
size == "list" && "rounded-sm hover:bg-base-3 @lg:px-2" ,
125
- ( size == "list" || size == "sm" ) && "group relative flex gap-4 py-2" ,
127
+ ( size == "list" || size == "sm" ) &&
128
+ "group relative flex gap-2 py-2 @lg:gap-4" ,
126
129
( size == "md" || size == "lg" ) && "group flex w-full flex-col gap-4" ,
127
130
onClick && "cursor-pointer" ,
128
131
selectionMode &&
129
132
( selectedSet ?. has ( video . id )
130
- ? "ring-offset-base-2 ring-offset-2 ring-4 ring-primary-8 rounded-lg "
131
- : "ring-offset -base-2 ring-offset-2 ring-4 ring -base-6 rounded-lg saturate-[0.75] brightness-75 opacity-50 " ) ,
133
+ ? "rounded-lg ring-4 ring-primary-8 ring-offset-2 ring-offset-base-2 "
134
+ : "rounded-lg opacity-50 ring-4 ring -base-6 ring-offset-2 ring-offset -base-2 brightness-75 saturate-[0.75]" ) ,
132
135
] ) ,
133
- thumbnailLink : clsx ( [
136
+ thumbnailLink : cn ( [
134
137
size == "list" &&
135
- "@lg:w-36 relative aspect-video w-28 shrink-0 overflow-hidden" ,
136
- size == "sm" && "@lg:w-48 relative w-36 shrink-0 overflow-hidden" ,
138
+ "relative aspect-video w-28 shrink-0 overflow-hidden @lg:w-36 " ,
139
+ size == "sm" && "relative w-36 shrink-0 overflow-hidden @lg:w-48 " ,
137
140
( size == "md" || size == "lg" ) && "relative w-full" ,
138
141
] ) ,
139
- videoTextInfo : clsx ( [
142
+ videoTextInfo : cn ( [
140
143
( size == "list" || size == "sm" ) && "flex flex-col gap-1" ,
141
144
( size == "md" || size == "lg" ) &&
142
145
"flex min-h-[6rem] cursor-pointer flex-col gap-0" ,
143
146
] ) ,
144
- titleLink : clsx ( [
147
+ titleLink : cn ( [
145
148
( size == "list" || size == "sm" ) &&
146
- "@lg:text-lg line-clamp-2 pr-4 text-sm font-bold" ,
149
+ "line-clamp-2 pr-4 text-sm font-bold @lg:text-lg " ,
147
150
( size == "md" || size == "lg" ) &&
148
151
"line-clamp-2 pr-4 text-sm font-bold md:text-[1rem] md:leading-6" ,
149
152
] ) ,
150
153
channelLink :
151
- "line-clamp-1 text-xs text-primary-11 hover:text-primary-12 @lg:text-sm" ,
154
+ "line-clamp-1 text-sm text-primary-11 hover:text-primary-12 @lg:text-sm" ,
152
155
scheduleText : "text-sm @lg:text-sm text-base-11" ,
153
156
} ) ,
154
157
[ size , onClick , selectionMode , selectedSet , video . id ] ,
@@ -266,9 +269,12 @@ export function VideoCard({
266
269
{ chName }
267
270
</ Link >
268
271
) }
269
- { size != "xs" && (
272
+ { size != "xs" && showStatus && (
270
273
< div className = { videoCardClasses . scheduleText } >
271
- < VideoCardCountdownToLive video = { video } />
274
+ < VideoCardCountdownToLive
275
+ video = { video }
276
+ onlyTime = { showStatus === "available_at_only" }
277
+ />
272
278
</ div >
273
279
) }
274
280
</ div >
0 commit comments