import { h } from "./jsx";
import { Sidebar } from "./components/Sidebar";
import { PaliadinWidget } from "./components/PaliadinWidget";
import { BottomNav } from "./components/BottomNav";
import { Footer } from "./components/Footer";
import { PWAHead } from "./components/PWAHead";

// /admin/email-templates — list of canonical templates with per-language
// edit links. Cards are populated client-side from
// GET /api/admin/email-templates so the static SPA shell stays language-
// neutral and the "Standard" / "Zuletzt geändert" status reflects current
// DB state, not build time.

export function renderAdminEmailTemplates(): string {
  return "<!DOCTYPE html>" + (
    <html lang="de">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
        <meta name="theme-color" content="#BFF355" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="default" />
        <PWAHead />
        <title data-i18n="admin.email_templates.title">Email-Templates &mdash; Paliad</title>
        <link rel="stylesheet" href="/assets/global.css" />
      </head>
      <body className="has-sidebar">
        <Sidebar currentPath="/admin/email-templates" />
        <BottomNav currentPath="/admin/email-templates" />

        <main>
          <section className="tool-page">
            <div className="container">
              <div className="tool-header">
                <div>
                  <h1 data-i18n="admin.email_templates.heading">Email-Templates</h1>
                  <p className="tool-subtitle" data-i18n="admin.email_templates.subtitle">
                    Vorlagen f&uuml;r Einladungen, Erinnerungen und das Layout-Wrapper anpassen.
                  </p>
                </div>
              </div>

              <div id="admin-et-feedback" className="form-msg" style="display:none" />

              <div className="grid grid-2" id="admin-et-list">
                <div className="card admin-et-loading" data-i18n="admin.email_templates.loading">Lade&hellip;</div>
              </div>
            </div>
          </section>
        </main>

        <Footer />
        <PaliadinWidget />
        <script src="/assets/admin-email-templates.js"></script>
      </body>
    </html>
  );
}
