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
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ import type { DeployView } from "./DeployPanel.js";
import { useDeploy } from "./useDeploy.js";

const LABELS: Record<DeployView, string> = {
idle: "Publish",
idle: "Deploy",
starting: "Building…",
queued: "In queue…",
building: "Building…",
ready: "Preview ready",
failed: "Build failed",
publishing: "Publishing…",
publishing: "Deploying…",
};

type Props = { placement?: "document" | "header" };

// The Publish button — beside Save on a document, or in the admin's top bar — and the drawer it opens.
// The Deploy button — beside Save on a document, or in the admin's top bar — and the drawer it opens.
// Not "Publish": with drafts on, Payload's own Publish sits next to it and means the document.
export const DeployButton = ({ placement = "document" }: Props) => {
const info = useDocumentInfo();
const { mostRecentUpdate } = useDocumentEvents();
Expand Down Expand Up @@ -102,7 +103,7 @@ export const DeployButton = ({ placement = "document" }: Props) => {
const waiting = view === "idle" ? status.changes.length : 0;

// Cancel means nothing goes live: the build is stopped or its preview deleted, and the drawer
// closes on the Publish button again.
// closes on the Deploy button again.
const cancel = async () => {
closeModal(drawerSlug);
if (current) {
Expand All @@ -129,7 +130,7 @@ export const DeployButton = ({ placement = "document" }: Props) => {
{LABELS[view]}
{waiting > 0 && (
<span
aria-label={`${waiting} unpublished changes`}
aria-label={`${waiting} changes not deployed`}
style={{
padding: "0 7px",
borderRadius: 999,
Expand All @@ -144,7 +145,7 @@ export const DeployButton = ({ placement = "document" }: Props) => {
)}
</span>
</Button>
<Drawer slug={drawerSlug} title="Publish site">
<Drawer slug={drawerSlug} title="Deploy site">
<DeployPanel
error={error}
log={log}
Expand All @@ -159,8 +160,8 @@ export const DeployButton = ({ placement = "document" }: Props) => {
</Drawer>
<ConfirmationModal
body={`${status.note ? `${status.note} ` : ""}The preview replaces what is live at ${host}.`}
confirmLabel="Publish"
heading={`Publish ${host}?`}
confirmLabel="Deploy"
heading={`Deploy ${host}?`}
modalSlug={confirmSlug}
onConfirm={async () => {
if (current) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Props = {
onPublish: () => void;
};

// Payload's theme has no green (`success` is blue), so live takes the Publish button's green.
// Payload's theme has no green (`success` is blue), so live takes the Deploy button's green.
export const TONES: Record<DeployTone, string> = {
live: "#16a34a",
past: "#2f5bd3",
Expand Down Expand Up @@ -158,11 +158,11 @@ export const DeployPanel = ({

const badge: Record<DeployView, { label: string; tone: DeployTone; line: string }> = {
idle: {
label: status.lastPublishedAt ? "Live" : "Not published",
label: status.lastPublishedAt ? "Live" : "Not deployed",
tone: status.lastPublishedAt ? "live" : "muted",
line: status.lastPublishedAt
? `Last published ${ago(status.lastPublishedAt, now)}`
: "Nothing published yet",
? `Last deployed ${ago(status.lastPublishedAt, now)}`
: "Nothing deployed yet",
},
starting: { label: "Starting", tone: "busy", line: "Asking Netlify for a build…" },
queued: {
Expand Down Expand Up @@ -192,7 +192,7 @@ export const DeployPanel = ({
line: current ? `Stopped ${ago(current.createdAt, now)}` : "The build stopped",
},
publishing: {
label: "Publishing",
label: "Deploying",
tone: "busy",
line: "Replacing the live site with the preview…",
},
Expand All @@ -203,7 +203,7 @@ export const DeployPanel = ({
const builtAt = view === "ready" && current ? new Date(current.createdAt).getTime() : null;
const changeLists =
view === "idle"
? [{ title: "Saved since the last publish", note: null, changes: status.changes }]
? [{ title: "Saved since the last deploy", note: null, changes: status.changes }]
: builtAt !== null
? [
{
Expand Down Expand Up @@ -309,7 +309,7 @@ export const DeployPanel = ({
onClick={onBuild}
size="medium"
>
{site.locked ? "Start publishing" : "Build and publish"}
{site.locked ? "Start deploying" : "Build and deploy"}
</Button>
)}
{view === "failed" && can.build && (
Expand All @@ -320,7 +320,7 @@ export const DeployPanel = ({
{(view === "starting" || view === "queued" || view === "building") && (
<>
<Button buttonStyle="primary" disabled margin={false} size="medium">
{ownBuild || view === "starting" ? "Building…" : "Start publishing"}
{ownBuild || view === "starting" ? "Building…" : "Start deploying"}
</Button>
{ownBuild && can.build && current && (
<Button
Expand Down Expand Up @@ -369,7 +369,7 @@ export const DeployPanel = ({
onClick={onPublish}
size="medium"
>
Publish
Deploy
</Button>
{/* A new build replaces this preview as the one offered; this one stays on Netlify. */}
{can.build && (
Expand All @@ -396,7 +396,7 @@ export const DeployPanel = ({
)}
{view === "publishing" && (
<Button buttonStyle="primary" disabled margin={false} size="medium">
Publishing…
Deploying…
</Button>
)}
</div>
Expand Down
Loading