mirror of
https://github.com/TheRealOwenRees/chess-scribe-website.git
synced 2026-07-23 09:56:57 +00:00
Compare commits
6 Commits
573d063d55
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
1245bf74c2
|
|||
|
908dd9b57b
|
|||
|
18f86125da
|
|||
|
f4ff9d8c68
|
|||
|
7994f79e02
|
|||
|
d11d360cbf
|
@@ -35,9 +35,9 @@ jobs:
|
||||
build-args: |
|
||||
VITE_API_BASE_URL=https://api.chess-scribe.org/api/v1
|
||||
VITE_MATOMO_URL=https://analytics.owenrees.eu
|
||||
VITE_MATOMO_SITE_ID=3
|
||||
VITE_MAINTENANCE_MODE=false
|
||||
VITE_MAINTENANCE_MODE_MESSAGE=ChessScribe is currently undergoing maintenance. Some features may be unavailable.
|
||||
VITE_MATOMO_SITE_ID="3"
|
||||
VITE_MAINTENANCE_MODE=
|
||||
VITE_MAINTENANCE_MODE_MESSAGE="ChessScribe is currently undergoing maintenance. Some features may be unavailable."
|
||||
|
||||
deploy:
|
||||
needs: publish
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import { Image } from "@unpic/react";
|
||||
import { z } from "zod";
|
||||
import MaintenanceModeBanner from "#/components/MaintenanceModeBanner.tsx";
|
||||
import { env } from "#/env.ts";
|
||||
import logo from "@/assets/images/logo.svg?url";
|
||||
|
||||
export default function Header() {
|
||||
const maintenanceModeMessage = env.VITE_MAINTENANCE_MODE
|
||||
? z
|
||||
.string()
|
||||
.transform((value) => (value.trim() === "" ? null : value))
|
||||
.parse(env.VITE_MAINTENANCE_MODE_MESSAGE)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<header>
|
||||
{env.VITE_MAINTENANCE_MODE ? (
|
||||
{maintenanceModeMessage ? (
|
||||
<div className="absolute w-full">
|
||||
<MaintenanceModeBanner message={env.VITE_MAINTENANCE_MODE_MESSAGE} />
|
||||
<MaintenanceModeBanner message={maintenanceModeMessage} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<nav className="w-full max-w-screen-2xl place-self-center p-8">
|
||||
<div className="container mx-auto flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
|
||||
+4
-2
@@ -1,8 +1,8 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const clientSchema = z.object({
|
||||
VITE_API_BASE_URL: z.string("Invalid API Base URL format"),
|
||||
VITE_MATOMO_URL: z.string("Invalid URL format"),
|
||||
VITE_API_BASE_URL: z.url("Invalid API Base URL format"),
|
||||
VITE_MATOMO_URL: z.url("Invalid URL format"),
|
||||
VITE_MATOMO_SITE_ID: z.string("Invalid Site ID"),
|
||||
VITE_MAINTENANCE_MODE: z.string("Invalid Maintenance Mode"),
|
||||
VITE_MAINTENANCE_MODE_MESSAGE: z.string().optional(),
|
||||
@@ -27,6 +27,7 @@ const getEnv = () => {
|
||||
const _env = fullSchema.safeParse(rawEnv);
|
||||
if (!_env.success) {
|
||||
console.error("❌ Invalid Server Environment Variables:");
|
||||
console.error(JSON.stringify(_env.error.format(), null, 2));
|
||||
throw new Error("Invalid environment variables");
|
||||
}
|
||||
return _env.data;
|
||||
@@ -34,6 +35,7 @@ const getEnv = () => {
|
||||
const _env = clientSchema.safeParse(rawEnv);
|
||||
if (!_env.success) {
|
||||
console.error("❌ Invalid Client Environment Variables:");
|
||||
console.error(JSON.stringify(_env.error.format(), null, 2));
|
||||
throw new Error("Invalid environment variables");
|
||||
}
|
||||
return _env.data as z.infer<typeof fullSchema>;
|
||||
|
||||
Reference in New Issue
Block a user