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]]
|
2015-12-17 05:51:36 -05:00
|
|
|
[goog.dom :as gdom]
|
2015-12-14 03:48:50 -05:00
|
|
|
[rum.core :as rum]
|
2015-06-18 12:35:50 -05:00
|
|
|
[cats.labs.lens :as l]
|
|
|
|
[uxbox.state :as s]
|
2015-12-14 13:31:21 -05:00
|
|
|
[uxbox.rstore :as rs]
|
|
|
|
[uxbox.data.projects :as dp]
|
2015-12-14 03:48:50 -05:00
|
|
|
[uxbox.ui.lightbox :as ui.lb]
|
2015-12-20 07:41:38 -05:00
|
|
|
[uxbox.ui.users :as users]
|
|
|
|
[uxbox.ui.dashboard :as dashboard]
|
|
|
|
[uxbox.ui.workspace :refer (workspace)]
|
2015-12-17 09:43:58 -05:00
|
|
|
[uxbox.ui.util :as util]
|
2016-01-02 11:03:16 -05:00
|
|
|
[uxbox.ui.mixins :as mx]
|
|
|
|
[uxbox.ui.shapes]))
|
2015-12-17 09:43:58 -05:00
|
|
|
|
2015-12-14 07:17:18 -05:00
|
|
|
(def ^: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-17 05:51:36 -05:00
|
|
|
(case location
|
2015-12-20 07:41:38 -05:00
|
|
|
:auth/login (users/login)
|
|
|
|
:dashboard/projects (dashboard/projects-page)
|
|
|
|
:dashboard/elements (dashboard/elements-page)
|
|
|
|
:dashboard/icons (dashboard/icons-page)
|
|
|
|
:dashboard/colors (dashboard/colors-page)
|
2015-12-17 05:51:36 -05:00
|
|
|
:workspace/page (let [projectid (:project-uuid location-params)
|
|
|
|
pageid (:page-uuid location-params)]
|
2015-12-20 07:41:38 -05:00
|
|
|
(workspace projectid pageid))
|
2015-12-17 05:51:36 -05:00
|
|
|
nil
|
|
|
|
)))
|
2015-06-18 12:35:50 -05:00
|
|
|
|
|
|
|
(def app
|
|
|
|
(util/component {:render app-render
|
|
|
|
:mixins [rum/reactive]
|
|
|
|
:name "app"}))
|
2015-12-17 05:51:36 -05:00
|
|
|
(defn init
|
|
|
|
[]
|
|
|
|
(let [app-dom (gdom/getElement "app")
|
|
|
|
lb-dom (gdom/getElement "lightbox")]
|
2015-12-17 10:01:52 -05:00
|
|
|
(rum/mount (app) app-dom)
|
|
|
|
(rum/mount (ui.lb/lightbox) lb-dom)))
|