mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
WIP: restructure dashboard source.
This commit is contained in:
parent
031874d442
commit
feb00d83f8
8 changed files with 65 additions and 59 deletions
|
@ -59,10 +59,10 @@
|
|||
routes ["/" [["auth/login" :auth/login]
|
||||
["auth/register" :auth/register]
|
||||
["auth/recover" :auth/recover-password]
|
||||
["dashboard" :main/dashboard]
|
||||
["elements" :main/elements]
|
||||
["icons" :main/icons]
|
||||
["colors" :main/colors]
|
||||
["dashboard/" [["projects" :dashboard/projects]
|
||||
["elements" :dashboard/elements]
|
||||
["icons" :dashboard/icons]
|
||||
["colors" :dashboard/colors]]]
|
||||
["workspace/" [[project-route :main/project]
|
||||
[page-route :main/page]]]]])
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
(defonce +router+
|
||||
(bidi.router/start-router! routes {:on-navigate on-navigate
|
||||
:default-location {:handler :main/dashboard}}))
|
||||
:default-location {:handler :auth/login}}))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Public Api
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
[uxbox.data.projects :as dp]
|
||||
[uxbox.ui.lightbox :as ui.lb]
|
||||
[uxbox.ui.users :as ui.users]
|
||||
[uxbox.ui.elements :as ui.elements]
|
||||
[uxbox.ui.workspace :as ui.w]
|
||||
[uxbox.ui.dashboard :as ui.dashboard]))
|
||||
[uxbox.ui.dashboard.projects :as ui.dashboard.projects]
|
||||
[uxbox.ui.dashboard.elements :as ui.dashboard.elements]
|
||||
[uxbox.ui.workspace :as ui.w]))
|
||||
|
||||
(def ^:static state
|
||||
(as-> (l/select-keys [:location :location-params]) $
|
||||
|
@ -24,10 +24,10 @@
|
|||
(ui.lb/lightbox)
|
||||
(case location
|
||||
:auth/login (ui.users/login)
|
||||
:main/dashboard (ui.dashboard/dashboard)
|
||||
:main/elements (ui.elements/elements)
|
||||
:main/icons (ui.elements/icons)
|
||||
:main/colors (ui.elements/colors)
|
||||
:dashboard/projects (ui.dashboard.projects/projects)
|
||||
:dashboard/elements (ui.dashboard.elements/elements)
|
||||
:dashboard/icons (ui.dashboard.elements/icons)
|
||||
:dashboard/colors (ui.dashboard.elements/colors)
|
||||
:main/page (let [projectid (:project-uuid location-params)
|
||||
pageid (:page-uuid location-params)]
|
||||
(ui.w/workspace projectid pageid))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(ns uxbox.ui.elements
|
||||
(ns uxbox.ui.dashboard.elements
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[uxbox.ui.header :as ui.header]
|
||||
[uxbox.ui.dashboard.header :as dsh.header]
|
||||
[uxbox.ui.library-bar :as ui.library-bar]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.lightbox :as lightbox]
|
||||
|
@ -16,7 +16,7 @@
|
|||
[own]
|
||||
(html
|
||||
[:main.dashboard-main
|
||||
(ui.header/header)
|
||||
(dsh.header/header)
|
||||
[:section.dashboard-content
|
||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||
[:div.dashboard-info
|
||||
|
@ -134,7 +134,7 @@
|
|||
[own]
|
||||
(html
|
||||
[:main.dashboard-main
|
||||
(ui.header/header)
|
||||
(dsh.header/header)
|
||||
[:section.dashboard-content
|
||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||
[:div.dashboard-info
|
||||
|
@ -289,7 +289,7 @@
|
|||
[own]
|
||||
(html
|
||||
[:main.dashboard-main
|
||||
(ui.header/header)
|
||||
(dsh.header/header)
|
||||
[:section.dashboard-content
|
||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||
[:div.dashboard-info
|
37
frontend/uxbox/ui/dashboard/header.cljs
Normal file
37
frontend/uxbox/ui/dashboard/header.cljs
Normal file
|
@ -0,0 +1,37 @@
|
|||
(ns uxbox.ui.dashboard.header
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[uxbox.util :as util]
|
||||
[uxbox.router :as r]
|
||||
[uxbox.ui.navigation :as nav]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.users :as ui.u]))
|
||||
|
||||
(defn header-render
|
||||
[own]
|
||||
(let [local (:rum/local own)
|
||||
projects? (= (:section local) :projects)
|
||||
elements? (= (:section local) :elements)
|
||||
icons? (= (:section local) :icons)
|
||||
colors? (= (:section local) :colores)]
|
||||
(html
|
||||
[:header#main-bar.main-bar
|
||||
[:div.main-logo
|
||||
(nav/link "/" i/logo)]
|
||||
[:ul.main-nav
|
||||
[:li {:class (when projects? "current")}
|
||||
(nav/link (r/route-for :dashboard/projects) "PROJECTS")]
|
||||
[:li {:class (when elements? "current")}
|
||||
(nav/link (r/route-for :dashboard/elements) "ELEMENTS")]
|
||||
[:li {:class (when icons? "current")}
|
||||
(nav/link (r/route-for :dashboard/icons) "ICONS")]
|
||||
[:li {:class (when colors? "current")}
|
||||
(nav/link (r/route-for :dashboard/colors) "COLORS")]]
|
||||
(ui.u/user)])))
|
||||
|
||||
(def ^:static header
|
||||
(util/component
|
||||
{:render header-render
|
||||
:name "header"
|
||||
:mixins [rum/static
|
||||
(rum/local {:section :projects})]}))
|
|
@ -1,4 +1,4 @@
|
|||
(ns uxbox.ui.dashboard
|
||||
(ns uxbox.ui.dashboard.projects
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[cats.labs.lens :as l]
|
||||
|
@ -11,7 +11,7 @@
|
|||
[uxbox.ui.icons.dashboard :as icons]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.dom :as dom]
|
||||
[uxbox.ui.header :as ui.h]
|
||||
[uxbox.ui.dashboard.header :as dsh.header]
|
||||
[uxbox.ui.lightbox :as lightbox]
|
||||
[uxbox.time :refer [ago]]))
|
||||
|
||||
|
@ -256,16 +256,16 @@
|
|||
;; Main
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn dashboard-render
|
||||
(defn projects-render
|
||||
[own]
|
||||
(html
|
||||
[:main.dashboard-main
|
||||
(ui.h/header)
|
||||
(dsh.header/header)
|
||||
[:section.dashboard-content
|
||||
(menu)
|
||||
(grid)]]))
|
||||
|
||||
(def dashboard
|
||||
(util/component {:render dashboard-render
|
||||
(def projects
|
||||
(util/component {:render projects-render
|
||||
:mixins [rum/static]
|
||||
:name "dashboard"}))
|
||||
:name "projects"}))
|
|
@ -1,31 +0,0 @@
|
|||
(ns uxbox.ui.header
|
||||
(:require [sablono.core :as html :refer-macros [html]]
|
||||
[rum.core :as rum]
|
||||
[uxbox.util :as util]
|
||||
[uxbox.router :as r]
|
||||
[uxbox.ui.navigation :as nav]
|
||||
[uxbox.ui.icons :as i]
|
||||
[uxbox.ui.users :as ui.u]))
|
||||
|
||||
(defn header-render
|
||||
[own]
|
||||
(html
|
||||
[:header#main-bar.main-bar
|
||||
[:div.main-logo
|
||||
(nav/link "/" i/logo)]
|
||||
[:ul.main-nav
|
||||
[:li.current
|
||||
[:a {:href "/#/"} "PROJECTS"]]
|
||||
[:li
|
||||
[:a {:href "/#/elements"} "ELEMENTS"]]
|
||||
[:li
|
||||
[:a {:href "/#/icons"} "ICONS"]]
|
||||
[:li
|
||||
[:a {:href "/#/colors"} "COLORS"]]]
|
||||
(ui.u/user)]))
|
||||
|
||||
(def ^:static header
|
||||
(util/component
|
||||
{:render header-render
|
||||
:name "header"
|
||||
:mixins [rum/static]}))
|
|
@ -93,7 +93,7 @@
|
|||
{:name "login"
|
||||
:value "Continue"
|
||||
:type "submit"
|
||||
:on-click #(r/go :main/dashboard)}]
|
||||
:on-click #(r/go :dashboard/projects)}]
|
||||
[:div.login-links
|
||||
[:a
|
||||
{:on-click #(r/go :auth/login)}
|
||||
|
@ -117,7 +117,7 @@
|
|||
{:name "login"
|
||||
:value "Continue"
|
||||
:type "submit"
|
||||
:on-click #(r/go :main/dashboard)}]
|
||||
:on-click #(r/go :dashboard/projects)}]
|
||||
[:div.login-links
|
||||
[:a
|
||||
{:on-click #(r/go :auth/login)}
|
||||
|
@ -156,7 +156,7 @@
|
|||
{:name "login"
|
||||
:value "Continue"
|
||||
:type "submit"
|
||||
:on-click #(r/go :main/dashboard)}]
|
||||
:on-click #(r/go :dashboard/projects)}]
|
||||
[:div.login-links
|
||||
[:a {:on-click #(r/go :auth/recover-password)} "Forgot your password?"]
|
||||
[:a {:on-click #(r/go :auth/register)} "Don't have an account?"]]])
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
(html
|
||||
[:header#workspace-bar.workspace-bar
|
||||
[:div.main-icon
|
||||
(nav/link (r/route-for :main/dashboard) i/logo-icon)]
|
||||
(nav/link (r/route-for :dashboard/projects) i/logo-icon)]
|
||||
[:div.project-tree-btn
|
||||
{:on-click (constantly nil)}
|
||||
i/project-tree
|
||||
|
|
Loading…
Reference in a new issue