0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

Add initial dummy placeholder for view application.

This commit is contained in:
Andrey Antukh 2016-06-15 20:23:08 +03:00
parent 6efaf019ba
commit 3d72c53f02
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
4 changed files with 93 additions and 0 deletions

View file

@ -12,5 +12,6 @@
<section id="lightbox" tabindex="2"></section>
<section id="loader" tabindex="3"></section>
<script src="{{& jsfile}}"></script>
<script>uxbox.view.init()</script>
</body>
</html>

17
src/uxbox/view.cljs Normal file
View file

@ -0,0 +1,17 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.view
(:require [uxbox.view.state :as st]
#_[uxbox.view.locales :as lc]
[uxbox.view.ui :as ui]))
(defn ^:export init
[]
;; (lc/init)
(st/init)
;; (ui/init-routes)
(ui/init))

37
src/uxbox/view/state.cljs Normal file
View file

@ -0,0 +1,37 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.view.state
(:require [beicon.core :as rx]
[lentes.core :as l]
[uxbox.common.rstore :as rs]
[uxbox.common.i18n :refer (tr)]
[uxbox.util.storage :refer (storage)]))
(enable-console-print!)
(defonce state (atom {}))
(defonce loader (atom false))
(def auth-l
(-> (l/key :auth)
(l/focus-atom state)))
(defn initial-state
[]
{:route nil
:project nil
:auth (:uxbox/auth storage nil)
:shapes-by-id {}
:pages-by-id {}})
(defn init
"Initialize the state materialization."
([] (init initial-state))
([& callbacks]
(-> (reduce #(merge %1 (%2)) nil callbacks)
(rs/init)
(rx/to-atom state))))

38
src/uxbox/view/ui.cljs Normal file
View file

@ -0,0 +1,38 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.view.ui
(:require [sablono.core :refer-macros [html]]
[goog.dom :as gdom]
[rum.core :as rum]
[uxbox.common.i18n :refer (tr)]
;; [uxbox.view.ui.loader :refer (loader)]
;; [uxbox.view.ui.lightbox :refer (lightbox)]
[uxbox.common.ui.mixins :as mx]))
;; --- Main App (Component)
(defn app-render
[own]
(html [:p "hello world!!"]))
(def app
(mx/component
{:render app-render
:mixins [mx/static]
:name "app"}))
;; --- Main Entry Point
(defn init
[]
(let [app-dom (gdom/getElement "app")
lightbox-dom (gdom/getElement "lightbox")
loader-dom (gdom/getElement "loader")]
(rum/mount (app) app-dom)
#_(rum/mount (lightbox) lightbox-dom)
#_(rum/mount (loader) loader-dom)))