Some checks failed
CI / Lint, typecheck, test (pull_request) Successful in 4m43s
CI / Build container images (pull_request) Successful in 1m11s
CI / Auth e2e pack (pull_request) Successful in 7m14s
CI / Import/export fidelity gate (pull_request) Successful in 56s
CD / Deploy to Test (push) Blocked by required conditions
CD / Smoke tests against Test (push) Blocked by required conditions
CD / Promote to Int (push) Blocked by required conditions
CI / Auth e2e pack (push) Blocked by required conditions
CI / Import/export fidelity gate (push) Blocked by required conditions
CI / Build container images (push) Blocked by required conditions
CD / Build and push images (push) Has been cancelled
CI / Lint, typecheck, test (push) Has been cancelled
i18n spiegelt die aktive Sprache auf <html lang> (Init + languageChanged; der User-Locale-Wechsel in auth-context läuft über dasselbe Event). Neuer useDocumentTitle-Hook setzt je Route einen sprechenden Titel (Seite — Teich — Dorfteich), verdrahtet in allen Routen-Komponenten; dynamische Titel folgen den geladenen Daten. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AGM8jo3hwoV9wsCVGfy8iq
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { HomeContentView } from '@dorfteich/shared';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { apiGet, fetchHealth } from '../lib/api';
|
|
|
|
import { useDocumentTitle } from '../lib/use-document-title';
|
|
/**
|
|
* Public landing page (`/`). When a Site Admin has written landing content
|
|
* (Admin → Settings → Landing page), it renders that — server-sanitized
|
|
* HTML from the same Markdown pipeline as the legal pages. Otherwise it
|
|
* shows the built-in welcome text and an instance liveness pill.
|
|
*/
|
|
export function HomePage(): React.JSX.Element {
|
|
const { t } = useTranslation();
|
|
useDocumentTitle(t('home.title'));
|
|
const home = useQuery({
|
|
queryKey: ['home-content'],
|
|
queryFn: () => apiGet<HomeContentView>('/home/content'),
|
|
});
|
|
const health = useQuery({ queryKey: ['healthz'], queryFn: fetchHealth, retry: 1 });
|
|
|
|
if (home.data?.configured) {
|
|
// Server-rendered through the sanitizing editor pipeline — safe.
|
|
return <article className="home-page" dangerouslySetInnerHTML={{ __html: home.data.html }} />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<h1>{t('home.title')}</h1>
|
|
<p>{t('home.intro')}</p>
|
|
{health.isPending && <span className="status-pill">{t('home.api.checking')}</span>}
|
|
{health.isSuccess && (
|
|
<span className="status-pill status-pill--ok">
|
|
{t('home.api.ok')} · {health.data.version}
|
|
</span>
|
|
)}
|
|
{health.isError && (
|
|
<span className="status-pill status-pill--error">{t('home.api.error')}</span>
|
|
)}
|
|
</>
|
|
);
|
|
}
|