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
53 changes: 30 additions & 23 deletions src/app/story/[storylineId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,32 +289,39 @@ function StoryHeader({
</div>

{priceInfo && (
<div className="border-border bg-surface mt-4 grid grid-cols-2 gap-2 rounded border px-3 py-2 text-xs">
<MarketCapBox
tokenAddress={storyline.token_address}
totalSupply={parseFloat(priceInfo.totalSupply)}
pricePerToken={parseFloat(priceInfo.pricePerToken)}
/>
<div>
<span className="text-muted block text-[10px] uppercase tracking-wider">
Supply Minted
</span>
<span className="font-semibold text-accent">
{formatSupply(priceInfo.totalSupply)} tokens
</span>
<div className="mt-4 space-y-2 text-xs">
<div className="border-border bg-surface grid grid-cols-1 sm:grid-cols-2 gap-2 rounded border px-3 py-2">
<MarketCapBox
tokenAddress={storyline.token_address}
totalSupply={parseFloat(priceInfo.totalSupply)}
pricePerToken={parseFloat(priceInfo.pricePerToken)}
/>
<div>
<span className="text-muted block text-[10px] uppercase tracking-wider">
Supply Minted
</span>
<span className="font-semibold text-accent">
{formatSupply(priceInfo.totalSupply)} tokens
</span>
</div>
</div>
{storyline.sunset ? (
<div className="border-border bg-surface rounded border px-3 py-2">
<span className="text-muted">Story complete</span>
<span className="text-foreground ml-2">
{storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} total
</span>
</div>
) : storyline.last_plot_time ? (
<div className="border-border bg-surface rounded border px-3 py-2">
<span className="text-muted block text-[10px] uppercase tracking-wider mb-1">
Next Plot Publish Deadline
</span>
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} hideLabel />
</div>
) : null}
</div>
)}
{storyline.sunset ? (
<div className="border-border bg-surface mt-4 rounded border px-3 py-2 text-xs">
<span className="text-muted">Story complete</span>
<span className="text-foreground ml-2">
{storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} total
</span>
</div>
) : storyline.last_plot_time ? (
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} />
) : null}
{!storyline.sunset && (
<AddPlotButton storylineId={storyline.storyline_id} writerAddress={storyline.writer_address} />
)}
Expand Down
8 changes: 4 additions & 4 deletions src/components/DeadlineCountdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState, useEffect } from "react";

const DEADLINE_HOURS = 168;

export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {
export function DeadlineCountdown({ lastPlotTime, hideLabel }: { lastPlotTime: string; hideLabel?: boolean }) {
const [remaining, setRemaining] = useState<number | null>(null);

useEffect(() => {
Expand All @@ -19,7 +19,7 @@ export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {
if (remaining === null) {
return (
<div className="text-xs">
<span className="text-muted">Deadline:</span>{" "}
{!hideLabel && <><span className="text-muted">Deadline:</span>{" "}</>}
<span className="text-accent font-medium">--</span>
</div>
);
Expand All @@ -28,7 +28,7 @@ export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {
if (remaining <= 0) {
return (
<div className="text-xs">
<span className="text-muted">Deadline:</span>{" "}
{!hideLabel && <><span className="text-muted">Deadline:</span>{" "}</>}
<span className="text-error font-medium">expired</span>
</div>
);
Expand All @@ -50,7 +50,7 @@ export function DeadlineCountdown({ lastPlotTime }: { lastPlotTime: string }) {

return (
<div className="text-xs">
<span className="text-muted">Deadline:</span>{" "}
{!hideLabel && <><span className="text-muted">Deadline:</span>{" "}</>}
<span className="text-accent font-medium">{formatted}</span>
</div>
);
Expand Down
Loading