handlePublish's JSON response has always included a `warnings` array (e.g. the contact-form relay's "submissions will not be delivered" notice), but nothing in the editor ever read it. Adds a PublishWarnings banner, held in its own state independent of the 3s publishStatus flash so the customer has time to read it, rendered in both the desktop and mobile TopBar branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
911 B
TypeScript
32 lines
911 B
TypeScript
import React from 'react';
|
|
|
|
export interface PublishWarningsProps {
|
|
warnings: string[];
|
|
onDismiss: () => void;
|
|
}
|
|
|
|
/** Non-blocking banner shown after a successful publish. The site IS live --
|
|
* these are things the customer should fix and re-publish, not failures. */
|
|
export const PublishWarnings: React.FC<PublishWarningsProps> = ({ warnings, onDismiss }) => {
|
|
if (!warnings.length) return null;
|
|
|
|
return (
|
|
<div className="publish-warnings" role="status" data-testid="publish-warnings">
|
|
<i className="fa fa-exclamation-triangle" aria-hidden="true" />
|
|
<ul>
|
|
{warnings.map((w, i) => (
|
|
<li key={i}>{w}</li>
|
|
))}
|
|
</ul>
|
|
<button
|
|
type="button"
|
|
onClick={onDismiss}
|
|
aria-label="Dismiss"
|
|
data-testid="publish-warnings-dismiss"
|
|
>
|
|
<i className="fa fa-times" aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
);
|
|
};
|