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";
import { ProjectFormFields } from "./components/ProjectFormFields";

// "Neues Projekt" form (v2). Rendered at /projects/new. The form body is the
// shared ProjectFormFields component, also used by the edit modal on
// /projects/{id}.
export function renderProjectsNew(): 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="projects.neu.title">Neues Projekt &mdash; Paliad</title>
        <link rel="stylesheet" href="/assets/global.css" />
      </head>
      <body className="has-sidebar">
        <Sidebar currentPath="/projects/new" />
        <BottomNav currentPath="/projects/new" />

        <main>
          <section className="tool-page">
            <div className="container container-narrow">
              <div className="tool-header">
                <a href="/projects" className="back-link" data-i18n="projects.detail.back">&larr; Zur&uuml;ck zur &Uuml;bersicht</a>
                <h1 data-i18n="projects.neu.heading">Neues Projekt anlegen</h1>
                <p className="tool-subtitle" data-i18n="projects.neu.subtitle">
                  Mandant, Streitsache, Patent, Verfahren oder generisches Projekt &mdash; hierarchisch einordnen.
                  Sichtbarkeit folgt dem Team (Sie werden als &bdquo;Lead&ldquo; automatisch hinzugef&uuml;gt).
                </p>
              </div>

              <form id="project-new-form" className="entity-form" autocomplete="off">
                <ProjectFormFields />

                <p className="form-msg" id="project-new-msg" />

                <div className="form-actions">
                  <a href="/projects" className="btn-cancel" data-i18n="projects.cancel">Abbrechen</a>
                  <button type="submit" className="btn-primary btn-cta-lime" data-i18n="projects.submit">Projekt anlegen</button>
                </div>
              </form>
            </div>
          </section>
        </main>

        <Footer />
        <PaliadinWidget />
        <script src="/assets/projects-new.js"></script>
      </body>
    </html>
  );
}
