0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00
penpot/frontend/uxbox/ui/workspace.cljs

67 lines
1.9 KiB
Text
Raw Normal View History

2015-12-14 20:31:21 +02:00
(ns uxbox.ui.workspace
(:require [sablono.core :as html :refer-macros [html]]
[rum.core :as rum]
[uxbox.router :as r]
[uxbox.rstore :as rs]
[uxbox.state :as s]
[uxbox.data.workspace :as dw]
2015-12-17 16:43:58 +02:00
[uxbox.ui.util :as util]
[uxbox.ui.mixins :as mx]
[uxbox.ui.workspace.shortcuts :as wshortcuts]
2015-12-17 12:51:36 +02:00
[uxbox.ui.workspace.base :as wb]
2015-12-18 17:42:42 +02:00
[uxbox.ui.workspace.lateralmenu :refer (lateralmenu)]
[uxbox.ui.workspace.pagesmngr :refer (pagesmngr)]
[uxbox.ui.workspace.header :refer (header)]
[uxbox.ui.workspace.rules :refer (h-rule v-rule)]
[uxbox.ui.workspace.workarea :refer (workarea aside)]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Workspace
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-12-14 20:31:21 +02:00
2015-12-22 20:25:38 +02:00
(defn- workspace-render
2015-12-14 20:31:21 +02:00
[own projectid]
(let [workspace (rum/react wb/workspace-state)]
(html
[:div
(header)
[:main.main-content
[:section.workspace-content
;; Lateral Menu (left side)
(lateralmenu)
;; Pages management lightbox
(pagesmngr)
;; Rules
(h-rule)
(v-rule)
;; Canvas
(workarea)]
;; Aside
(when-not (empty? (:toolboxes workspace))
(aside))]])))
2015-12-22 20:25:38 +02:00
(defn- workspace-will-mount
[own]
(let [[projectid pageid] (:rum/props own)]
(rs/emit! (dw/initialize projectid pageid))
own))
2015-12-14 20:31:21 +02:00
2015-12-22 20:25:38 +02:00
(defn- workspace-transfer-state
2015-12-16 00:40:14 +02:00
[old-state state]
(let [[projectid pageid] (:rum/props state)]
(rs/emit! (dw/initialize projectid pageid))
state))
2015-12-16 00:40:14 +02:00
2015-12-14 20:31:21 +02:00
(def ^:static workspace
(util/component
{:render workspace-render
:will-mount workspace-will-mount
2015-12-16 00:40:14 +02:00
:transfer-state workspace-transfer-state
2015-12-14 20:31:21 +02:00
:name "workspace"
:mixins [mx/static rum/reactive wshortcuts/mixin]}))
2015-12-14 20:31:21 +02:00