diff --git a/src/components/StoryCard.tsx b/src/components/StoryCard.tsx index eadf6f5b..e9d4ba36 100644 --- a/src/components/StoryCard.tsx +++ b/src/components/StoryCard.tsx @@ -5,6 +5,11 @@ import { WriterIdentityClient } from "./WriterIdentityClient"; import { RatingSummary } from "./RatingSummary"; import { StoryCardTVL } from "./StoryCardStats"; +const DAY_MS = 24 * 60 * 60 * 1000; +function isWithin24h(timestamp: string): boolean { + return Date.now() - new Date(timestamp).getTime() < DAY_MS; +} + export function StoryCard({ storyline, genre, @@ -13,6 +18,9 @@ export function StoryCard({ genre?: string; }) { const displayGenre = genre || storyline.genre; + const isNew = storyline.last_plot_time + ? isWithin24h(storyline.last_plot_time) + : false; return (