import { usePatchWatch, usePodProfile, usePods } from '../../api/hooks'; import { shortWhen } from '../../domain/runName'; /** The release the readiness is about, as the page's one-line sub-title: "Patch 26C. Test environment release 26C, checked 18 Oct 23:53." * "Next Oracle update" is shown only when the API gives a date; it is never guessed. The environment cue lives in the top bar. */ export function ReleaseLine({ podId, patch, nextUpdate }: { podId: number | null; patch: string | null; nextUpdate?: string | null }) { const pods = usePods().data ?? []; const pod = pods.find((p) => p.id === podId); const profile = usePodProfile(); const watch = usePatchWatch(); const release = profile.data?.about?.release ?? pod?.release ?? null; const checked = watch.data?.last_checked_at ?? profile.data?.scanned_at ?? null; const parts = [ patch ? `Patch ${patch}.` : '', release ? `Test environment release ${release}${checked ? `, checked ${shortWhen(checked)}` : ''}.` : '', nextUpdate ? `Next Oracle update: ${shortWhen(nextUpdate).replace(/ \d\d:\d\d$/, '')}.` : '', ].filter(Boolean); if (!parts.length) return null; return {parts.join(' ')}; }