From f4f79008a4774c1d44d85aa9a3e80c05c541b0be Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 27 Apr 2020 09:52:46 +0200 Subject: [PATCH] :sparkles: Remove the use of "self" as default team id. --- frontend/src/uxbox/main/data/auth.cljs | 5 +++-- frontend/src/uxbox/main/repo.cljs | 1 - frontend/src/uxbox/main/ui/dashboard.cljs | 6 +----- frontend/src/uxbox/main/ui/dashboard/sidebar.cljs | 2 +- frontend/src/uxbox/main/ui/settings.cljs | 2 +- frontend/src/uxbox/main/ui/settings/header.cljs | 8 +++++--- frontend/src/uxbox/main/ui/workspace/header.cljs | 5 +++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/frontend/src/uxbox/main/data/auth.cljs b/frontend/src/uxbox/main/data/auth.cljs index 168a6d97c..51551c22c 100644 --- a/frontend/src/uxbox/main/data/auth.cljs +++ b/frontend/src/uxbox/main/data/auth.cljs @@ -32,8 +32,9 @@ (ptk/reify ::logged-in ptk/WatchEvent (watch [this state stream] - (rx/of (du/profile-fetched data) - (rt/navigate :dashboard-team {:team-id "self"}))))) + (let [team-id (:default-team-id data)] + (rx/of (du/profile-fetched data) + (rt/navigate :dashboard-team {:team-id team-id})))))) ;; --- Login diff --git a/frontend/src/uxbox/main/repo.cljs b/frontend/src/uxbox/main/repo.cljs index da3628dde..8576c028c 100644 --- a/frontend/src/uxbox/main/repo.cljs +++ b/frontend/src/uxbox/main/repo.cljs @@ -63,7 +63,6 @@ (defn- handle-response [response] - ;; (prn "handle-response1" response) (cond (http/success? response) (rx/of (:body response)) diff --git a/frontend/src/uxbox/main/ui/dashboard.cljs b/frontend/src/uxbox/main/ui/dashboard.cljs index b27c8d1a6..ca2e4ab82 100644 --- a/frontend/src/uxbox/main/ui/dashboard.cljs +++ b/frontend/src/uxbox/main/ui/dashboard.cljs @@ -41,14 +41,10 @@ (uuid-str? team-id) (assoc :team-id (uuid team-id)) - (= "self" team-id) - (assoc :team-id (:default-team-id profile)) - (uuid-str? project-id) (assoc :project-id (uuid project-id)) - (and (= "drafts" project-id) - (= "self" team-id)) + (= "drafts" project-id) (assoc :project-id (:default-project-id profile)) (str/starts-with? (name route-name) "dashboard-library") diff --git a/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs b/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs index 4f40ec287..1d718b30e 100644 --- a/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/uxbox/main/ui/dashboard/sidebar.cljs @@ -178,4 +178,4 @@ :selected-project-id project-id :selected-section section :profile profile - :team-id "self"}]]])) + :team-id (:default-team-id profile)}]]])) diff --git a/frontend/src/uxbox/main/ui/settings.cljs b/frontend/src/uxbox/main/ui/settings.cljs index d901f9222..45827afe2 100644 --- a/frontend/src/uxbox/main/ui/settings.cljs +++ b/frontend/src/uxbox/main/ui/settings.cljs @@ -27,7 +27,7 @@ [:main.settings-main [:& messages] [:div.settings-content - [:& header {:section section}] + [:& header {:section section :profile profile}] (case section :settings-profile (mf/element profile-page) :settings-password (mf/element password-page))]])) diff --git a/frontend/src/uxbox/main/ui/settings/header.cljs b/frontend/src/uxbox/main/ui/settings/header.cljs index b58e83c62..2198142f0 100644 --- a/frontend/src/uxbox/main/ui/settings/header.cljs +++ b/frontend/src/uxbox/main/ui/settings/header.cljs @@ -15,12 +15,14 @@ [uxbox.util.router :as rt])) (mf/defc header - [{:keys [section] :as props}] + [{:keys [section profile] :as props}] (let [profile? (= section :settings-profile) password? (= section :settings-password) - locale (i18n/use-locale)] + locale (i18n/use-locale) + team-id (:default-team-id profile)] [:header - [:div.main-logo {:on-click #(st/emit! (rt/nav :dashboard-team {:team-id "self"}))} + [:div.main-logo + {:on-click #(st/emit! (rt/nav :dashboard-team {:team-id team-id}))} i/logo-icon] [:section.main-bar [:nav diff --git a/frontend/src/uxbox/main/ui/workspace/header.cljs b/frontend/src/uxbox/main/ui/workspace/header.cljs index fd7607f22..405010be9 100644 --- a/frontend/src/uxbox/main/ui/workspace/header.cljs +++ b/frontend/src/uxbox/main/ui/workspace/header.cljs @@ -121,7 +121,8 @@ (mf/defc header [{:keys [file layout project] :as props}] (let [locale (i18n/use-locale) - go-to-dashboard #(st/emit! (rt/nav :dashboard-team {:team-id "self"})) + team-id (:team-id project) + go-back #(st/emit! (rt/nav :dashboard-team {:team-id team-id})) zoom (mf/deref refs/selected-zoom) page (mf/deref refs/workspace-page) locale (i18n/use-locale) @@ -129,7 +130,7 @@ view-url (rt/resolve router :viewer {:page-id (:id page)} {:index 0})] [:header.workspace-header [:div.main-icon - [:a {:on-click go-to-dashboard} i/logo-icon]] + [:a {:on-click go-back} i/logo-icon]] [:& menu {:layout layout :project project