mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 18:48:37 -05:00
Merge pull request #4155 from penpot/niwinz-staging-onboarding-fix
🐛 Fix onboarding dialog is not loaded from profile settings
This commit is contained in:
commit
14651b1ae5
6 changed files with 46 additions and 61 deletions
|
@ -35,12 +35,6 @@
|
||||||
{:entries [app.main.ui.viewer]
|
{:entries [app.main.ui.viewer]
|
||||||
:depends-on #{:main :main-auth}}
|
:depends-on #{:main :main-auth}}
|
||||||
|
|
||||||
:main-onboarding
|
|
||||||
{:entries [app.main.ui.onboarding
|
|
||||||
app.main.ui.onboarding.questions
|
|
||||||
app.main.ui.releases]
|
|
||||||
:depends-on #{:main}}
|
|
||||||
|
|
||||||
:main-workspace
|
:main-workspace
|
||||||
{:entries [app.main.ui.workspace]
|
{:entries [app.main.ui.workspace]
|
||||||
:depends-on #{:main}}
|
:depends-on #{:main}}
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
[app.main.ui.frame-preview :as frame-preview]
|
[app.main.ui.frame-preview :as frame-preview]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.main.ui.messages :as msgs]
|
[app.main.ui.messages :as msgs]
|
||||||
|
[app.main.ui.onboarding :refer [onboarding-modal]]
|
||||||
|
[app.main.ui.onboarding.questions :refer [questions-modal]]
|
||||||
|
[app.main.ui.releases :refer [release-notes-modal]]
|
||||||
[app.main.ui.static :as static]
|
[app.main.ui.static :as static]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
|
@ -39,15 +42,6 @@
|
||||||
(def workspace-page
|
(def workspace-page
|
||||||
(mf/lazy-component app.main.ui.workspace/workspace))
|
(mf/lazy-component app.main.ui.workspace/workspace))
|
||||||
|
|
||||||
(def questions-modal
|
|
||||||
(mf/lazy-component app.main.ui.onboarding.questions/questions))
|
|
||||||
|
|
||||||
(def onboarding-modal
|
|
||||||
(mf/lazy-component app.main.ui.onboarding/onboarding-modal))
|
|
||||||
|
|
||||||
(def release-modal
|
|
||||||
(mf/lazy-component app.main.ui.releases/release-notes-modal))
|
|
||||||
|
|
||||||
(mf/defc on-main-error
|
(mf/defc on-main-error
|
||||||
[{:keys [error] :as props}]
|
[{:keys [error] :as props}]
|
||||||
(mf/with-effect
|
(mf/with-effect
|
||||||
|
@ -55,7 +49,8 @@
|
||||||
[:span "Internal application error"])
|
[:span "Internal application error"])
|
||||||
|
|
||||||
(mf/defc main-page
|
(mf/defc main-page
|
||||||
{::mf/wrap [#(mf/catch % {:fallback on-main-error})]}
|
{::mf/wrap [#(mf/catch % {:fallback on-main-error})]
|
||||||
|
::mf/props :obj}
|
||||||
[{:keys [route profile]}]
|
[{:keys [route profile]}]
|
||||||
(let [{:keys [data params]} route]
|
(let [{:keys [data params]} route]
|
||||||
[:& (mf/provider ctx/current-route) {:value route}
|
[:& (mf/provider ctx/current-route) {:value route}
|
||||||
|
@ -116,7 +111,7 @@
|
||||||
(:onboarding-viewed props)
|
(:onboarding-viewed props)
|
||||||
(not= (:release-notes-viewed props) (:main cf/version))
|
(not= (:release-notes-viewed props) (:main cf/version))
|
||||||
(not= "0.0" (:main cf/version)))
|
(not= "0.0" (:main cf/version)))
|
||||||
[:& release-modal {:version (:main cf/version)}]))
|
[:& release-notes-modal {:version (:main cf/version)}]))
|
||||||
|
|
||||||
(when profile
|
(when profile
|
||||||
[:& dashboard-page {:route route :profile profile}])]
|
[:& dashboard-page {:route route :profile profile}])]
|
||||||
|
|
|
@ -133,7 +133,6 @@
|
||||||
:data-test "onboarding-next-btn"}
|
:data-test "onboarding-next-btn"}
|
||||||
(tr "labels.continue")]]]]))
|
(tr "labels.continue")]]]]))
|
||||||
|
|
||||||
|
|
||||||
(mf/defc onboarding-modal
|
(mf/defc onboarding-modal
|
||||||
{::mf/register modal/components
|
{::mf/register modal/components
|
||||||
::mf/register-as :onboarding}
|
::mf/register-as :onboarding}
|
||||||
|
|
|
@ -206,8 +206,11 @@
|
||||||
:default ""
|
:default ""
|
||||||
:name :team-size}]]]))
|
:name :team-size}]]]))
|
||||||
|
|
||||||
(mf/defc questions
|
;; NOTE: we don't register it on registry modal because we reference
|
||||||
[{:keys []}]
|
;; this modal directly on the ui namespace.
|
||||||
|
|
||||||
|
(mf/defc questions-modal
|
||||||
|
[]
|
||||||
(let [container (mf/use-ref)
|
(let [container (mf/use-ref)
|
||||||
step (mf/use-state 1)
|
step (mf/use-state 1)
|
||||||
clean-data (mf/use-state {})
|
clean-data (mf/use-state {})
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
;;; --- RELEASE NOTES MODAL
|
;;; --- RELEASE NOTES MODAL
|
||||||
|
|
||||||
(mf/defc release-notes
|
(mf/defc release-notes
|
||||||
{::mf/wrap-props false}
|
{::mf/props :obj}
|
||||||
[{:keys [version]}]
|
[{:keys [version]}]
|
||||||
(let [slide* (mf/use-state :start)
|
(let [slide* (mf/use-state :start)
|
||||||
slide (deref slide*)
|
slide (deref slide*)
|
||||||
|
@ -90,4 +90,4 @@
|
||||||
|
|
||||||
(defmethod rc/render-release-notes "0.0"
|
(defmethod rc/render-release-notes "0.0"
|
||||||
[params]
|
[params]
|
||||||
(rc/render-release-notes (assoc params :version "1.18")))
|
(rc/render-release-notes (assoc params :version "1.19")))
|
||||||
|
|
|
@ -20,52 +20,44 @@
|
||||||
[potok.v2.core :as ptk]
|
[potok.v2.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
|
(def ^:private go-settings-profile
|
||||||
|
#(st/emit! (rt/nav :settings-profile)))
|
||||||
|
|
||||||
|
(def ^:private go-settings-feedback
|
||||||
|
#(st/emit! (rt/nav :settings-feedback)))
|
||||||
|
|
||||||
|
(def ^:private go-settings-password
|
||||||
|
#(st/emit! (rt/nav :settings-password)))
|
||||||
|
|
||||||
|
(def ^:private go-settings-options
|
||||||
|
#(st/emit! (rt/nav :settings-options)))
|
||||||
|
|
||||||
|
(def ^:private go-settings-access-tokens
|
||||||
|
#(st/emit! (rt/nav :settings-access-tokens)))
|
||||||
|
|
||||||
|
(defn- show-release-notes
|
||||||
|
[event]
|
||||||
|
(let [version (:main cf/version)]
|
||||||
|
(st/emit! (ptk/event ::ev/event {::ev/name "show-release-notes" :version version}))
|
||||||
|
|
||||||
|
(if (and (kbd/alt? event) (kbd/mod? event))
|
||||||
|
(st/emit! (modal/show {:type :onboarding}))
|
||||||
|
(st/emit! (modal/show {:type :release-notes :version version})))))
|
||||||
|
|
||||||
(mf/defc sidebar-content
|
(mf/defc sidebar-content
|
||||||
[{:keys [profile section] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [profile section]}]
|
||||||
(let [profile? (= section :settings-profile)
|
(let [profile? (= section :settings-profile)
|
||||||
password? (= section :settings-password)
|
password? (= section :settings-password)
|
||||||
options? (= section :settings-options)
|
options? (= section :settings-options)
|
||||||
feedback? (= section :settings-feedback)
|
feedback? (= section :settings-feedback)
|
||||||
access-tokens? (= section :settings-access-tokens)
|
access-tokens? (= section :settings-access-tokens)
|
||||||
|
team-id (du/get-current-team-id profile)
|
||||||
|
|
||||||
go-dashboard
|
go-dashboard
|
||||||
(mf/use-callback
|
(mf/use-fn
|
||||||
(mf/deps profile)
|
(mf/deps team-id)
|
||||||
#(st/emit! (rt/nav :dashboard-projects {:team-id (du/get-current-team-id profile)})))
|
#(st/emit! (rt/nav :dashboard-projects {:team-id team-id})))]
|
||||||
|
|
||||||
go-settings-profile
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps profile)
|
|
||||||
#(st/emit! (rt/nav :settings-profile)))
|
|
||||||
|
|
||||||
go-settings-feedback
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps profile)
|
|
||||||
#(st/emit! (rt/nav :settings-feedback)))
|
|
||||||
|
|
||||||
go-settings-password
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps profile)
|
|
||||||
#(st/emit! (rt/nav :settings-password)))
|
|
||||||
|
|
||||||
go-settings-options
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps profile)
|
|
||||||
#(st/emit! (rt/nav :settings-options)))
|
|
||||||
|
|
||||||
go-settings-access-tokens
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps profile)
|
|
||||||
#(st/emit! (rt/nav :settings-access-tokens)))
|
|
||||||
|
|
||||||
show-release-notes
|
|
||||||
(mf/use-callback
|
|
||||||
(fn [event]
|
|
||||||
(let [version (:main cf/version)]
|
|
||||||
(st/emit! (ptk/event ::ev/event {::ev/name "show-release-notes" :version version}))
|
|
||||||
(if (and (kbd/alt? event) (kbd/mod? event))
|
|
||||||
(st/emit! (modal/show {:type :onboarding}))
|
|
||||||
(st/emit! (modal/show {:type :release-notes :version version}))))))]
|
|
||||||
|
|
||||||
[:div {:class (stl/css :sidebar-content)}
|
[:div {:class (stl/css :sidebar-content)}
|
||||||
[:div {:class (stl/css :sidebar-content-section)}
|
[:div {:class (stl/css :sidebar-content-section)}
|
||||||
|
@ -73,6 +65,7 @@
|
||||||
:on-click go-dashboard}
|
:on-click go-dashboard}
|
||||||
[:span {:class (stl/css :icon)} i/arrow-down]
|
[:span {:class (stl/css :icon)} i/arrow-down]
|
||||||
[:span {:class (stl/css :text)} (tr "labels.dashboard")]]]
|
[:span {:class (stl/css :text)} (tr "labels.dashboard")]]]
|
||||||
|
|
||||||
[:hr]
|
[:hr]
|
||||||
|
|
||||||
[:div {:class (stl/css :sidebar-content-section)}
|
[:div {:class (stl/css :sidebar-content-section)}
|
||||||
|
@ -108,7 +101,8 @@
|
||||||
[:span {:class (stl/css :element-title)} (tr "labels.give-feedback")]])]]]))
|
[:span {:class (stl/css :element-title)} (tr "labels.give-feedback")]])]]]))
|
||||||
|
|
||||||
(mf/defc sidebar
|
(mf/defc sidebar
|
||||||
{::mf/wrap [mf/memo]}
|
{::mf/wrap [mf/memo]
|
||||||
|
::mf/props :obj}
|
||||||
[{:keys [profile locale section]}]
|
[{:keys [profile locale section]}]
|
||||||
[:div {:class (stl/css :dashboard-sidebar :settings)}
|
[:div {:class (stl/css :dashboard-sidebar :settings)}
|
||||||
[:& sidebar-content {:profile profile
|
[:& sidebar-content {:profile profile
|
||||||
|
|
Loading…
Add table
Reference in a new issue