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
2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/cs/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/da/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/de/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/en/visual-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@
"promoBanner": "Promo Banner",
"promoMedia": "Promo Media",
"publishBlocked": {
"deploymentFailed": "Publish is disabled because the latest deployment failed. Please fix the issues and try again",
"deploymentInactive": "Publish is disabled because the deployment is inactive",
"deploymentInProgress": "Update is disabled while deployment is in progress"
},
"publishError": {
Expand Down
2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/es/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/et/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/fi/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/fr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/hr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/hu/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/it/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/ja/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/lv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/nb/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/nl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/pl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/pt/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/ro/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/sk/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/sv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/tr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/platform/zh/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const InternalThemeEditor = ({
setClearLocalChangesModalOpen={setClearLocalChangesModalOpen}
totalEntityCount={templateMetadata.totalEntityCount}
localDev={localDev}
deploymentInProgress={templateMetadata.deploymentInProgress}
headDeployStatus={templateMetadata.headDeployStatus}
/>
),
actionBar: () => <></>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
type ErrorSource,
} from "../../../contexts/ErrorContext.tsx";
import { getPublishErrorMessage } from "../../../utils/publishErrors.ts";
import { getPublishTooltipMessageFromHeadDeployStatus } from "../../utils/getPublishTooltipMessageFromHeadDeployStatus.ts";

const usePuck = createUsePuck();
const devLogger = new DevLogger();
Expand Down Expand Up @@ -124,17 +125,15 @@ export const LayoutHeader = (props: LayoutHeaderProps) => {
}
};

const deploymentInProgress = templateMetadata.deploymentInProgress;
const publishDisabled =
histories.length === 1 || hasErrors || deploymentInProgress;
const publishTooltipMessage = deploymentInProgress
? pt(
"publishBlocked.deploymentInProgress",
"Update is disabled while deployment is in progress"
)
: hasErrors
? getPublishErrorMessage(errorSources, errorDetails)
: undefined;
histories.length === 1 ||
hasErrors ||
templateMetadata.headDeployStatus !== "ACTIVE";
const publishTooltipMessage =
(hasErrors ?? getPublishErrorMessage(errorSources, errorDetails)) ||
getPublishTooltipMessageFromHeadDeployStatus(
templateMetadata.headDeployStatus
);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import { RotateCcw, RotateCw } from "lucide-react";
import { Separator } from "@radix-ui/react-separator";
import { LocalDevOverrideButtons } from "./LayoutHeader.tsx";
import { pt } from "../../../utils/i18n/platform.ts";
import { HeadDeployStatus } from "../../types/templateMetadata.ts";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "../ui/Tooltip.tsx";
import { getPublishTooltipMessageFromHeadDeployStatus } from "../../utils/getPublishTooltipMessageFromHeadDeployStatus.ts";

type ThemeHeaderProps = {
onPublishTheme: () => Promise<void>;
Expand All @@ -31,7 +33,7 @@ type ThemeHeaderProps = {
setClearLocalChangesModalOpen: (newValue: boolean) => void;
totalEntityCount: number;
localDev: boolean;
deploymentInProgress: boolean;
headDeployStatus: HeadDeployStatus;
};

export const ThemeHeader = (props: ThemeHeaderProps) => {
Expand All @@ -47,7 +49,7 @@ export const ThemeHeader = (props: ThemeHeaderProps) => {
setClearLocalChangesModalOpen,
totalEntityCount,
localDev,
deploymentInProgress,
headDeployStatus,
} = props;

const getPuck = useGetPuck();
Expand Down Expand Up @@ -139,13 +141,10 @@ export const ThemeHeader = (props: ThemeHeaderProps) => {
}, []);

const publishDisabled =
themeHistories?.histories?.length === 1 || deploymentInProgress;
const publishTooltipMessage = deploymentInProgress
? pt(
"publishBlocked.deploymentInProgress",
"Update is disabled while deployment is in progress"
)
: undefined;
themeHistories?.histories?.length === 1 || headDeployStatus !== "ACTIVE";

const publishTooltipMessage =
getPublishTooltipMessageFromHeadDeployStatus(headDeployStatus);

return (
<header className="puck-header">
Expand Down
6 changes: 4 additions & 2 deletions packages/visual-editor/src/internal/types/templateMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { FontRegistry } from "../../utils/fonts/visualEditorFonts.ts";
import DOMPurify from "dompurify";

export type HeadDeployStatus = "RUNNING" | "INACTIVE" | "FAILED" | "ACTIVE";

export type TemplateMetadata = {
siteId: number;
templateId: string;
Expand All @@ -18,9 +20,9 @@ export type TemplateMetadata = {
platformLocale?: string;
locales: string[];
layoutTaskApprovals: boolean;
deploymentInProgress: boolean;
locatorDisplayFields?: Record<string, FieldTypeData>;
customFonts?: FontRegistry;
headDeployStatus: HeadDeployStatus;
};

export type FieldTypeData = {
Expand Down Expand Up @@ -48,7 +50,7 @@ export function generateTemplateMetadata(): TemplateMetadata {
platformLocale: "en",
locales: ["en", "es", "fr"],
layoutTaskApprovals: false,
deploymentInProgress: false,
headDeployStatus: "ACTIVE",
locatorDisplayFields: {
name: {
field_id: "name",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { HeadDeployStatus } from "../types/templateMetadata.ts";
import { pt } from "../../utils/i18n/platform.ts";

export const getPublishTooltipMessageFromHeadDeployStatus = (
headDeployStatus: HeadDeployStatus
): string | undefined => {
switch (headDeployStatus) {
case "RUNNING":
return pt(
"publishBlocked.deploymentInProgress",
"Update is disabled while deployment is in progress"
);
case "FAILED":
return pt(
"publishBlocked.deploymentFailed",
"Publish is disabled because the latest deployment failed. Please fix the issues and try again"
);
case "INACTIVE":
return pt(
"publishBlocked.deploymentInactive",
"Publish is disabled because the deployment is inactive"
);
default:
return undefined;
}
};