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/submission-building-blocks — Composer building-blocks library
// editor (t-paliad-315 Slice C). Three-pane layout: list on the left,
// edit form in the middle, version log on the right. Hydrated by
// client/admin-submission-building-blocks.ts from
// GET /api/admin/submission-building-blocks.

export function renderAdminSubmissionBuildingBlocks(): 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.building_blocks.title">Bausteine &mdash; Paliad</title>
        <link rel="stylesheet" href="/assets/global.css" />
      </head>
      <body className="has-sidebar">
        <Sidebar currentPath="/admin/submission-building-blocks" />
        <BottomNav currentPath="/admin/submission-building-blocks" />

        <main>
          <section className="tool-page">
            <div className="container">
              <div className="tool-header">
                <div>
                  <h1 data-i18n="admin.building_blocks.heading">Bausteine</h1>
                  <p className="tool-subtitle" data-i18n="admin.building_blocks.subtitle">
                    Wiederverwendbare Textbausteine f&uuml;r Composer-Abschnitte.
                  </p>
                </div>
                <div className="tool-header-actions">
                  <button
                    type="button"
                    id="admin-bb-new-btn"
                    className="btn-primary btn-cta-lime"
                    data-i18n="admin.building_blocks.action.new">
                    + Neuer Baustein
                  </button>
                </div>
              </div>

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

              <div className="admin-bb-layout">
                <aside className="admin-bb-list" id="admin-bb-list">
                  <div className="admin-bb-loading" data-i18n="admin.building_blocks.loading">L&auml;dt&hellip;</div>
                </aside>

                <section className="admin-bb-editor" id="admin-bb-editor">
                  <p className="admin-bb-empty" data-i18n="admin.building_blocks.editor.empty">
                    W&auml;hlen Sie einen Baustein aus der Liste &mdash; oder erstellen Sie einen neuen.
                  </p>
                </section>

                <aside className="admin-bb-versions" id="admin-bb-versions" />
              </div>
            </div>
          </section>
        </main>

        <Footer />
        <PaliadinWidget />
        <script src="/assets/admin-submission-building-blocks.js"></script>
      </body>
    </html>
  );
}
