mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 22:06:11 +02:00
🎉 Remember last team visited
This commit is contained in:
parent
013fc2fc9c
commit
ec217d8201
8 changed files with 30 additions and 14 deletions
|
@ -26,6 +26,7 @@
|
||||||
- Import SVG will create Penpot's shapes [Taiga #1006](https://tree.taiga.io/project/penpot/us/1066)
|
- Import SVG will create Penpot's shapes [Taiga #1006](https://tree.taiga.io/project/penpot/us/1066)
|
||||||
- Improve french translations [#731](https://github.com/penpot/penpot/pull/731)
|
- Improve french translations [#731](https://github.com/penpot/penpot/pull/731)
|
||||||
- Reimplement workspace presence (remove database state).
|
- Reimplement workspace presence (remove database state).
|
||||||
|
- Remember last visited team when you re-enter the application [Taiga #1376](https://tree.taiga.io/project/penpot/us/1376)
|
||||||
- Replace Slate-Editor with DraftJS [Taiga #1346](https://tree.taiga.io/project/penpot/us/1346)
|
- Replace Slate-Editor with DraftJS [Taiga #1346](https://tree.taiga.io/project/penpot/us/1346)
|
||||||
- Set proper page title [Taiga #1377](https://tree.taiga.io/project/penpot/us/1377)
|
- Set proper page title [Taiga #1377](https://tree.taiga.io/project/penpot/us/1377)
|
||||||
- Several enhancements in shape selection [Taiga #1195](https://tree.taiga.io/project/penpot/us/1195)
|
- Several enhancements in shape selection [Taiga #1195](https://tree.taiga.io/project/penpot/us/1195)
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
height: 55px;
|
height: 55px;
|
||||||
width: 170px;
|
width: 170px;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cfg]
|
[app.config :as cfg]
|
||||||
[app.main.data.auth :refer [logout]]
|
[app.main.data.auth :as da]
|
||||||
[app.main.data.messages :as dm]
|
[app.main.data.messages :as dm]
|
||||||
[app.main.data.users :as udu]
|
[app.main.data.users :as udu]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
(->> (rp/query! :profile)
|
(->> (rp/query! :profile)
|
||||||
(rx/subs (fn [profile]
|
(rx/subs (fn [profile]
|
||||||
(if (not= uuid/zero profile)
|
(if (not= uuid/zero profile)
|
||||||
(st/emit! (rt/nav :dashboard-projects {:team-id (:default-team-id profile)}))
|
(st/emit! (rt/nav :dashboard-projects {:team-id (da/current-team-id profile)}))
|
||||||
(st/emit! (rt/nav :auth-login))))))
|
(st/emit! (rt/nav :auth-login))))))
|
||||||
|
|
||||||
(and (not authed?) (nil? match))
|
(and (not authed?) (nil? match))
|
||||||
|
|
|
@ -26,6 +26,17 @@
|
||||||
(s/def ::password string?)
|
(s/def ::password string?)
|
||||||
(s/def ::fullname string?)
|
(s/def ::fullname string?)
|
||||||
|
|
||||||
|
;; --- Current team for a profile
|
||||||
|
|
||||||
|
(defn current-team-id
|
||||||
|
[profile]
|
||||||
|
(let [team-id (:current-team-id storage)]
|
||||||
|
(or team-id (:default-team-id profile))))
|
||||||
|
|
||||||
|
(defn set-current-team!
|
||||||
|
[team-id]
|
||||||
|
(swap! storage assoc :current-team-id team-id))
|
||||||
|
|
||||||
;; --- Logged In
|
;; --- Logged In
|
||||||
|
|
||||||
(defn logged-in
|
(defn logged-in
|
||||||
|
@ -33,7 +44,7 @@
|
||||||
(ptk/reify ::logged-in
|
(ptk/reify ::logged-in
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [this state stream]
|
(watch [this state stream]
|
||||||
(let [team-id (:default-team-id profile)]
|
(let [team-id (current-team-id profile)]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (du/profile-fetched profile)
|
(rx/of (du/profile-fetched profile)
|
||||||
(rt/nav' :dashboard-projects {:team-id team-id}))
|
(rt/nav' :dashboard-projects {:team-id team-id}))
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.util.i18n :as i18n :refer [t]]
|
[app.util.i18n :as i18n :refer [t]]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[app.util.storage :refer [storage]]
|
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
[okulary.core :as l]
|
[okulary.core :as l]
|
||||||
[rumext.alpha :as mf]))
|
[rumext.alpha :as mf]))
|
||||||
|
|
|
@ -211,8 +211,11 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(st/emitf (modal/show :team-form {})))
|
(st/emitf (modal/show :team-form {})))
|
||||||
|
|
||||||
go-projects
|
team-selected
|
||||||
(mf/use-callback #(st/emit! (rt/nav :dashboard-projects {:team-id %})))]
|
(mf/use-callback
|
||||||
|
(fn [team-id]
|
||||||
|
(da/set-current-team! team-id)
|
||||||
|
(st/emit! (rt/nav :dashboard-projects {:team-id team-id}))))]
|
||||||
|
|
||||||
(mf/use-layout-effect
|
(mf/use-layout-effect
|
||||||
(mf/deps (:id team))
|
(mf/deps (:id team))
|
||||||
|
@ -223,13 +226,13 @@
|
||||||
[:ul.dropdown.teams-dropdown
|
[:ul.dropdown.teams-dropdown
|
||||||
[:li.title (t locale "dashboard.switch-team")]
|
[:li.title (t locale "dashboard.switch-team")]
|
||||||
[:hr]
|
[:hr]
|
||||||
[:li.team-name {:on-click (partial go-projects (:default-team-id profile))}
|
[:li.team-name {:on-click (partial team-selected (:default-team-id profile))}
|
||||||
[:span.team-icon i/logo-icon]
|
[:span.team-icon i/logo-icon]
|
||||||
[:span.team-text (t locale "dashboard.your-penpot")]]
|
[:span.team-text (t locale "dashboard.your-penpot")]]
|
||||||
|
|
||||||
(for [team (remove :is-default @teams)]
|
(for [team (remove :is-default @teams)]
|
||||||
[:* {:key (:id team)}
|
[:* {:key (:id team)}
|
||||||
[:li.team-name {:on-click (partial go-projects (:id team))}
|
[:li.team-name {:on-click (partial team-selected (:id team))}
|
||||||
[:span.team-icon
|
[:span.team-icon
|
||||||
[:img {:src (cfg/resolve-team-photo-url team)}]]
|
[:img {:src (cfg/resolve-team-photo-url team)}]]
|
||||||
[:span.team-text {:title (:name team)} (:name team)]]])
|
[:span.team-text {:title (:name team)} (:name team)]]])
|
||||||
|
@ -305,9 +308,6 @@
|
||||||
(mf/deps team)
|
(mf/deps team)
|
||||||
(st/emitf (rt/nav :dashboard-team-settings {:team-id (:id team)})))
|
(st/emitf (rt/nav :dashboard-team-settings {:team-id (:id team)})))
|
||||||
|
|
||||||
go-projects
|
|
||||||
(mf/use-callback #(st/emit! (rt/nav :dashboard-projects {:team-id %})))
|
|
||||||
|
|
||||||
on-create-clicked
|
on-create-clicked
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(st/emitf (modal/show :team-form {})))
|
(st/emitf (modal/show :team-form {})))
|
||||||
|
@ -320,7 +320,9 @@
|
||||||
on-leaved-success
|
on-leaved-success
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps team profile)
|
(mf/deps team profile)
|
||||||
(st/emitf (rt/nav :dashboard-projects {:team-id (:default-team-id profile)})))
|
(let [team-id (:default-team-id profile)]
|
||||||
|
(da/set-current-team! team-id)
|
||||||
|
(st/emit! (rt/nav :dashboard-projects {:team-id team-id}))))
|
||||||
|
|
||||||
leave-fn
|
leave-fn
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
(ns app.main.ui.settings.sidebar
|
(ns app.main.ui.settings.sidebar
|
||||||
(:require
|
(:require
|
||||||
[app.config :as cfg]
|
[app.config :as cfg]
|
||||||
|
[app.main.data.auth :as da]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.dashboard.sidebar :refer [profile-section]]
|
[app.main.ui.dashboard.sidebar :refer [profile-section]]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
go-dashboard
|
go-dashboard
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps profile)
|
(mf/deps profile)
|
||||||
(st/emitf (rt/nav :dashboard-projects {:team-id (:default-team-id profile)})))
|
(st/emitf (rt/nav :dashboard-projects {:team-id (da/current-team-id profile)})))
|
||||||
|
|
||||||
go-settings-profile
|
go-settings-profile
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
(defn- go-to-dashboard
|
(defn- go-to-dashboard
|
||||||
[profile]
|
[profile]
|
||||||
(let [team-id (:default-team-id profile)]
|
(let [team-id (da/current-team-id profile)]
|
||||||
(st/emit! (rt/nav :dashboard-projects {:team-id team-id}))))
|
(st/emit! (rt/nav :dashboard-projects {:team-id team-id}))))
|
||||||
|
|
||||||
(mf/defc not-found
|
(mf/defc not-found
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue