 (secretary/defroute "/search" []
   (session/put! :current-page #'search))
 
-(secretary/defroute "/about" []
-  (session/put! :current-page #'about-page))
 
 ;; -------------------------
 ;; History

                                 (when-not (empty? newval) 
                                   (go
                                     (reset! search-results (<! (<search-user newval)))))))}]]]
       ;;Results
       [SearchResults @search-results ]])))


(defn json->userdetails [json]
  {:id (:UserID json)
   :photo (str "https://genome.klick.com" (:PhotoPath json))
   :name (:Name json)
   :title (:Title json)
   :dept (:BusinessUnitName json)})

(defn save-to-atom [atm id]
  (go
    (as-> (<! (<get-user id)) $
      (first $) 
      (json->userdetails $)
      (reset! user $))))

(save-to-atom user 5702)

(defn card [] (Card))
(defn search [] (Search))


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

;; -------------------------
;; Routes
(secretary/set-config! :prefix "#")

(secretary/defroute "/" []


(enable-console-print!)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Stores

(defonce user (atom {}))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Actions


(defn- extract-content [] (map #(-> % :body :Entries)))

(defn <get-user 
  [userid]
  (http/jsonp "https://genome.klick.com:443/api/User.json"
              {:query-params {"UserID" userid}
               :channel (chan 1 (extract-content))}))

(defn <search-user 
  [keyword]
  (http/jsonp "https://genome.klick.com:443/api/User.json"
              {:query-params {:ForAutocompleter true
                              :Enabled true
                              :IsNotAPerson false
                              :Keyword keyword}
               :channel (chan 1 (extract-content))}))


(defn json->userdetails [json]
  {:id (:UserID json)
   :photo (str "https://genome.klick.com" (:PhotoPath json))
   :name (:Name json)
   :title (:Title json)
   :dept (:BusinessUnitName json)})

(defn save-to-atom [atm id]
  (go
    (as-> (<! (<get-user id)) $
      (first $) 
      (json->userdetails $)
      (reset! user $))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Views



(defn Card [user]
  (let [{:keys [id photo name title dept]} @user]
    [:div.card {:style {:width "400px" :height "600px"}}
     [:div.card-image.waves-effect.waves-block.waves-light
