plotlink-ows 1.2.94 → 1.2.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/lib/active-wallet.ts +260 -0
- package/app/lib/cartoon-coach.ts +1 -1
- package/app/lib/cartoon-readiness.ts +12 -10
- package/app/lib/cuts.ts +135 -18
- package/app/lib/lettering-status.ts +64 -6
- package/app/lib/story-progress.ts +2 -3
- package/app/routes/dashboard.ts +6 -4
- package/app/routes/publish.ts +56 -23
- package/app/routes/settings.ts +92 -37
- package/app/routes/wallet.ts +58 -30
- package/app/web/components/CartoonNextAction.tsx +145 -0
- package/app/web/components/CartoonPublishPage.tsx +1 -1
- package/app/web/components/CutListPanel.tsx +1198 -488
- package/app/web/components/Dashboard.tsx +15 -6
- package/app/web/components/FinishEpisodePanel.tsx +57 -46
- package/app/web/components/LetteringEditor.tsx +867 -366
- package/app/web/components/PreviewPanel.tsx +1459 -844
- package/app/web/components/StoriesPage.tsx +985 -475
- package/app/web/components/StoryProgressPanel.tsx +32 -102
- package/app/web/components/WalletCard.tsx +110 -8
- package/app/web/components/WorkflowCoach.tsx +63 -35
- package/app/web/dist/assets/{export-cut-nKQ_n2-J.js → export-cut-BqZI0-Rv.js} +1 -1
- package/app/web/dist/assets/index-C43toXVm.js +141 -0
- package/app/web/dist/assets/index-CcfChGEK.css +32 -0
- package/app/web/dist/index.html +2 -2
- package/package.json +1 -1
- package/app/web/dist/assets/index-BAZGwVwj.js +0 -143
- package/app/web/dist/assets/index-DoXH2OlP.css +0 -32
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import type { StoryProgress } from "@app-lib/story-progress";
|
|
3
|
+
import type { CoachUiAction } from "@app-lib/cartoon-coach";
|
|
4
|
+
import { WorkflowCoachView } from "./WorkflowCoach";
|
|
5
|
+
|
|
6
|
+
export function storyInfoNextStep(progress: StoryProgress): string {
|
|
7
|
+
if (progress.cover !== "present") {
|
|
8
|
+
return progress.cover === "invalid"
|
|
9
|
+
? "Replace the cover image - it must be a valid WebP or JPEG."
|
|
10
|
+
: "Add a cover image before publishing.";
|
|
11
|
+
}
|
|
12
|
+
const missing: string[] = [];
|
|
13
|
+
if (!progress.metadata.language) missing.push("language");
|
|
14
|
+
if (!progress.metadata.genre) missing.push("genre");
|
|
15
|
+
if (!progress.metadata.title) missing.push("title");
|
|
16
|
+
return `Add the story ${missing.join(" and ") || "details"} before publishing.`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function cartoonWorkflowActiveKey(progress: StoryProgress): string | null {
|
|
20
|
+
const coach = progress.coach ?? null;
|
|
21
|
+
const m = progress.metadata;
|
|
22
|
+
const hasStructure = progress.setup.hasStructure;
|
|
23
|
+
const hasGenesis = progress.setup.hasGenesis;
|
|
24
|
+
const coverDone = progress.cover === "present";
|
|
25
|
+
const metadataIncomplete = !m.title || !m.language || !m.genre;
|
|
26
|
+
const activeEp = progress.episodes.find((e) => !e.published) ?? null;
|
|
27
|
+
const productionPending = !!activeEp && activeEp.state !== "ready";
|
|
28
|
+
|
|
29
|
+
if (!hasStructure) return "whitepaper";
|
|
30
|
+
if (!hasGenesis) return "genesis.md";
|
|
31
|
+
if (metadataIncomplete) return "story-info";
|
|
32
|
+
if (productionPending && coach?.episodeFile) return coach.episodeFile;
|
|
33
|
+
if (!coverDone) return "story-info";
|
|
34
|
+
return coach?.episodeFile ?? null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function StoryInfoNextActionCard({
|
|
38
|
+
progress,
|
|
39
|
+
onOpenStoryInfo,
|
|
40
|
+
}: {
|
|
41
|
+
progress: StoryProgress;
|
|
42
|
+
onOpenStoryInfo?: () => void;
|
|
43
|
+
}) {
|
|
44
|
+
return (
|
|
45
|
+
<div className="m-3 rounded-lg border border-accent/40 bg-accent/10 px-4 py-3 shadow-sm" data-testid="story-info-cta">
|
|
46
|
+
<div className="flex items-center gap-3">
|
|
47
|
+
<div className="min-w-0 flex-1">
|
|
48
|
+
<span className="inline-flex rounded-full bg-background px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.14em] text-accent">
|
|
49
|
+
Story info
|
|
50
|
+
</span>
|
|
51
|
+
<p className="mt-1 text-sm text-foreground" data-testid="story-info-next-action">
|
|
52
|
+
<span className="font-semibold">Next: </span>
|
|
53
|
+
<span>{storyInfoNextStep(progress)}</span>
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
<button
|
|
57
|
+
type="button"
|
|
58
|
+
onClick={onOpenStoryInfo}
|
|
59
|
+
disabled={!onOpenStoryInfo}
|
|
60
|
+
className="flex-shrink-0 rounded bg-accent px-4 py-2.5 text-sm font-bold text-white shadow-sm transition-colors hover:bg-accent-dim disabled:cursor-not-allowed disabled:opacity-50"
|
|
61
|
+
data-testid="story-info-next-action-btn"
|
|
62
|
+
>
|
|
63
|
+
Next Action
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function CartoonNextActionView({
|
|
71
|
+
progress,
|
|
72
|
+
onCoachAction,
|
|
73
|
+
onOpenStoryInfo,
|
|
74
|
+
}: {
|
|
75
|
+
progress: StoryProgress;
|
|
76
|
+
onCoachAction: (action: CoachUiAction, episodeFile: string | null) => void;
|
|
77
|
+
onOpenStoryInfo?: () => void;
|
|
78
|
+
}) {
|
|
79
|
+
const activeKey = cartoonWorkflowActiveKey(progress);
|
|
80
|
+
if (activeKey === "story-info") {
|
|
81
|
+
return <StoryInfoNextActionCard progress={progress} onOpenStoryInfo={onOpenStoryInfo} />;
|
|
82
|
+
}
|
|
83
|
+
return (
|
|
84
|
+
<WorkflowCoachView
|
|
85
|
+
coach={progress.coach ?? null}
|
|
86
|
+
showEmptyState
|
|
87
|
+
onAction={onCoachAction}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function CartoonNextAction({
|
|
93
|
+
storyName,
|
|
94
|
+
authFetch,
|
|
95
|
+
refreshKey = 0,
|
|
96
|
+
onCoachAction,
|
|
97
|
+
onOpenStoryInfo,
|
|
98
|
+
}: {
|
|
99
|
+
storyName: string;
|
|
100
|
+
authFetch: (url: string, opts?: RequestInit) => Promise<Response>;
|
|
101
|
+
refreshKey?: number;
|
|
102
|
+
onCoachAction: (action: CoachUiAction, episodeFile: string | null) => void;
|
|
103
|
+
onOpenStoryInfo?: () => void;
|
|
104
|
+
}) {
|
|
105
|
+
const [progress, setProgress] = useState<StoryProgress | null | undefined>(undefined);
|
|
106
|
+
|
|
107
|
+
const targetKey = JSON.stringify([storyName, refreshKey]);
|
|
108
|
+
const [loadedKey, setLoadedKey] = useState<string | null>(null);
|
|
109
|
+
if (loadedKey !== targetKey) {
|
|
110
|
+
setProgress(undefined);
|
|
111
|
+
setLoadedKey(targetKey);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
let cancelled = false;
|
|
116
|
+
authFetch(`/api/stories/${storyName}/progress`)
|
|
117
|
+
.then((res) => (res.ok ? res.json() : null))
|
|
118
|
+
.then((data: StoryProgress | null) => {
|
|
119
|
+
if (!cancelled) setProgress(isValidProgress(data) ? data : null);
|
|
120
|
+
})
|
|
121
|
+
.catch(() => {
|
|
122
|
+
if (!cancelled) setProgress(null);
|
|
123
|
+
});
|
|
124
|
+
return () => { cancelled = true; };
|
|
125
|
+
}, [storyName, authFetch, refreshKey]);
|
|
126
|
+
|
|
127
|
+
if (progress === undefined) return null;
|
|
128
|
+
if (!progress) {
|
|
129
|
+
return <WorkflowCoachView coach={null} showEmptyState onAction={onCoachAction} />;
|
|
130
|
+
}
|
|
131
|
+
return (
|
|
132
|
+
<CartoonNextActionView
|
|
133
|
+
progress={progress}
|
|
134
|
+
onCoachAction={onCoachAction}
|
|
135
|
+
onOpenStoryInfo={onOpenStoryInfo}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function isValidProgress(data: StoryProgress | null): data is StoryProgress {
|
|
141
|
+
return !!data
|
|
142
|
+
&& !!data.metadata
|
|
143
|
+
&& !!data.setup
|
|
144
|
+
&& Array.isArray(data.episodes);
|
|
145
|
+
}
|
|
@@ -178,7 +178,7 @@ export function CartoonPublishPage({ storyName, authFetch, onOpenFile, onOpenSto
|
|
|
178
178
|
{ label: "Opening text ready", status: "done" }, // the episode exists once it appears here
|
|
179
179
|
{ label: "Cut plan", status: c && c.total > 0 ? "done" : "todo", detail: c ? `${c.total} cut${c.total === 1 ? "" : "s"} planned` : "not started" },
|
|
180
180
|
{ label: "Clean images converted", status: c && c.needClean > 0 && c.withClean === c.needClean ? "done" : "todo", detail: c ? `${c.withClean} / ${c.needClean}` : null },
|
|
181
|
-
{ label: "Cuts lettered", status: c && c.
|
|
181
|
+
{ label: "Cuts lettered", status: c && c.total > 0 && c.withText === c.total ? "done" : "todo", detail: c ? `${c.withText} / ${c.total}` : null },
|
|
182
182
|
{ label: "Final images exported", status: c && c.total > 0 && c.exported === c.total ? "done" : "todo", detail: c ? `${c.exported} / ${c.total}` : null },
|
|
183
183
|
{ label: "Final images uploaded", status: c && c.total > 0 && c.uploaded === c.total ? "done" : "todo", detail: c ? `${c.uploaded} / ${c.total}` : null },
|
|
184
184
|
{ label: "Cover image", status: coverDone ? "done" : "todo", detail: coverDone ? null : "recommended before publishing" },
|