b5ad13cf43
Corrected after user feedback: Stammkapital/Grundkapital is only required on business correspondence if voluntarily disclosed in the first place (§35a Abs. 1 S. 2 GmbHG) — not an unconditional Pflichtangabe. shareCapital's Impressum rendering stays (shown only if an admin voluntarily filled it in), but it's dropped from the email/invoice footer. generalPartners is removed entirely — the legal basis was genuinely unclear on research (§125a HGB's Geschäftsbriefe-naming duty only applies to the narrow case where no partner is a natural person; whether §5 DDG's Impressum-specific "vertretungsberechtigte Person" requirement independently mandates it for the general OHG/KG case wasn't resolved with confidence) — reverted rather than shipped on an uncertain legal basis. Also fixes stale "§5 TMG" citations to "§5 DDG" (TMG was replaced 14 May 2024).
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { draftMode } from "next/headers";
|
|
import { notFound } from "next/navigation";
|
|
import { getCompanySettings, type CompanySettings } from "../lib/payload";
|
|
import { LiveCompanySettingsPreviewClient } from "./components/LiveCompanySettingsPreviewClient";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Firmendaten-Vorschau",
|
|
robots: { index: false, follow: false },
|
|
};
|
|
|
|
const FALLBACK: CompanySettings = {
|
|
sellerName: "",
|
|
legalForm: "sole-proprietorship",
|
|
registerCourt: null,
|
|
registerNumber: null,
|
|
managingDirector: null,
|
|
shareCapital: null,
|
|
sellerStreet: "",
|
|
sellerZip: "",
|
|
sellerCity: "",
|
|
sellerCountry: "",
|
|
sellerEmail: "",
|
|
vatId: "",
|
|
taxRatePercent: 19,
|
|
iban: null,
|
|
bic: null,
|
|
};
|
|
|
|
// Entered exclusively via CompanySettings.ts's admin.livePreview.url (a
|
|
// Payload-admin-only iframe target, see buildPreviewUrl()/api/preview) —
|
|
// gated on Draft Mode actually being enabled, unlike email-templates'
|
|
// preview: this data includes a real bank IBAN/address once filled in,
|
|
// not just marketing email copy, so this page must not render for an
|
|
// unauthenticated visitor who happens to find the URL. Unlike
|
|
// email-templates there's no draft/published distinction in the data
|
|
// itself (company-settings has no content-versioning concept, it's just
|
|
// the current row) — the initial fetch is the same live data
|
|
// getCompanySettings() always returns, useLivePreview() takes over from
|
|
// there as the admin edits fields.
|
|
export default async function CompanySettingsPreviewPage() {
|
|
const draft = await draftMode();
|
|
if (!draft.isEnabled) notFound();
|
|
const initialSettings = (await getCompanySettings()) ?? FALLBACK;
|
|
return <LiveCompanySettingsPreviewClient initialSettings={initialSettings} />;
|
|
}
|