From ecc39745d745c71e6b9081e8c2d2f9446091c86f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=9B=E5=85=AE?= Date: Fri, 5 Jun 2026 12:32:29 +0800 Subject: [PATCH] chore: split dev and production deployment env --- package.json | 2 ++ src/pages/index.astro | 2 ++ src/styles/global.css | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/package.json b/package.json index 6fea8dc..fa312ca 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,8 @@ "scripts": { "dev": "astro dev", "build": "astro build", + "build:test": "PUBLIC_APP_ENV_LABEL=测试环境 astro build", + "build:prod": "PUBLIC_APP_ENV_LABEL=生产环境 astro build", "preview": "astro preview" }, "dependencies": { diff --git a/src/pages/index.astro b/src/pages/index.astro index 22a3f2d..fffca5f 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,6 +3,7 @@ import { resume, resumeEn } from "../data/resume"; import "../styles/global.css"; const githubUrl = "https://github.com/zhanBoss"; +const appEnvLabel = import.meta.env.PUBLIC_APP_ENV_LABEL || "生产环境"; const translations = { zh: resume, en: resumeEn }; const navIds = ["top", "proof", "skills", "projects", "experience", "contact"]; const brandAssets = { @@ -143,6 +144,7 @@ const projectLogoFor = (id: string) => brandAssets.projects[id] ?? null;
+
{appEnvLabel}
diff --git a/src/styles/global.css b/src/styles/global.css index 4c5d875..613a00e 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -101,6 +101,22 @@ a { background: linear-gradient(90deg, var(--green), var(--blue), var(--amber)); } +.environment-badge { + position: fixed; + top: 72px; + right: 16px; + z-index: 61; + padding: 8px 10px; + color: #ffffff; + font-size: 12px; + font-weight: 750; + line-height: 1; + letter-spacing: 0; + background: rgba(20, 20, 24, 0.86); + border-radius: 999px; + box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16); +} + .ambient-canvas { position: fixed; inset: 0;