import Link from "next/link"; import { BackLink } from "@/components/back-link"; import { AdminBadge } from "@/components/admin-list"; import type { ContentFieldDef } from "@/lib/content-registry"; import { readIntegrationStatus } from "@/lib/integration-status"; import { TEXT_PLACEHOLDERS } from "@/lib/text-placeholders"; import { SETTINGS_PATH, SETTINGS_TABS, parseSettingsTab, type SettingsTabId } from "@/lib/settings-tabs"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; import type { Dictionary } from "@/i18n/dictionary-type"; import type { Locale } from "@/i18n/config"; import { GroupForm, fieldsForGroup, loadCurrentValues } from "./content-form"; import { SmtpTestPanel } from "./smtp-test-panel"; /** * Alle Einstellungen des Shops an einem Ort, nach Bereichen in Reiter * gegliedert (lib/settings-tabs.ts). Die Reiter sind echte Links * (?reiter=…): direkt aufrufbar, als Lesezeichen speicherbar und ohne * JavaScript bedienbar. Frueher getrennt: /admin/inhalte und * /admin/e-mail-test — beide leiten hierher um. */ export default async function AdminEinstellungenPage(props: PageProps<"/admin/einstellungen">) { const locale = await getLocale(); const t = getDictionary(locale); const s = t.adminContentPage; const { reiter } = await props.searchParams; const activeId = parseSettingsTab(reiter); const active = SETTINGS_TABS.find((tab) => tab.id === activeId) ?? SETTINGS_TABS[0]; const tabLabels: Record = { firma: s.tabCompany, marke: s.tabBrand, startseite: s.tabHome, seiten: s.tabPages, social: s.tabSocial, recht: s.tabLegal, system: s.tabSystem, }; const groupHeadings: Record = { company: s.groupCompany, shipping: s.groupShipping, brand: s.groupBrand, home: s.groupHome, pages: s.groupPages, social: s.groupSocial, legal: s.groupLegal, }; const current = active.groups.length > 0 ? await loadCurrentValues() : null; return (

{s.title}

{active.id === "system" ? ( ) : ( <>

{s.intro}

{current ? active.groups.map((group) => ( )) : null} )}
); } /** * Uebersicht der Textbausteine (lib/text-placeholders.ts) ueber den * Formularen: welche es gibt und was sie einsetzen. Der Baustein ist per * select-all markierbar, damit er sich mit einem Klick kopieren laesst. */ function PlaceholderHint({ t, locale }: { t: Dictionary; locale: Locale }) { const s = t.adminContentPage; return ( ); } function SystemTab({ t }: { t: Dictionary }) { const s = t.adminContentPage; const integrations = readIntegrationStatus(); const warnings = { "stripe-test-mode": s.warningStripeTest, "stripe-mixed-mode": s.warningStripeMixed } as const; return (

{s.systemIntro}

{s.integrationsHeading}

{s.integrationsIntro}

    {integrations.map((integration) => (
  • {s.integrationNames[integration.key]}

    {integration.required ? s.statusRequired : s.statusOptional}

    {integration.warning ? (

    {warnings[integration.warning]}

    ) : null} {!integration.configured ? (

    {s.statusMissing(integration.missing.join(", "))}

    ) : null}
    {integration.configured ? s.statusConfigured : s.statusNotConfigured}
  • ))}

{s.emailTestHeading}

{t.adminEmailTestPage.intro}

); }