Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink",
"version": "0.1.1",
"version": "0.1.2",
"private": true,
"workspaces": [
"packages/*"
Expand Down
43 changes: 26 additions & 17 deletions src/components/StoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ export function StoryCard({

return (
<div className="flex flex-col">
<Link
href={`/story/${storyline.storyline_id}`}
className="moleskine-notebook group relative block"
>
<div className="moleskine-notebook group relative block">
{/* Stretched link — makes the whole card clickable */}
<Link
href={`/story/${storyline.storyline_id}`}
className="absolute inset-0 z-30"
aria-label={storyline.title}
/>

{/* Page underneath — revealed when cover opens */}
<div
className="notebook-page absolute inset-0 z-0 overflow-hidden"
Expand Down Expand Up @@ -71,12 +75,20 @@ export function StoryCard({
}}
/>

{/* Top area: genre badge */}
{/* Top area: genre + plot count badges */}
<div className="relative z-10 px-4 pt-4">
<div className="flex items-start justify-between gap-2">
<div className="flex flex-wrap items-start gap-1.5">
<span className="rounded-sm bg-[var(--accent)]/10 px-2 py-0.5 text-[9px] font-semibold uppercase tracking-widest text-[var(--accent)]">
{displayGenre || "Uncategorized"}
</span>
<span className="rounded-sm border border-[var(--border)] px-1.5 py-0.5 text-[9px] text-[var(--text-muted)]">
{storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"}
</span>
{isNew && (
<span className="rounded-sm bg-[var(--accent)]/10 px-1.5 py-0.5 text-[9px] font-bold text-[var(--accent)]">
NEW
</span>
)}
{storyline.sunset && (
<span className="rounded-sm border border-[var(--border)] px-1.5 py-0.5 text-[9px] text-[var(--text-muted)]">
complete
Expand All @@ -97,26 +109,23 @@ export function StoryCard({
)}
</div>

{/* Bottom spacer (author shown below card with profile link) */}
<div className="relative z-10 px-4 py-3" />
{/* Bottom: author name inside cover — z-40 so profile link sits above card link */}
<div className="relative z-40 px-4 py-3 text-[10px] text-[var(--text-muted)]">
<span className="inline-flex items-center gap-1">
<WriterIdentityClient address={storyline.writer_address} />
{storyline.writer_type === 1 && <AgentBadge />}
</span>
</div>
</div>
</Link>
</div>

{/* Metadata below notebook */}
<div className="mt-2.5 flex flex-col gap-0.5 pl-1 pr-1 text-[10px] text-[var(--text-muted)]">
<span className="inline-flex items-center gap-1">
<WriterIdentityClient address={storyline.writer_address} />
{storyline.writer_type === 1 && <AgentBadge />}
</span>
{storyline.token_address && (
<span className="whitespace-nowrap">
<StoryCardTVL tokenAddress={storyline.token_address} />
</span>
)}
<span className="whitespace-nowrap">
{storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} linked
{isNew && <span className="ml-1 text-[10px] font-bold text-[var(--accent)]">NEW</span>}
</span>
<RatingSummary storylineId={storyline.storyline_id} />
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/__tests__/StoryCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ describe("StoryCard", () => {

it("links to correct story page", () => {
render(<StoryCard storyline={makeStoryline({ storyline_id: 42 })} />);
const link = screen.getAllByText("Test Story Title")[0].closest("a");
const link = screen.getByRole("link", { name: "Test Story Title" });
expect(link).toHaveAttribute("href", "/story/42");
});

it("applies moleskine-notebook class for hover animation", () => {
render(<StoryCard storyline={makeStoryline()} />);
const link = screen.getAllByText("Test Story Title")[0].closest("a");
expect(link).toHaveClass("moleskine-notebook");
const container = screen.getAllByText("Test Story Title")[0].closest(".moleskine-notebook");
expect(container).toBeTruthy();
});

it("shows plot count", () => {
Expand Down
Loading