/apps/libre/disconnecting

import { button, buttons } from "@hedia/hexui/components/button";
import { content } from "@hedia/hexui/components/content";
import { footer } from "@hedia/hexui/components/footer";
import { header } from "@hedia/hexui/components/header";
import { modal } from "@hedia/hexui/components/modal";
import { navbar } from "@hedia/hexui/components/navbar";
import { prose } from "@hedia/hexui/components/prose";
import { screen } from "@hedia/hexui/components/screen";
import { a, div, h1, h2, img, p } from "@hedia/html/elements";

export default function disconnectScreen() {
  return screen(
    header(navbar(a({ href: "#" }, "Close"), h2("CGM"))),
    content(
      { alignment: "top" },
      prose(
        h1("Your Freestyle Libre Account"),
        p("Your Libre account is connected with Hedia Diabetes Assistant."),
        p("Data from your CGM sensor is delivered to Hedia Diabetes Assistant."),
        p("Hedia Diabetes Assistant does NOT give alarms related to high- or low glucose."),
      ),
    ),
    footer(
      button(
        { kind: "secondary-danger", "data-action": "showModal", "data-target": "#confirm-disconnect-modal" },
        "Disconnect Libre account",
      ),
    ),
    modal(
      { id: "confirm-disconnect-modal" },
      content(
        prose(
          h2("Disconnect your Freestyle Libre account?"),
          p("You will stop receiving CGM data in Hedia Diabetes Assistant."),
        ),
        buttons(
          { arrangement: "vertical" },
          button({ kind: "danger" }, "Disconnect Libre account"),
          button({ kind: "secondary", "data-action": "close" }, "Cancel"),
        ),
      ),
    ),
  );
}

export function disconnectedScreen() {
  return screen(
    header(navbar(a({ href: "#" }, "Close"), h2("CGM"))),
    content(
      div(
        { class: "align-items-center" },
        img({ src: "/apps/checkmark.gif", width: "256", height: "256" }),
        prose(h2({ align: "center" }, "Freestyle Libre account disconnected")),
      ),
    ),
  );
}