Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 34 additions & 28 deletions web/src/components/calendar/CalendarEventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,40 @@ export default function CalendarEventCard({ event }: { event: CalendarEvent }) {
aria-label={event.title}
className="block overflow-hidden rounded-xl"
>
<div
className={`media-card-image relative aspect-[2/3] ${watched ? "opacity-60 grayscale" : ""}`}
style={
thumbhashUrl
? {
backgroundImage: `url(${thumbhashUrl})`,
backgroundSize: "cover",
backgroundPosition: "center",
}
: undefined
}
>
{event.poster_url && failedUrl !== event.poster_url ? (
<img
src={event.poster_url}
alt={event.title}
className={`h-full w-full object-cover transition-opacity duration-300 ${loaded ? "opacity-100" : "opacity-0"}`}
loading="lazy"
onLoad={() => setLoaded(true)}
onError={() => setFailedUrl(event.poster_url ?? null)}
/>
) : (
!thumbhashUrl && (
// Every calendar entry that isn't a movie belongs to a series.
<DefaultArtwork mediaType={event.type === "movie" ? "movie" : "episode"} />
)
)}
<div className="from-background/70 pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t to-transparent opacity-90" />
<div className={`media-card-image relative aspect-[2/3] ${watched ? "bg-background" : ""}`}>
{/* A watched entry dims only its artwork; the badges and check mark
sit outside this layer so their labels keep full contrast. The
page background behind it keeps the dimmed artwork as dark as
when the whole card faded into the page. */}
<div
className={`absolute inset-0 ${watched ? "opacity-60 grayscale" : ""}`}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S1 · Low. A watched season-premiere badge loses contrast when bright artwork sits behind it and the server uses the shipped red accent (#ef4444). In a fixture rendering both revisions with the app CSS, the highest sampled text contrast fell from 2.92:1 to 1.31:1 in Chromium (1.29:1 in Firefox). Moving the badge out of the grayscale layer leaves red text over a translucent red tint on a mid-grey poster, so text and fill end up close in luminance.

Suggested repair: give the premiere badge an opaque fill and a foreground that reaches 4.5:1 against it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badge's translucent fill (bg-primary/20 text-primary in upcomingEventPresentation.ts) causes this, and the same badge fails on unwatched bright posters too (about 1:1 with the default accent). Before this change the watched badge also failed (2.92:1), because the grayscale turned it grey on grey. Both values are well under 4.5:1. This change keeps that line untouched because #4780 replaces it with an opaque fill, which makes the badge's contrast independent of the poster behind it. With that fill, a watched badge measures the same as an unwatched one. Until #4780 lands, this case moves from one failing value to another, so #4780 should merge first or together with this PR.

🤖 Claude Code (claude-opus-5-5)

style={
thumbhashUrl
? {
backgroundImage: `url(${thumbhashUrl})`,
backgroundSize: "cover",
backgroundPosition: "center",
}
: undefined
}
>
{event.poster_url && failedUrl !== event.poster_url ? (
<img
src={event.poster_url}
alt={event.title}
className={`h-full w-full object-cover transition-opacity duration-300 ${loaded ? "opacity-100" : "opacity-0"}`}
loading="lazy"
onLoad={() => setLoaded(true)}
onError={() => setFailedUrl(event.poster_url ?? null)}
/>
) : (
!thumbhashUrl && (
// Every calendar entry that isn't a movie belongs to a series.
<DefaultArtwork mediaType={event.type === "movie" ? "movie" : "episode"} />
)
)}
<div className="from-background/70 pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t to-transparent opacity-90" />
</div>
{event.badges.length > 0 && (
<div className="absolute start-2.5 top-2.5 flex flex-wrap gap-1">
{event.badges.map((badge) => (
Expand Down
Loading