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";

export function renderDeadlinesCalendar(): 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="deadlines.kalender.title">Fristenkalender &mdash; Paliad</title>
        <link rel="stylesheet" href="/assets/global.css" />
      </head>
      <body className="has-sidebar">
        <Sidebar currentPath="/events?type=deadline" />
        <BottomNav currentPath="/events?type=deadline" />

        <main>
          <section className="tool-page">
            <div className="container">
              <div className="tool-header">
                <div className="entity-header-row">
                  <div>
                    <h1 data-i18n="deadlines.kalender.heading">Fristenkalender</h1>
                    <p className="tool-subtitle" data-i18n="deadlines.kalender.subtitle">
                      Monats&uuml;bersicht aller Fristen Ihrer Akten.
                    </p>
                  </div>
                  <div className="fristen-header-actions">
                    <a href="/events?type=deadline" className="btn-secondary" data-i18n="deadlines.kalender.list">Listenansicht</a>
                    <a href="/deadlines/new" className="btn-primary btn-cta-lime" data-i18n="deadlines.list.new">Neue Frist</a>
                  </div>
                </div>
              </div>

              <div className="frist-calendar-controls">
                <button type="button" id="cal-prev" className="btn-secondary btn-small" aria-label="Vorheriger Monat">&larr;</button>
                <h2 id="cal-month-label" className="frist-cal-month-label" />
                <button type="button" id="cal-next" className="btn-secondary btn-small" aria-label="N&auml;chster Monat">&rarr;</button>
                <button type="button" id="cal-today" className="btn-secondary btn-small" data-i18n="deadlines.kalender.today">Heute</button>
              </div>

              <div className="frist-calendar" id="deadline-calendar">
                <div className="frist-cal-weekday" data-i18n="cal.day.mon">Mo</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.tue">Di</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.wed">Mi</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.thu">Do</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.fri">Fr</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.sat">Sa</div>
                <div className="frist-cal-weekday" data-i18n="cal.day.sun">So</div>
                <div id="deadline-cal-grid" className="frist-cal-grid" />
              </div>

              <p className="entity-events-empty" id="deadline-cal-empty" style="display:none" data-i18n="deadlines.kalender.empty">
                Keine Fristen im ausgew&auml;hlten Zeitraum.
              </p>

              <div className="modal-overlay" id="cal-popup" style="display:none">
                <div className="modal-card">
                  <div className="modal-header">
                    <h2 id="cal-popup-date" />
                    <button className="modal-close" id="cal-popup-close" type="button">&times;</button>
                  </div>
                  <ul className="frist-cal-popup-list" id="cal-popup-list" />
                </div>
              </div>
            </div>
          </section>
        </main>

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