diff --git a/docker-compose.dev-env.yml b/docker-compose.dev-env.yml
index 26d5ccc..146653f 100644
--- a/docker-compose.dev-env.yml
+++ b/docker-compose.dev-env.yml
@@ -63,6 +63,8 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile
+ args:
+ VITE_TSUMUGU_ENV: development
ports:
- "${TSUMUGU_FRONTEND_PORT:-3094}:80"
depends_on:
diff --git a/docker-compose.yml b/docker-compose.yml
index 1be53eb..8b0e98d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -65,6 +65,8 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile
+ args:
+ VITE_TSUMUGU_ENV: production
container_name: tsumugu-ui
ports:
- "${TSUMUGU_FRONTEND_PORT:-3007}:80"
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index e5d87f4..a4c040c 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -5,9 +5,11 @@ WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci
-COPY index.html vite.config.js ./
+COPY index.html vite.config.js mark-environment.mjs ./
COPY public ./public
COPY src ./src
+ARG VITE_TSUMUGU_ENV=production
+ENV VITE_TSUMUGU_ENV=$VITE_TSUMUGU_ENV
RUN npm run build
FROM nginx:alpine
diff --git a/frontend/mark-environment.mjs b/frontend/mark-environment.mjs
new file mode 100644
index 0000000..665f695
--- /dev/null
+++ b/frontend/mark-environment.mjs
@@ -0,0 +1,20 @@
+import fs from "node:fs";
+
+if (process.env.VITE_TSUMUGU_ENV !== "development") {
+ process.exit(0);
+}
+
+const manifestPath = new URL("./dist/manifest.webmanifest", import.meta.url);
+const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
+manifest.name = "Tsumugu Entwicklung";
+manifest.short_name = "Tsumugu Dev";
+manifest.theme_color = "#8a5a12";
+fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
+
+const indexPath = new URL("./dist/index.html", import.meta.url);
+const html = fs
+ .readFileSync(indexPath, "utf8")
+ .replace("
Tsumugu", "Tsumugu · Entwicklung")
+ .replace('name="apple-mobile-web-app-title" content="Tsumugu"', 'name="apple-mobile-web-app-title" content="Tsumugu Dev"')
+ .replace('name="theme-color" content="#085041"', 'name="theme-color" content="#8a5a12"');
+fs.writeFileSync(indexPath, html);
diff --git a/frontend/package.json b/frontend/package.json
index 25a42d4..a9a3d19 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite",
- "build": "vite build",
+ "build": "vite build && node mark-environment.mjs",
"preview": "vite preview"
},
"dependencies": {
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index f5b8be1..901db8a 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -14,6 +14,17 @@ import { Users } from "./pages/Users.jsx";
import { Work } from "./pages/Work.jsx";
import { Settings } from "./pages/Settings.jsx";
import { Reader } from "./pages/Reader.jsx";
+import { appTitle, isDevelopment } from "./environment.js";
+
+function EnvironmentBanner() {
+ useEffect(() => {
+ document.title = appTitle;
+ if (!isDevelopment) return;
+ document.querySelector('meta[name="theme-color"]')?.setAttribute("content", "#8a5a12");
+ }, []);
+ if (!isDevelopment) return null;
+ return Entwicklungsumgebung
;
+}
export function App() {
const [session, setSession] = useState(undefined);
@@ -66,31 +77,41 @@ export function App() {
}
if (session === undefined) {
- return Tsumugu wird geladen …
;
+ return (
+
+
+
Tsumugu wird geladen …
+
+ );
}
const value = { session, setSession, refresh, changeScope, logout };
return (
-
- : } />
- : }>
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
-
+
+
+
+
+ : } />
+ : }>
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
+
);
}
diff --git a/frontend/src/environment.js b/frontend/src/environment.js
new file mode 100644
index 0000000..f14d70f
--- /dev/null
+++ b/frontend/src/environment.js
@@ -0,0 +1,7 @@
+// Dieselbe Quellfassung läuft nach dem Merge in beiden Deployments.
+// Development setzt VITE_TSUMUGU_ENV beim Image-Build. Der lokale Vite-Server gilt ebenfalls als Entwicklung.
+export const isDevelopment =
+ import.meta.env.VITE_TSUMUGU_ENV === "development" ||
+ (import.meta.env.DEV && import.meta.env.VITE_TSUMUGU_ENV !== "production");
+
+export const appTitle = isDevelopment ? "Tsumugu · Entwicklung" : "Tsumugu";
diff --git a/frontend/src/styles.css b/frontend/src/styles.css
index 64d8b4d..9b230eb 100644
--- a/frontend/src/styles.css
+++ b/frontend/src/styles.css
@@ -141,6 +141,37 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.error { color: var(--danger); font-size: 14px; }
.banner { margin: 0 16px 8px; }
+.app-root {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+.app-root__main {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+}
+.app-root__main > .app-shell,
+.app-root__main > .login,
+.app-root > .boot {
+ flex: 1;
+ min-height: 0;
+ height: auto;
+}
+.env-banner {
+ margin: 0;
+ flex: none;
+ background: var(--warn);
+ color: #fff;
+ text-align: center;
+ font-size: 13px;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
+}
+
.boot, .login {
min-height: 100%;
display: grid;