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
7 changes: 3 additions & 4 deletions packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ export function registerCreate(program: Command): void {
.requiredOption("-t, --title <title>", "Storyline title")
.requiredOption("-f, --file <path>", "Path to content file (plain text)")
.requiredOption("-g, --genre <genre>", "Genre label")
.option("-d, --deadline", "Enable sunset deadline", false)
.action(async (opts: { title: string; file: string; genre: string; deadline: boolean }) => {
.action(async (opts: { title: string; file: string; genre: string }) => {
try {
const content = readFileSync(opts.file, "utf-8");
const client = buildClient({ ipfs: true });

console.log(`Creating storyline "${opts.title}"...`);
console.log(`Creating storyline "${opts.title}" (7-day deadline)...`);
const result = await client.createStoryline(
opts.title,
content,
opts.genre,
opts.deadline,
true,
);

console.log("Storyline created!");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function registerStatus(program: Command): void {

// Deadline remaining (72h from last plot)
if (dbRow.has_deadline && dbRow.last_plot_time && !dbRow.sunset) {
const DEADLINE_HOURS = 72;
const DEADLINE_HOURS = 168;
const deadlineMs =
new Date(dbRow.last_plot_time).getTime() + DEADLINE_HOURS * 60 * 60 * 1000;
const remainingMs = deadlineMs - Date.now();
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ export class PlotLink {
* @param title - Storyline title
* @param content - Opening plot content (plain text)
* @param genre - Genre label (stored off-chain; used for agent URI composition)
* @param hasDeadline - Whether the storyline has a sunset deadline (default: false)
* @param hasDeadline - Whether the storyline has a sunset deadline (default: true, mandatory 7-day)
* @returns The storyline ID, transaction hash, and IPFS CID
*/
async createStoryline(
title: string,
content: string,
genre: string,
hasDeadline = false,
hasDeadline = true,
): Promise<CreateStorylineResult> {
this.requireFilebase();
validateNonEmpty("title", title);
Expand Down
22 changes: 5 additions & 17 deletions src/app/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function CreateStorylinePage() {
const { isConnected } = useAccount();
const [title, setTitle] = useState("");
const [content, setContent] = useState("");
const [hasDeadline, setHasDeadline] = useState(false);
const hasDeadline = true; // mandatory 7-day deadline for all storylines

const { state, error, execute, reset } = usePublish();
const { valid, charCount } = validateContentLength(content);
Expand Down Expand Up @@ -134,22 +134,10 @@ export default function CreateStorylinePage() {
</div>
</div>

{/* Deadline toggle */}
<label className="flex cursor-pointer items-center gap-3">
<input
type="checkbox"
checked={hasDeadline}
onChange={(e) => setHasDeadline(e.target.checked)}
disabled={busy}
className="accent-accent h-4 w-4"
/>
<span className="text-foreground text-sm">
Enable 72h deadline
</span>
<span className="text-muted text-xs">
Story sunsets if no new plot within 72 hours
</span>
</label>
{/* Deadline info */}
<p className="text-muted text-xs">
All storylines have a 7-day deadline — the story sunsets if no new plot is added within 7 days.
</p>

{/* Status */}
{state === "error" && (
Expand Down
8 changes: 3 additions & 5 deletions src/app/dashboard/writer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ function StorylineDetail({ storyline, writerAddress }: { storyline: Storyline; w
</div>
</div>

{!storyline.sunset &&
storyline.has_deadline &&
storyline.last_plot_time && (
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} />
)}
{!storyline.sunset && storyline.last_plot_time && (
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} />
)}

{storyline.token_address && (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/app/story/[storylineId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function StoryHeader({
{storyline.plot_count} {storyline.plot_count === 1 ? "plot" : "plots"} total
</span>
</div>
) : storyline.has_deadline && storyline.last_plot_time ? (
) : storyline.last_plot_time ? (
<DeadlineCountdown lastPlotTime={storyline.last_plot_time} />
) : null}
</header>
Expand Down
2 changes: 1 addition & 1 deletion src/components/DeadlineCountdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState, useEffect } from "react";

const DEADLINE_HOURS = 72;
const DEADLINE_HOURS = 168;

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