feat: add SPA, serve at /app/, update Dockerfile and README

- React + TanStack Router + shadcn/ui SPA under spa/
- serve spa/dist at /app/ with index.html fallback for client routing
- Dockerfile: node build stage for SPA, copy dist into runtime image
- README: document SPA, CORS_ORIGINS env var, architecture entry
- vite base set to /app/, manifest.json paths fixed
This commit is contained in:
2026-06-04 04:20:15 +02:00
parent 15dc0e526b
commit b9c0b10740
153 changed files with 24329 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
import { createFileRoute, useNavigate, Link } from "@tanstack/react-router"
import { useState } from "react"
import { useTranslation } from "react-i18next"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { useRegister } from "@/hooks/use-auth"
export const Route = createFileRoute("/register")({
component: RegisterPage,
})
function RegisterPage() {
const { t } = useTranslation()
const navigate = useNavigate()
const registerMutation = useRegister()
const [email, setEmail] = useState("")
const [username, setUsername] = useState("")
const [password, setPassword] = useState("")
function handleSubmit(e: React.FormEvent) {
e.preventDefault()
registerMutation.mutate(
{ email, username, password },
{ onSuccess: () => navigate({ to: "/login" }) },
)
}
return (
<div className="flex min-h-svh items-center justify-center p-6">
<div className="w-full max-w-sm space-y-6">
<div className="text-center">
<h1 className="text-2xl font-bold tracking-tight">{t("auth.title")}</h1>
<p className="mt-1 text-sm text-muted-foreground">{t("auth.registerHeading")}</p>
</div>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="email">{t("auth.email")}</Label>
<Input id="email" type="email" value={email} onChange={(e) => setEmail(e.target.value)} required autoComplete="email" />
</div>
<div className="space-y-2">
<Label htmlFor="username">{t("auth.username")}</Label>
<Input id="username" value={username} onChange={(e) => setUsername(e.target.value)} required autoComplete="username" />
</div>
<div className="space-y-2">
<Label htmlFor="password">{t("auth.password")}</Label>
<Input id="password" type="password" value={password} onChange={(e) => setPassword(e.target.value)} required autoComplete="new-password" />
</div>
{registerMutation.error && <p className="text-sm text-destructive">{t("auth.registerError")}</p>}
<Button type="submit" className="w-full" disabled={registerMutation.isPending}>
{registerMutation.isPending ? t("auth.creating") : t("auth.createAccount")}
</Button>
</form>
<p className="text-center text-sm text-muted-foreground">
{t("auth.hasAccount")}{" "}
<Link to="/login" className="font-medium text-primary underline">{t("auth.logIn")}</Link>
</p>
</div>
</div>
)
}