2015-06-18 12:35:50 -05:00
|
|
|
(ns uxbox.ui
|
2015-12-14 03:48:50 -05:00
|
|
|
(:require [sablono.core :as html :refer-macros [html]]
|
|
|
|
[rum.core :as rum]
|
2015-06-18 12:35:50 -05:00
|
|
|
[cats.labs.lens :as l]
|
|
|
|
[uxbox.state :as s]
|
|
|
|
[uxbox.util :as util]
|
2015-12-14 03:48:50 -05:00
|
|
|
[uxbox.ui.lightbox :as ui.lb]
|
2015-12-13 06:04:34 -05:00
|
|
|
[uxbox.ui.users :as ui.u]
|
|
|
|
[uxbox.ui.dashboard :as ui.d]))
|
2015-06-18 12:35:50 -05:00
|
|
|
|
|
|
|
(def ^:private ^:static state
|
2015-12-13 15:57:14 -05:00
|
|
|
(as-> (l/select-keys [:location :location-params]) $
|
2015-06-18 12:35:50 -05:00
|
|
|
(l/focus-atom $ s/state)))
|
|
|
|
|
|
|
|
(defn app-render
|
|
|
|
[own]
|
2015-12-13 15:57:14 -05:00
|
|
|
(let [{:keys [location location-params] :as state} (rum/react state)]
|
2015-12-14 02:50:19 -05:00
|
|
|
(html
|
|
|
|
[:section
|
2015-12-14 03:48:50 -05:00
|
|
|
(ui.lb/lightbox)
|
2015-12-14 02:50:19 -05:00
|
|
|
(case location
|
|
|
|
:auth/login (ui.u/login)
|
|
|
|
;; :auth/register (u/register)
|
|
|
|
;; :auth/recover (u/recover-password)
|
|
|
|
:main/dashboard (ui.d/dashboard)
|
|
|
|
;; :main/project (w/workspace conn location-params)
|
|
|
|
;; :main/page (w/workspace conn location-params))))
|
|
|
|
nil
|
2015-12-14 03:48:50 -05:00
|
|
|
)])))
|
2015-06-18 12:35:50 -05:00
|
|
|
|
|
|
|
(def app
|
|
|
|
(util/component {:render app-render
|
|
|
|
:mixins [rum/reactive]
|
|
|
|
:name "app"}))
|
|
|
|
(defn mount!
|
|
|
|
[el]
|
|
|
|
(rum/mount (app) el))
|