text: // Generated by BUCKLESCRIPT VERSION 5.0.4, PLEASE EDIT WITH CARE
  'use strict';
  
  var Block = require("bs-platform/lib/js/block.js");
  var Curry = require("bs-platform/lib/js/curry.js");
  var React = require("react");
  var Rebase = require("@glennsl/rebase/lib/js/src/Rebase.bs.js");
  var Caml_option = require("bs-platform/lib/js/caml_option.js");
  var Util$AgdaMode = require("../../Util.bs.js");
  
  function Dashboard(Props) {
    var header = Props.header;
    var hidden = Props.hidden;
    var isPending = Props.isPending;
    var mountAt = Props.mountAt;
    var settingsView = Props.settingsView;
    var onMountAtChange = Props.onMountAtChange;
    var onSettingsViewToggle = Props.onSettingsViewToggle;
    var settingsButtonRef = React.useRef(null);
    var dockingButtonRef = React.useRef(null);
    React.useEffect((function () {
            return Rebase.$$Option[/* flatMap */5]((function (settingsButton) {
                          var disposable = atom.tooltips.add(atom.views.getView(settingsButton), {
                                title: "settings",
                                delay: {
                                  show: 100,
                                  hide: 1000
                                }
                              });
                          return (function (param) {
                                    disposable.dispose();
                                    return /* () */0;
                                  });
                        }), Caml_option.nullable_to_opt(settingsButtonRef.current));
          }), /* array */[]);
    React.useEffect((function () {
            return Rebase.$$Option[/* flatMap */5]((function (dockingButton) {
                          var disposable = atom.tooltips.add(atom.views.getView(dockingButton), {
                                title: "toggle panel docking position",
                                delay: {
                                  show: 300,
                                  hide: 1000
                                },
                                keyBindingCommand: "agda-mode:toggle-docking"
                              });
                          return (function (param) {
                                    disposable.dispose();
                                    return /* () */0;
                                  });
                        }), Caml_option.nullable_to_opt(dockingButtonRef.current));
          }), /* array */[]);
    var settingsOn = Rebase.$$Option[/* isSome */13](settingsView);
    var classList = Curry._1(Util$AgdaMode.ClassName[/* serialize */2], Util$AgdaMode.ClassName[/* addWhen */1]("hidden", hidden, /* :: */Block.simpleVariant("::", [
                "agda-header",
                /* [] */0
              ])));
    var match = header[/* style */1];
    var headerClassList;
    switch (match) {
      case 0 : 
          headerClassList = "";
          break;
      case 1 : 
          headerClassList = "text-error";
          break;
      case 2 : 
          headerClassList = "text-info";
          break;
      case 3 : 
          headerClassList = "text-success";
          break;
      case 4 : 
          headerClassList = "text-warning";
          break;
      
    }
    var spinnerClassList = Curry._1(Util$AgdaMode.ClassName[/* serialize */2], Util$AgdaMode.ClassName[/* addWhen */1]("pending", isPending, /* :: */Block.simpleVariant("::", [
                "loading",
                /* :: */Block.simpleVariant("::", [
                    "loading-spinner-tiny",
                    /* :: */Block.simpleVariant("::", [
                        "inline-block",
                        /* [] */0
                      ])
                  ])
              ])));
    var settingsViewClassList = Curry._1(Util$AgdaMode.ClassName[/* serialize */2], Util$AgdaMode.ClassName[/* addWhen */1]("activated", settingsOn, /* :: */Block.simpleVariant("::", [
                "no-btn",
                /* [] */0
              ])));
    var tmp;
    tmp = mountAt.tag ? true : false;
    var toggleMountingPosition = Curry._1(Util$AgdaMode.ClassName[/* serialize */2], Util$AgdaMode.ClassName[/* addWhen */1]("activated", tmp, /* :: */Block.simpleVariant("::", [
                "no-btn",
                /* [] */0
              ])));
    return React.createElement("div", {
                className: classList
              }, React.createElement("h1", {
                    className: headerClassList
                  }, header[/* text */0]), React.createElement("ul", {
                    className: "agda-dashboard"
                  }, React.createElement("li", undefined, React.createElement("span", {
                            className: spinnerClassList,
                            id: "spinner"
                          })), React.createElement("li", undefined, React.createElement("button", {
                            ref: settingsButtonRef,
                            className: settingsViewClassList,
                            onClick: (function (param) {
                                return Curry._1(onSettingsViewToggle, !settingsOn);
                              })
                          }, React.createElement("span", {
                                className: "icon icon-settings"
                              }))), React.createElement("li", undefined, React.createElement("button", {
                            ref: dockingButtonRef,
                            className: toggleMountingPosition,
                            onClick: (function (param) {
                                if (mountAt.tag) {
                                  return Curry._1(onMountAtChange, /* ToBottom */0);
                                } else {
                                  return Curry._1(onMountAtChange, /* ToPane */1);
                                }
                              })
                          }, React.createElement("span", {
                                className: "icon icon-versions"
                              })))));
  }
  
  var make = Dashboard;
  
  exports.make = make;
  /* react Not a pure module */
  