             [cljs-time.core :as time]
             [datascript :as d]
             [frontend.async :refer [put!]]
+            [frontend.auth :as auth]
             [frontend.components.common :as common]
             [frontend.datascript :as ds]
             [frontend.state :as state]

     (time/after? time (time/minus start-of-day (time/days 14))) "last week"
     :else "a while ago")))


(defn doc-viewer [app owner]
  (reify
    om/IRender
    (render [_]

           [:a.menu-close {:on-click #(cast! :overlay-closed)
                           :role "button"}
            (common/icon :times)]]
          [:div.menu-prompt-body {:class (when (nil? touched-docs)
                                           "loading")}
           (if (seq docs)
             (om/build docs-list docs))]])))))

;; Four states
;; 1. Logged out
;; 2. Loading
;; 3. No docs
;; 4. Docs!

(defn doc-viewer [app owner]
  (reify
    om/IRender
    (render [_]
      (if (:cust app)
        (om/build doc-viewer* app) ;; states 2, 3, 4
        (om/build signup-prompt app) ;; state 1
        ))))
