Switch to .env, use multiple projects

This commit is contained in:
2024-12-29 17:00:12 -06:00
parent 4141af5406
commit 85fb7781fd
2 changed files with 13 additions and 11 deletions

4
src/env/schema.mjs vendored
View File

@@ -8,6 +8,10 @@ import { z } from "zod";
export const serverSchema = z.object({
DIRECTUS_REVALIDATE_KEY: z.string(),
NODE_ENV: z.enum(["development", "test", "production"]),
TITLE: z.preprocess((value) => {
if (value === undefined || value === "") return null;
return value;
}, z.string().nullable()),
});
/**

View File

@@ -1,13 +1,14 @@
import AppWrapper from "@/components/AppWrapper";
import { env } from "@/env/server.mjs";
import directus from "@/utils/directus";
import { readSingleton } from "@directus/sdk";
import { GetStaticPropsResult, type NextPage } from "next";
import Head from "next/head";
import Link from "next/link";
import { useEffect, useState } from "react";
import Balancer from "react-wrap-balancer";
type IndexProps = {
title: string;
tagline: string;
buttons: { text: string; href: string }[];
};
@@ -23,6 +24,7 @@ export async function getStaticProps(): Promise<
return {
props: {
title: env.TITLE ?? "Xevion",
tagline: metadata.tagline,
buttons: [
{ text: "GitHub", href: "https://github.com/Xevion" },
@@ -36,15 +38,11 @@ export async function getStaticProps(): Promise<
};
}
const Home: NextPage<IndexProps> = ({ tagline, buttons }: IndexProps) => {
const [isWalters, setIsWalters] = useState(false);
useEffect(() => {
// Check if URL contains "walters.to"
if (location.href.includes("walters.to")) {
setIsWalters(true);
}
}, []);
const Home: NextPage<IndexProps> = ({
title,
tagline,
buttons,
}: IndexProps) => {
return (
<>
<Head>
@@ -70,7 +68,7 @@ const Home: NextPage<IndexProps> = ({ tagline, buttons }: IndexProps) => {
</nav>
<div className="animate-glow hidden h-px w-screen animate-fade-left bg-gradient-to-r from-zinc-300/0 via-zinc-300/50 to-zinc-300/0 md:block" />
<h1 className="text-edge-outline font-display z-10 my-3.5 animate-title whitespace-nowrap bg-white bg-clip-text font-hanken text-5xl uppercase text-transparent drop-shadow-extreme duration-1000 sm:text-6xl md:text-9xl lg:text-10xl">
{isWalters ? "Walters" : "Xevion"}
{title}
</h1>
<div className="animate-glow hidden h-px w-screen animate-fade-right bg-gradient-to-r from-zinc-300/0 via-zinc-300/50 to-zinc-300/0 md:block" />
<div className="max-w-screen-sm animate-fade-in text-center text-sm text-zinc-500 sm:text-base">