@pramen/cms-editor 0.0.22 → 0.0.24
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/dist/index.html +1 -1
- package/dist/{main.54b274dt.js → main.nh6tk2qq.js} +16 -16
- package/package.json +1 -1
- package/src/components.tsx +24 -6
package/package.json
CHANGED
package/src/components.tsx
CHANGED
|
@@ -379,6 +379,26 @@ function Workflow({ api, page, onChanged, onError }: { api: Api; page: Page; onC
|
|
|
379
379
|
onError(errMsg(e));
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
+
// Show only the transitions valid FROM the current status, so a draft never surfaces a
|
|
383
|
+
// primary "Approve" that the server rejects (approve requires status === "review"). The
|
|
384
|
+
// server still enforces role gates; this just stops the UI from offering dead-end actions.
|
|
385
|
+
// `publish` = publishPage (any → published, reviewer/admin) — the one-click path for a solo
|
|
386
|
+
// operator; `approve` is the reviewer step of the two-actor review pipeline.
|
|
387
|
+
const status = String(page.status);
|
|
388
|
+
const buttons: Array<{ label: string; action: string; variant?: "secondary" | "ghost" }> =
|
|
389
|
+
status === "review"
|
|
390
|
+
? [
|
|
391
|
+
{ label: "Approve (publish)", action: "approve" },
|
|
392
|
+
{ label: "Reject", action: "reject", variant: "secondary" },
|
|
393
|
+
{ label: "Publish directly", action: "publishPage", variant: "secondary" },
|
|
394
|
+
]
|
|
395
|
+
: status === "published"
|
|
396
|
+
? [{ label: "Unpublish", action: "unpublishPage", variant: "secondary" }]
|
|
397
|
+
: // draft | rejected | archived
|
|
398
|
+
[
|
|
399
|
+
{ label: "Publish", action: "publishPage" },
|
|
400
|
+
{ label: "Submit for review", action: "submitForReview", variant: "secondary" },
|
|
401
|
+
];
|
|
382
402
|
return (
|
|
383
403
|
<div>
|
|
384
404
|
<Section>Workflow</Section>
|
|
@@ -387,13 +407,11 @@ function Workflow({ api, page, onChanged, onError }: { api: Api; page: Page; onC
|
|
|
387
407
|
<Pill status={page.status}>{page.status}</Pill>
|
|
388
408
|
</div>
|
|
389
409
|
<div className="flex flex-col gap-2">
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
<Button variant="secondary" onPress={() => act("publishPage")}>Publish directly</Button>
|
|
394
|
-
<Button variant="ghost" onPress={() => act("unpublishPage")}>Unpublish</Button>
|
|
410
|
+
{buttons.map((b) => (
|
|
411
|
+
<Button key={b.action} variant={b.variant} onPress={() => act(b.action)}>{b.label}</Button>
|
|
412
|
+
))}
|
|
395
413
|
</div>
|
|
396
|
-
<p className="mt-2.5 text-fg-subtle">
|
|
414
|
+
<p className="mt-2.5 text-fg-subtle">Publish needs a reviewer/admin role; submit-for-review is editor-gated.</p>
|
|
397
415
|
</div>
|
|
398
416
|
);
|
|
399
417
|
}
|