Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

feat: show local link for published sites in dev

Andras Bacsaif5f281c4b9a8
diff --git a/apps/designer/app/designer/features/topbar/publish.tsx b/apps/designer/app/designer/features/topbar/publish.tsx
index f8be10d09e..a4dd14b41d 100644
--- a/apps/designer/app/designer/features/topbar/publish.tsx
+++ b/apps/designer/app/designer/features/topbar/publish.tsx
@@ -19,8 +19,8 @@ import env from "~/shared/env";
type PublishButtonProps = { project: Project };
-const host = () => {
- if (env.EDGE_DEPLOYMENT === "true" && env.EDGE_DOMAIN !== "") {
+const host = (isLocal: boolean = false) => {
+ if (!isLocal && env.EDGE_DEPLOYMENT && env.EDGE_DOMAIN !== "") {
return env.EDGE_DOMAIN;
}
if (typeof location === "object") {
@@ -54,25 +54,52 @@ const Content = ({ project }: PublishButtonProps) => {
<fetcher.Form method="post" action="/rest/publish">
<Flex direction="column" gap="2">
{url !== undefined && (
- <Link
- href={url}
- target="_blank"
- css={{
- display: "flex",
- gap: "$0",
- }}
- >
- <Text
+ <>
+ {env.DEV_LOGIN && env.EDGE_DEPLOYMENT && (
+ <>
+ Local Deployment:
+ <Link
+ href={`${domain}.${host(true)}`}
+ target="_blank"
+ css={{
+ display: "flex",
+ gap: "$0",
+ }}
+ >
+ <Text
+ css={{
+ whiteSpace: "nowrap",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ }}
+ >
+ {`${domain}.${host(true)}`}{" "}
+ </Text>
+ <ExternalLinkIcon />
+ </Link>
+ </>
+ )}
+ {env.DEV_LOGIN && env.EDGE_DEPLOYMENT && <>Edge Deployment:</>}
+ <Link
+ href={url}
+ target="_blank"
css={{
- whiteSpace: "nowrap",
- overflow: "hidden",
- textOverflow: "ellipsis",
+ display: "flex",
+ gap: "$0",
}}
>
- {`${domain}.${host()}`}{" "}
- </Text>
- <ExternalLinkIcon />
- </Link>
+ <Text
+ css={{
+ whiteSpace: "nowrap",
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ }}
+ >
+ {`${domain}.${host()}`}{" "}
+ </Text>
+ <ExternalLinkIcon />
+ </Link>
+ </>
)}
<Flex gap="2" align="center">
<input type="hidden" name="projectId" value={project.id} />
diff --git a/apps/designer/app/env.server.ts b/apps/designer/app/env.server.ts
index 40339349b4..f3843183b9 100644
--- a/apps/designer/app/env.server.ts
+++ b/apps/designer/app/env.server.ts
@@ -5,8 +5,9 @@ const env = {
VERCEL_ENV: process.env.VERCEL_ENV,
DEBUG: process.env.DEBUG,
FEATURES: process.env.FEATURES,
- EDGE_DEPLOYMENT: process.env.EDGE_DEPLOYMENT,
+ EDGE_DEPLOYMENT: process.env.EDGE_DEPLOYMENT === "true",
EDGE_DOMAIN: process.env.EDGE_DOMAIN,
+ DEV_LOGIN: process.env.DEV_LOGIN === "true",
} as const;
export default env;