diff --git a/src/app/page.tsx b/src/app/page.tsx index 9e38be24..8bcb0e20 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -38,22 +38,8 @@ export default async function Home({ const supabase = createServerClient(); let storylines: Storyline[] = []; - const previews: Record = {}; if (supabase) { storylines = await queryTab(supabase, tab, writer, page, genre, lang); - // Fetch genesis plot previews - if (storylines.length > 0) { - const { data: plots } = await supabase.from("plots") - .select("storyline_id, content") - .in("storyline_id", storylines.map((s) => s.storyline_id)) - .eq("plot_index", 0) - .eq("contract_address", STORY_FACTORY.toLowerCase()); - if (plots) { - for (const p of plots as { storyline_id: number; content: string }[]) { - previews[p.storyline_id] = p.content.slice(0, 120); - } - } - } } const extraParams = writer !== "all" ? { writer } : undefined; @@ -81,9 +67,9 @@ export default async function Home({ {/* Story grid */} -
+
{storylines.map((s) => ( - + ))}
diff --git a/src/components/StoryCard.tsx b/src/components/StoryCard.tsx index 3bd53a57..784c82df 100644 --- a/src/components/StoryCard.tsx +++ b/src/components/StoryCard.tsx @@ -4,78 +4,66 @@ import { AgentBadge } from "./AgentBadge"; import { WriterIdentityClient } from "./WriterIdentityClient"; import { RatingSummary } from "./RatingSummary"; import { StoryCardStats } from "./StoryCardStats"; -import { ViewCount } from "./ViewCount"; export function StoryCard({ storyline, genre, - preview, }: { storyline: Storyline; genre?: string; - preview?: string; }) { - const dateStr = storyline.block_timestamp - ? new Date(storyline.block_timestamp).toLocaleDateString("en-US", { - month: "short", - day: "numeric", - }) - : null; + const displayGenre = genre || storyline.genre; return ( - - {/* Title + completion badge */} -
-

- {storyline.title} -

- {storyline.sunset && ( - - complete +
+ {/* Book cover */} + + {/* Top: genre tag + completion badge */} +
+ + {displayGenre || "Uncategorized"} - )} -
- - {/* Author + meta */} -
- By: - - {storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} - - - {dateStr && {dateStr}} - - {genre || storyline.genre || Uncategorized} - - {storyline.language && storyline.language !== "English" && ( - - {storyline.language} - - )} - {storyline.writer_type === 1 && } -
+ {storyline.sunset && ( + + complete + + )} +
- {/* Stats row: price, TVL */} - {storyline.token_address && ( -
- + {/* Center: title */} +
+

+ {storyline.title} +

+ {storyline.language && storyline.language !== "English" && ( + + {storyline.language} + + )}
- )} - {/* Genesis preview */} - {preview && ( -

- {preview} -

- )} + {/* Bottom: author */} +
+ + {storyline.writer_type === 1 && } +
+ - {/* Rating */} -
+ {/* Metadata row below card */} +
+
+ + {storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} + + {storyline.token_address && ( + + )} +
- +
); }