diff --git a/frontend/src/uxbox/main/data/dashboard.cljs b/frontend/src/uxbox/main/data/dashboard.cljs index 39d20ed9b..e65b8038f 100644 --- a/frontend/src/uxbox/main/data/dashboard.cljs +++ b/frontend/src/uxbox/main/data/dashboard.cljs @@ -73,6 +73,7 @@ (rx/of (fetch-files (:project-id local)) (fetch-projects (:team-id local))))))) + (defn initialize-team [team-id] (us/verify ::us/uuid team-id) @@ -86,8 +87,8 @@ ptk/WatchEvent (watch [_ state stream] (let [local (:dashboard-local state)] - ;; TODO - )))) + (rx/of (fetch-projects (:team-id local))))))) + (defn initialize-project [team-id project-id] diff --git a/frontend/src/uxbox/main/ui.cljs b/frontend/src/uxbox/main/ui.cljs index 095b5d027..ba7a3023e 100644 --- a/frontend/src/uxbox/main/ui.cljs +++ b/frontend/src/uxbox/main/ui.cljs @@ -22,18 +22,14 @@ [uxbox.main.data.projects :as dp] [uxbox.main.refs :as refs] [uxbox.main.store :as st] - [uxbox.main.ui.login :refer [login-page]] - [uxbox.main.ui.profile.register :refer [profile-register-page]] - [uxbox.main.ui.profile.recovery-request :refer [profile-recovery-request-page]] - [uxbox.main.ui.profile.recovery :refer [profile-recovery-page]] [uxbox.main.ui.dashboard :refer [dashboard]] + [uxbox.main.ui.login :refer [login-page]] + [uxbox.main.ui.profile.recovery :refer [profile-recovery-page]] + [uxbox.main.ui.profile.recovery-request :refer [profile-recovery-request-page]] + [uxbox.main.ui.profile.register :refer [profile-register-page]] [uxbox.main.ui.settings :as settings] [uxbox.main.ui.shapes] [uxbox.main.ui.workspace :as workspace] - [uxbox.util.data :refer [parse-int uuid-str?]] - [uxbox.util.components :refer [wrap-catch]] - [uxbox.util.dom :as dom] - [uxbox.util.html.history :as html-history] [uxbox.util.i18n :refer [tr]] [uxbox.util.messages :as uum] [uxbox.util.router :as rt] @@ -86,15 +82,8 @@ :else (ex/raise :type :validation :code :invalid-project-id)))) -(mf/defc app-error - [{:keys [error] :as props}] - (let [data (ex-data error)] - (case (:type data) - :not-found [:span "404"] - [:span "Internal application errror"]))) (mf/defc app - {:wrap [#(wrap-catch % app-error)]} [props] (let [route (mf/deref route-iref)] (case (get-in route [:data :name]) @@ -118,11 +107,6 @@ :dashboard-project) (mf/element dashboard #js {:route route}) - (:dashboard-icons - :dashboard-images - :dashboard-colors) - (mf/element dashboard/dashboard-assets #js {:route route}) - :workspace (let [file-id (uuid (get-in route [:params :path :file-id])) page-id (uuid (get-in route [:params :query :page-id]))] diff --git a/frontend/src/uxbox/main/ui/dashboard.cljs b/frontend/src/uxbox/main/ui/dashboard.cljs index 64eccfb7f..ae53017f8 100644 --- a/frontend/src/uxbox/main/ui/dashboard.cljs +++ b/frontend/src/uxbox/main/ui/dashboard.cljs @@ -13,14 +13,19 @@ [cuerdas.core :as str] [rumext.alpha :as mf] [uxbox.common.exceptions :as ex] + [uxbox.common.spec :as us] [uxbox.main.refs :as refs] - [uxbox.util.data :refer [uuid-str?]] [uxbox.main.ui.dashboard.header :refer [header]] [uxbox.main.ui.dashboard.sidebar :refer [sidebar]] [uxbox.main.ui.dashboard.project :refer [project-page]] [uxbox.main.ui.dashboard.team :refer [team-page]] [uxbox.main.ui.messages :refer [messages-widget]])) +(defn- ^boolean uuid-str? + [s] + (and (string? s) + (boolean (re-seq us/uuid-rx s)))) + (defn- parse-params [route profile] (let [team-id (get-in route [:params :path :team-id]) diff --git a/frontend/src/uxbox/main/ui/dashboard/icons.cljs b/frontend/src/uxbox/main/ui/dashboard/icons.cljs index b1de2dbf7..c1df4f714 100644 --- a/frontend/src/uxbox/main/ui/dashboard/icons.cljs +++ b/frontend/src/uxbox/main/ui/dashboard/icons.cljs @@ -22,7 +22,7 @@ [uxbox.main.ui.modal :as modal] [uxbox.main.ui.shapes.icon :as icon] [uxbox.util.components :refer [chunked-list]] - [uxbox.util.data :refer [read-string jscoll->vec seek]] + [uxbox.util.data :refer [read-string seek]] [uxbox.util.dom :as dom] [uxbox.util.i18n :as i18n :refer [tr t]] [uxbox.util.router :as rt] diff --git a/frontend/src/uxbox/main/ui/dashboard/project.cljs b/frontend/src/uxbox/main/ui/dashboard/project.cljs index 1ce7b235b..73245f942 100644 --- a/frontend/src/uxbox/main/ui/dashboard/project.cljs +++ b/frontend/src/uxbox/main/ui/dashboard/project.cljs @@ -27,7 +27,6 @@ [uxbox.main.ui.dashboard.header :refer [header]] [uxbox.main.ui.dashboard.sidebar :refer [sidebar]] [uxbox.main.ui.messages :refer [messages-widget]] - [uxbox.util.data :refer [uuid-str?]] [uxbox.util.dom :as dom] [uxbox.util.i18n :as i18n :refer [t tr]] [uxbox.util.router :as rt] diff --git a/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs b/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs index df11e69a1..91d8d2501 100644 --- a/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs @@ -26,7 +26,6 @@ [uxbox.main.ui.dashboard.common :as common] [uxbox.main.ui.dashboard.header :refer [header]] [uxbox.main.ui.messages :refer [messages-widget]] - [uxbox.util.data :refer [read-string parse-int uuid-str?]] [uxbox.util.dom :as dom] [uxbox.util.i18n :as i18n :refer [t tr]] [uxbox.util.router :as rt] diff --git a/frontend/src/uxbox/main/ui/dashboard/team.cljs b/frontend/src/uxbox/main/ui/dashboard/team.cljs index 0b88fa1c9..1da448aa8 100644 --- a/frontend/src/uxbox/main/ui/dashboard/team.cljs +++ b/frontend/src/uxbox/main/ui/dashboard/team.cljs @@ -9,9 +9,7 @@ ;; Copyright (c) 2015-2020 Juan de la Cruz (ns uxbox.main.ui.dashboard.team - (:refer-clojure :exclude [sort-by]) (:require - [cuerdas.core :as str] [lentes.core :as l] [rumext.alpha :as mf] [uxbox.builtins.icons :as i] diff --git a/frontend/src/uxbox/util/data.cljs b/frontend/src/uxbox/util/data.cljs index 778fb4ea2..a26fa54c4 100644 --- a/frontend/src/uxbox/util/data.cljs +++ b/frontend/src/uxbox/util/data.cljs @@ -111,26 +111,6 @@ not-found)) not-found coll))) -;; --- String utils - -(def +uuid-re+ - #"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$") - -(defn uuid-str? - [v] - (and (string? v) - (re-seq +uuid-re+ v))) - -;; --- Interop - -(defn jscoll->vec - "Convert array like js object into vector." - [v] - (-> (clj->js []) - (.-slice) - (.call v) - (js->clj))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Numbers Parsing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;