import type { FeedItem } from "../types"; /** Fraction of the video watched, or null if it was never opened. */ export function watchedFraction(item: FeedItem): number | null { const { position, duration } = item; if (position == null || duration == null || duration <= 0) return null; return Math.min(1, Math.max(0, position / duration)); } /** * The red sliver across the bottom of a thumbnail, same idea as YouTube's. * Red rather than the sky accent on purpose: the accent means "the action to * take" or "currently selected", and this is neither. */ export default function WatchBar({ item }: { item: FeedItem }) { const f = watchedFraction(item); if (f == null || f < 0.01) return null; const nearlyDone = f > 0.97; return ( ); }