 
 ;; (add-watch form-state :logger #(-> %4 clj->js js/console.log))
 
-(defn sign-in-sign-up-base-component-wrapper [element]
+(defn welcome-component-wrapper [element]
   "Renders element passed in inside a .jumbotron"
   [:div.container.jumbotron
    [:div.row

  (let [profile (atom {:username ""
                       :email    ""
                       :password ""})]
    [:div.form-group {:style {:padding "1em"}}
     [:p.text-center.bg-primary "Sign in"]
     [:label "email:"]
     [email-input-field profile]
     [:label "password:"]
     [passsword-input-field profile]
     [:br]
     [:div.checkbox
      [:label
       [:input {:type "checkbox"}] "remember me?"]]

     [:br]
     [:button.btn.btn-default {:type     "button"
                               :on-click (fn [e]
                                           (sign-in @profile)
                                           (.preventDefault e))
                               } "sign-in"]

     [:button.btn.btn-default.pull-right {:type     "button"
                                          :on-click #(secretary/dispatch! "/sign-up")
                                          } "sign-up"]
     [:br]
     [:p.text-center
      [:button.btn.btn-sm {:type     "button"
                           :on-click #(secretary/dispatch! "/reset-password")}
       "forgot password?"]]]))


(defn sign-up-component []
  (let [profile (atom {:username ""
                       :email    ""
                       :password ""})]
    [:div.form-group {:style {:padding "1em"}}

     [:p.text-center.bg-primary "Create Account"]

     [:label "username:"]
     [username-input-field profile]
     [:label "email:"]
     [email-input-field profile]
     [:label "password:"]
     [passsword-input-field profile]

     [:br]

     [:button.btn.btn-default {:type     "button"
                               :on-click #(secretary/dispatch! "/")
                               } "sign-in"]

     [:button.btn.btn-default.pull-right {:type     "button"
                                          :on-click (fn [e]
                                                      ;; (swap! form-state assoc :signing-up true)
                                                      (sign-up @profile)
                                                      (.preventDefault e))
                                          } "sign-up"]]))
(defn reset-password-component []
  (let [profile (atom {:username ""
                       :email    ""
                       :password ""})]
    [:div.form-group {:style {:padding "1em"}}
     [:p.text-center.bg-primary "Reset Your Password"]
     [:label "email:"]
     [email-input-field profile]

     [:br]

     [:p.text-center
      [:button.btn.btn-default {:type     "button"
                                :on-click (fn [e]
                                            (reset-password @profile)
                                            (.preventDefault e))
                                } "reset"]]]))

(defn reset-email-component-wrapper []
  (sign-in-sign-up-base-component-wrapper [reset-password-component]))

(defn show-loading-component []
  [:p.ball-loader.text-center {:style {:left   180
                                       :bottom 69}}])
(defn sign-in-component-wrapper []
  (let []
    [sign-in-sign-up-base-component-wrapper [sing-in-component]]))

(defn sign-up-component-wrapper []
  (let []
    [sign-in-sign-up-base-component-wrapper [sign-up-component]]))

(defn email-verified-component []
  [:div [:h1 "email verified"]])
;; -------------------------
;; Routes


  [:div [(session/get :current-page)]])

(secretary/defroute "/" []
                    (session/put! :current-page #'sing-in-component))


(secretary/defroute "/sign-up" []
                    (session/put! :current-page #'sign-up-component))

(secretary/defroute "/email-verified" []
                    (session/put! :current-page #'email-verified-component))

(secretary/defroute "/reset-password" []
                    (session/put! :current-page #'reset-password-component))

(secretary/defroute "/new-password" []
                    (session/put! :current-page #'new-password-component))

;; -------------------------
;; History
