Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(content-editor): open Export on its options, Before you publish a Review away (#1471)

Cihan5f8a525b8c28
diff --git a/web/messages/en.json b/web/messages/en.json
index 490e0e8cc..5d48c3747 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -4389,6 +4389,15 @@
}
},
"exportDialog": {
+ "publish": {
+ "quiet": "Before you publish has the author, dates and schema (JSON-LD) for your CMS.",
+ "quietOther": "Before you publish has the author and what your CMS adds for this page type.",
+ "warnings": "Before you publish: {list}.",
+ "trust": "Trust {trust}, below 60",
+ "noAuthor": "no author yet",
+ "review": "Review",
+ "reviewLabel": "Review Before you publish"
+ },
"title": "Export",
"untitled": "Untitled",
"formats": "Files",
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
index 0a01697a1..c2164c8e9 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
@@ -83,7 +83,7 @@ import {
} from '@/lib/content/clean-html';
import { PAGE_READ_DELAY_MS, draftTitleFromDoc, safeLinkHref } from '@/lib/content/editor';
import { JsonLd } from '@/lib/content/json-ld-node';
-import { firstImage } from '@/lib/content/page-schema';
+import { firstImage, isArticlePage } from '@/lib/content/page-schema';
import { PLACEHOLDER, pagePlaceholders, placeholderIn } from '@/lib/content/placeholders';
import {
blankCode,
@@ -1816,6 +1816,8 @@ export function DraftEditor({
const [publishOpen, setPublishOpen] = useState<{
mode: 'markReady' | 'export' | 'send';
html: string;
+ /** Export's destination when Review opened it: Continue goes back to it. */
+ returnTo?: ExportDestination;
} | null>(null);
// Send to CMS (#1331): admins and managers send the page to the brand's
// webhook, as the page Export makes ready, past Before you publish once
@@ -1854,8 +1856,11 @@ export function DraftEditor({
if (quality) openBeforePublish('send');
else void openSend();
};
- const openBeforePublish = (mode: 'markReady' | 'export' | 'send') => {
- setPublishOpen({ mode, html: pageToPublish() });
+ const openBeforePublish = (
+ mode: 'markReady' | 'export' | 'send',
+ returnTo?: ExportDestination,
+ ) => {
+ setPublishOpen({ mode, html: pageToPublish(), returnTo });
if (mode === 'markReady') nudgeAt('markReady');
};
// Read once per change (a link read landing, the title), not on every render.
@@ -2035,7 +2040,7 @@ export function DraftEditor({
void markReady();
return;
case 'export':
- openBeforePublish('export');
+ openExport();
return;
}
};
@@ -2293,7 +2298,7 @@ export function DraftEditor({
size="icon-sm"
disabled={!editor}
aria-label={t('export.button')}
- onClick={() => openBeforePublish('export')}
+ onClick={() => openExport()}
>
<Download className="h-3.5 w-3.5" />
</Button>
@@ -2681,6 +2686,20 @@ export function DraftEditor({
setExportOpen(null);
fillFirstPlaceholder();
}}
+ // Export opens on its options (CE-057); Before you publish is a
+ // Review away, and comes back to Export.
+ publish={{
+ trustBelow:
+ quality.trust?.score != null && quality.trust.score < TRUST_GATE
+ ? quality.trust.score
+ : null,
+ noAuthor: quality.eeat !== null && !quality.author,
+ article: isArticlePage(pageType),
+ onReview: () => {
+ setExportOpen(null);
+ openBeforePublish('export', exportOpen.destination);
+ },
+ }}
/>
)}
@@ -2717,7 +2736,7 @@ export function DraftEditor({
const next = publishOpen.mode;
setPublishOpen(null);
if (next === 'send') void openSend();
- else openExport();
+ else openExport(publishOpen.returnTo);
}}
onClose={() => setPublishOpen(null)}
quality={quality}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
index 3654048a9..98c90517f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.test.tsx
@@ -121,6 +121,27 @@ afterEach(() => {
});
describe('ExportDialog', () => {
+ it('names what Before you publish warns about over its options, with Review', async () => {
+ const onReview = vi.fn();
+ await render({ publish: { trustBelow: 45, noAuthor: true, article: true, onReview } });
+ expect(dialog().textContent).toContain(
+ 'Before you publish: Trust 45, below 60 · no author yet.Review',
+ );
+ await act(async () => button('Review')!.click());
+ expect(onReview).toHaveBeenCalled();
+ // Nothing to warn about: a quiet line where the author, dates and schema are.
+ await render({ publish: { trustBelow: null, noAuthor: false, article: true, onReview } });
+ expect(dialog().textContent).toContain(
+ 'Before you publish has the author, dates and schema (JSON-LD) for your CMS.Review',
+ );
+ expect(button('Review')!.getAttribute('aria-label')).toBe('Review Before you publish');
+ // Not an article: no dates or JSON-LD to speak of.
+ await render({ publish: { trustBelow: null, noAuthor: false, article: false, onReview } });
+ expect(dialog().textContent).toContain(
+ 'Before you publish has the author and what your CMS adds for this page type.Review',
+ );
+ });
+
it('holds the export while a placeholder is open, and fills it or leaves its sentence out', async () => {
await render({ initialDestination: 'webflow' });
expect(dialog().querySelector('[role="alert"]')!.textContent).toContain(
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
index c1e8605a8..7ce54fb87 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_export-dialog.tsx
@@ -170,6 +170,7 @@ export function ExportDialog({
linksPending,
initialDestination,
onFillNow,
+ publish = null,
}: {
onClose: () => void;
title: string;
@@ -191,6 +192,17 @@ export function ExportDialog({
initialDestination?: ExportDestination;
/** Goes to the first placeholder, to fill it. */
onFillNow: () => void;
+ /**
+ * What Before you publish has for this page (CE-041), with Review: Export
+ * opens on its options, and names Trust under 60 or a missing author.
+ */
+ publish?: {
+ trustBelow: number | null;
+ noAuthor: boolean;
+ /** An article: Before you publish has its dates and JSON-LD too. */
+ article: boolean;
+ onReview: () => void;
+ } | null;
}) {
const t = useTranslations('contentEditor.editor.exportDialog');
const [destination, setDestination] = useState<ExportDestination>(
@@ -426,6 +438,7 @@ export function ExportDialog({
<DialogHeader>
<DialogTitle>{t('title')}</DialogTitle>
</DialogHeader>
+ {publish && <PublishLine {...publish} />}
<div className="space-y-2">
{radioRow(DRAFT_EXPORT_FORMATS, t('formats'))}
@@ -607,3 +620,51 @@ export function ExportDialog({
</Dialog>
);
}
+
+/**
+ * Before you publish, one line over Export's options: amber with what it
+ * warns about (Trust under 60, no author), else quiet; Review opens it.
+ */
+function PublishLine({
+ trustBelow,
+ noAuthor,
+ article,
+ onReview,
+}: {
+ trustBelow: number | null;
+ noAuthor: boolean;
+ article: boolean;
+ onReview: () => void;
+}) {
+ const t = useTranslations('contentEditor.editor.exportDialog.publish');
+ const warnings = [
+ ...(trustBelow !== null ? [t('trust', { trust: trustBelow })] : []),
+ ...(noAuthor ? [t('noAuthor')] : []),
+ ];
+ return (
+ <div
+ className={cn(
+ 'flex items-center gap-2 rounded-lg border px-3 py-2 text-xs',
+ warnings.length
+ ? 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-300'
+ : 'bg-muted/40 text-muted-foreground',
+ )}
+ >
+ {warnings.length > 0 && <AlertTriangle aria-hidden className="h-3.5 w-3.5 shrink-0" />}
+ <p className="min-w-0 flex-1">
+ {warnings.length
+ ? t('warnings', { list: warnings.join(' · ') })
+ : t(article ? 'quiet' : 'quietOther')}
+ </p>
+ <Button
+ variant="outline"
+ size="sm"
+ className="h-6 shrink-0 px-2 text-xs"
+ aria-label={t('reviewLabel')}
+ onClick={onReview}
+ >
+ {t('review')}
+ </Button>
+ </div>
+ );
+}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx
index 29d16f661..0b9d46347 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx
@@ -3627,12 +3627,15 @@ describe('the side panel', () => {
(b) => b.textContent === name,
)!;
- it('opens Before you publish on Export, then Export with the page fields', async () => {
+ it('opens Export on its options, Before you publish a Review away', async () => {
getContentDraft.mockResolvedValue(draft({ pageType: 'blog_post' }));
await renderPage();
await act(async () => button('Export')!.click());
- // Before you publish first (§7): what the CMS does, and Ready to paste.
- expect(dialog()!.textContent).toContain('Before you publish');
+ // Export's options at once, with what Before you publish warns about.
+ expect(dialog()!.textContent).toContain('Content · ready to paste');
+ expect(dialog()!.textContent).toContain('Before you publish: no author yet.Review');
+ await act(async () => inDialog('Review').click());
+ // Before you publish (§7): what the CMS does, and Ready to paste; back to Export.
expect(dialog()!.textContent).toContain(
'Ready to paste · doneNo placeholders, all images have alt text, all links work.',
);
@@ -3650,7 +3653,6 @@ describe('the side panel', () => {
getContentDraft.mockResolvedValue(draft({ pageType: 'blog_post' }));
await renderPage();
await act(async () => button('Export')!.click());
- await act(async () => inDialog('Continue to export').click());
expect(dialog()!.textContent).toContain('AuthorAcme Ekibi → your CMS author field');
} finally {
brandState.brands = [{ id: 'b1' }, { id: 'b2' }];
@@ -3670,6 +3672,7 @@ describe('the side panel', () => {
);
await renderPage();
await act(async () => button('Export')!.click());
+ await act(async () => inDialog('Review').click());
expect(dialog()!.textContent).toContain(
'Ready to paste · check itNo placeholders, all images have alt text; 1 link is still being read.',
);
@@ -3699,7 +3702,7 @@ describe('the side panel', () => {
getContentDraft.mockResolvedValue(draft({ authorId: null }));
await renderPage();
await act(async () => button('Export')!.click());
- expect(dialog()!.textContent).toContain('Before you publish');
+ expect(dialog()!.textContent).toContain('Content · ready to paste');
expect(container.querySelector('[aria-label="Your next step"]')).toBeNull();
});
@@ -3712,6 +3715,7 @@ describe('the side panel', () => {
);
await renderPage();
await act(async () => button('Export')!.click());
+ await act(async () => inDialog('Review').click());
expect(dialog()!.textContent).toContain(
'Not ready to paste yet · missing1 placeholder still open',
);
@@ -3745,8 +3749,6 @@ describe('the side panel', () => {
const ready =
'Ready to paste · doneNo placeholders, all images have alt text, all links work.';
await act(async () => button('Export')!.click());
- expect(dialog()!.textContent).toContain(ready);
- await act(async () => inDialog('Continue to export').click());
expect(dialog()!.querySelector('[role="alert"]')).toBeNull();
expect(inDialog('Download Word').disabled).toBe(false);
await act(async () => inDialog('Cancel').click());
@@ -3771,6 +3773,7 @@ describe('the side panel', () => {
source.dispatchEvent(new Event('input', { bubbles: true }));
});
await act(async () => button('Export')!.click());
+ await act(async () => inDialog('Review').click());
expect(dialog()!.textContent).toContain('1 placeholder still open');
await act(async () => inDialog('Fill now').click());
expect(dialog()).toBeNull();
@@ -3793,6 +3796,12 @@ describe('the side panel', () => {
'HTML',
);
expect(inDialog('Copy HTML').disabled).toBe(true);
+ // Review and back: still on HTML.
+ await act(async () => inDialog('Review').click());
+ await act(async () => inDialog('Continue to export').click());
+ expect(dialog()!.querySelector('[role="radio"][aria-checked="true"]')!.textContent).toBe(
+ 'HTML',
+ );
await act(async () => inDialog('Fill now').click());
expect(dialog()).toBeNull();
@@ -3813,6 +3822,8 @@ describe('the side panel', () => {
);
await renderPage();
await act(async () => button('Export')!.click());
+ expect(dialog()!.textContent).toContain('1 placeholder is still open');
+ await act(async () => inDialog('Review').click());
expect(dialog()!.textContent).toContain('1 placeholder still open');
await act(async () => inDialog('Continue to export').click());
expect(dialog()!.textContent).toContain('1 placeholder is still open');