mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 01:11:41 +02: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]
|
routes ["/" [["auth/login" :auth/login]
|
||||||
["auth/register" :auth/register]
|
["auth/register" :auth/register]
|
||||||
["auth/recover" :auth/recover-password]
|
["auth/recover" :auth/recover-password]
|
||||||
["dashboard" :main/dashboard]
|
["dashboard/" [["projects" :dashboard/projects]
|
||||||
["elements" :main/elements]
|
["elements" :dashboard/elements]
|
||||||
["icons" :main/icons]
|
["icons" :dashboard/icons]
|
||||||
["colors" :main/colors]
|
["colors" :dashboard/colors]]]
|
||||||
["workspace/" [[project-route :main/project]
|
["workspace/" [[project-route :main/project]
|
||||||
[page-route :main/page]]]]])
|
[page-route :main/page]]]]])
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
(defonce +router+
|
(defonce +router+
|
||||||
(bidi.router/start-router! routes {:on-navigate on-navigate
|
(bidi.router/start-router! routes {:on-navigate on-navigate
|
||||||
:default-location {:handler :main/dashboard}}))
|
:default-location {:handler :auth/login}}))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Public Api
|
;; Public Api
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
[uxbox.data.projects :as dp]
|
[uxbox.data.projects :as dp]
|
||||||
[uxbox.ui.lightbox :as ui.lb]
|
[uxbox.ui.lightbox :as ui.lb]
|
||||||
[uxbox.ui.users :as ui.users]
|
[uxbox.ui.users :as ui.users]
|
||||||
[uxbox.ui.elements :as ui.elements]
|
[uxbox.ui.dashboard.projects :as ui.dashboard.projects]
|
||||||
[uxbox.ui.workspace :as ui.w]
|
[uxbox.ui.dashboard.elements :as ui.dashboard.elements]
|
||||||
[uxbox.ui.dashboard :as ui.dashboard]))
|
[uxbox.ui.workspace :as ui.w]))
|
||||||
|
|
||||||
(def ^:static state
|
(def ^:static state
|
||||||
(as-> (l/select-keys [:location :location-params]) $
|
(as-> (l/select-keys [:location :location-params]) $
|
||||||
|
@ -24,10 +24,10 @@
|
||||||
(ui.lb/lightbox)
|
(ui.lb/lightbox)
|
||||||
(case location
|
(case location
|
||||||
:auth/login (ui.users/login)
|
:auth/login (ui.users/login)
|
||||||
:main/dashboard (ui.dashboard/dashboard)
|
:dashboard/projects (ui.dashboard.projects/projects)
|
||||||
:main/elements (ui.elements/elements)
|
:dashboard/elements (ui.dashboard.elements/elements)
|
||||||
:main/icons (ui.elements/icons)
|
:dashboard/icons (ui.dashboard.elements/icons)
|
||||||
:main/colors (ui.elements/colors)
|
:dashboard/colors (ui.dashboard.elements/colors)
|
||||||
:main/page (let [projectid (:project-uuid location-params)
|
:main/page (let [projectid (:project-uuid location-params)
|
||||||
pageid (:page-uuid location-params)]
|
pageid (:page-uuid location-params)]
|
||||||
(ui.w/workspace projectid pageid))
|
(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]]
|
(:require [sablono.core :as html :refer-macros [html]]
|
||||||
[rum.core :as rum]
|
[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.library-bar :as ui.library-bar]
|
||||||
[uxbox.ui.icons :as i]
|
[uxbox.ui.icons :as i]
|
||||||
[uxbox.ui.lightbox :as lightbox]
|
[uxbox.ui.lightbox :as lightbox]
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
[own]
|
[own]
|
||||||
(html
|
(html
|
||||||
[:main.dashboard-main
|
[:main.dashboard-main
|
||||||
(ui.header/header)
|
(dsh.header/header)
|
||||||
[:section.dashboard-content
|
[:section.dashboard-content
|
||||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||||
[:div.dashboard-info
|
[:div.dashboard-info
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
[own]
|
[own]
|
||||||
(html
|
(html
|
||||||
[:main.dashboard-main
|
[:main.dashboard-main
|
||||||
(ui.header/header)
|
(dsh.header/header)
|
||||||
[:section.dashboard-content
|
[:section.dashboard-content
|
||||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||||
[:div.dashboard-info
|
[:div.dashboard-info
|
||||||
|
@ -289,7 +289,7 @@
|
||||||
[own]
|
[own]
|
||||||
(html
|
(html
|
||||||
[:main.dashboard-main
|
[:main.dashboard-main
|
||||||
(ui.header/header)
|
(dsh.header/header)
|
||||||
[:section.dashboard-content
|
[:section.dashboard-content
|
||||||
[:section#dashboard-bar.dashboard-bar.library-gap
|
[:section#dashboard-bar.dashboard-bar.library-gap
|
||||||
[:div.dashboard-info
|
[: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]]
|
(:require [sablono.core :as html :refer-macros [html]]
|
||||||
[rum.core :as rum]
|
[rum.core :as rum]
|
||||||
[cats.labs.lens :as l]
|
[cats.labs.lens :as l]
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
[uxbox.ui.icons.dashboard :as icons]
|
[uxbox.ui.icons.dashboard :as icons]
|
||||||
[uxbox.ui.icons :as i]
|
[uxbox.ui.icons :as i]
|
||||||
[uxbox.ui.dom :as dom]
|
[uxbox.ui.dom :as dom]
|
||||||
[uxbox.ui.header :as ui.h]
|
[uxbox.ui.dashboard.header :as dsh.header]
|
||||||
[uxbox.ui.lightbox :as lightbox]
|
[uxbox.ui.lightbox :as lightbox]
|
||||||
[uxbox.time :refer [ago]]))
|
[uxbox.time :refer [ago]]))
|
||||||
|
|
||||||
|
@ -256,16 +256,16 @@
|
||||||
;; Main
|
;; Main
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defn dashboard-render
|
(defn projects-render
|
||||||
[own]
|
[own]
|
||||||
(html
|
(html
|
||||||
[:main.dashboard-main
|
[:main.dashboard-main
|
||||||
(ui.h/header)
|
(dsh.header/header)
|
||||||
[:section.dashboard-content
|
[:section.dashboard-content
|
||||||
(menu)
|
(menu)
|
||||||
(grid)]]))
|
(grid)]]))
|
||||||
|
|
||||||
(def dashboard
|
(def projects
|
||||||
(util/component {:render dashboard-render
|
(util/component {:render projects-render
|
||||||
:mixins [rum/static]
|
: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"
|
{:name "login"
|
||||||
:value "Continue"
|
:value "Continue"
|
||||||
:type "submit"
|
:type "submit"
|
||||||
:on-click #(r/go :main/dashboard)}]
|
:on-click #(r/go :dashboard/projects)}]
|
||||||
[:div.login-links
|
[:div.login-links
|
||||||
[:a
|
[:a
|
||||||
{:on-click #(r/go :auth/login)}
|
{:on-click #(r/go :auth/login)}
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
{:name "login"
|
{:name "login"
|
||||||
:value "Continue"
|
:value "Continue"
|
||||||
:type "submit"
|
:type "submit"
|
||||||
:on-click #(r/go :main/dashboard)}]
|
:on-click #(r/go :dashboard/projects)}]
|
||||||
[:div.login-links
|
[:div.login-links
|
||||||
[:a
|
[:a
|
||||||
{:on-click #(r/go :auth/login)}
|
{:on-click #(r/go :auth/login)}
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
{:name "login"
|
{:name "login"
|
||||||
:value "Continue"
|
:value "Continue"
|
||||||
:type "submit"
|
:type "submit"
|
||||||
:on-click #(r/go :main/dashboard)}]
|
:on-click #(r/go :dashboard/projects)}]
|
||||||
[:div.login-links
|
[:div.login-links
|
||||||
[:a {:on-click #(r/go :auth/recover-password)} "Forgot your password?"]
|
[:a {:on-click #(r/go :auth/recover-password)} "Forgot your password?"]
|
||||||
[:a {:on-click #(r/go :auth/register)} "Don't have an account?"]]])
|
[:a {:on-click #(r/go :auth/register)} "Don't have an account?"]]])
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
(html
|
(html
|
||||||
[:header#workspace-bar.workspace-bar
|
[:header#workspace-bar.workspace-bar
|
||||||
[:div.main-icon
|
[: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
|
[:div.project-tree-btn
|
||||||
{:on-click (constantly nil)}
|
{:on-click (constantly nil)}
|
||||||
i/project-tree
|
i/project-tree
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue