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

63 lines
1.8 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.projects :as dp]
2015-12-17 16:43:58 +02:00
[uxbox.ui.util :as util]
[uxbox.ui.mixins :as mx]
2015-12-17 12:51:36 +02:00
[uxbox.ui.workspace.base :as wb]
2015-12-17 17:32:06 +02:00
[uxbox.ui.workspace.toolbar :as wt]
[uxbox.ui.workspace.leftsidebar :as wl]
[uxbox.ui.workspace.header :as wh]
2015-12-17 12:51:36 +02:00
[uxbox.ui.workspace.rules :as wr]
[uxbox.ui.workspace.workarea :as wa]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Workspace
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-12-14 20:31:21 +02:00
(defn workspace-render
[own projectid]
(html
[:div
2015-12-17 17:32:06 +02:00
(wh/header)
[:main.main-content
[:section.workspace-content
;; Toolbar
2015-12-17 17:32:06 +02:00
(wt/toolbar)
;; Project bar
2015-12-17 17:32:06 +02:00
(wl/left-sidebar)
2015-12-17 12:51:36 +02:00
;; Rules
(wr/h-rule)
(wr/v-rule)
;; Canvas
2015-12-17 15:44:05 +02:00
(wa/workarea)
2015-12-17 12:51:36 +02:00
;; (working-area conn @open-toolboxes page project shapes (rum/react ws/zoom) (rum/react ws/grid?))
;; ;; Aside
;; (when-not (empty? @open-toolboxes)
;; (aside conn open-toolboxes page shapes))
]]]))
(defn workspace-will-mount
[own]
(let [[projectid pageid] (:rum/props own)]
(rs/emit! (dp/initialize-workspace projectid pageid))
own))
2015-12-14 20:31:21 +02:00
2015-12-16 00:40:14 +02:00
(defn workspace-transfer-state
[old-state state]
(let [[projectid pageid] (:rum/props state)]
(rs/emit! (dp/initialize-workspace projectid pageid))))
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]}))
2015-12-14 20:31:21 +02:00