mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 20:38:38 +00:00
♻️ Migrate account settings to modern syntax (#9401)
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
32d974aa3e
commit
bfad78d39c
@ -11,7 +11,7 @@
|
|||||||
[app.main.data.auth :as da]
|
[app.main.data.auth :as da]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.auth.login :refer [login-page]]
|
[app.main.ui.auth.login :refer [login-page]]
|
||||||
[app.main.ui.auth.recovery :refer [recovery-page]]
|
[app.main.ui.auth.recovery :refer [recovery-page*]]
|
||||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
||||||
[app.main.ui.auth.register :refer [register-page* register-success-page* register-validate-page* terms-register*]]
|
[app.main.ui.auth.register :refer [register-page* register-success-page* register-validate-page* terms-register*]]
|
||||||
[app.main.ui.icons :as deprecated-icon]
|
[app.main.ui.icons :as deprecated-icon]
|
||||||
@ -69,7 +69,7 @@
|
|||||||
[:& recovery-request-page]
|
[:& recovery-request-page]
|
||||||
|
|
||||||
:auth-recovery
|
:auth-recovery
|
||||||
[:& recovery-page {:params params}])
|
[:> recovery-page* {:params params}])
|
||||||
|
|
||||||
(when (= section :auth-register)
|
(when (= section :auth-register)
|
||||||
[:> terms-register*])]]))
|
[:> terms-register*])]]))
|
||||||
|
|||||||
@ -44,8 +44,8 @@
|
|||||||
:password (get-in @form [:clean-data :password-2])}]
|
:password (get-in @form [:clean-data :password-2])}]
|
||||||
(st/emit! (du/recover-profile (with-meta params mdata)))))
|
(st/emit! (du/recover-profile (with-meta params mdata)))))
|
||||||
|
|
||||||
(mf/defc recovery-form
|
(mf/defc recovery-form*
|
||||||
[{:keys [params] :as props}]
|
[{:keys [params]}]
|
||||||
(let [form (fm/use-form :schema schema:recovery-form
|
(let [form (fm/use-form :schema schema:recovery-form
|
||||||
:initial params)]
|
:initial params)]
|
||||||
|
|
||||||
@ -73,13 +73,13 @@
|
|||||||
|
|
||||||
;; --- Recovery Request Page
|
;; --- Recovery Request Page
|
||||||
|
|
||||||
(mf/defc recovery-page
|
(mf/defc recovery-page*
|
||||||
[{:keys [params] :as props}]
|
[{:keys [params]}]
|
||||||
[:div {:class (stl/css :auth-form-wrapper)}
|
[:div {:class (stl/css :auth-form-wrapper)}
|
||||||
[:h1 {:class (stl/css :auth-title)} "Forgot your password?"]
|
[:h1 {:class (stl/css :auth-title)} "Forgot your password?"]
|
||||||
[:div {:class (stl/css :auth-subtitle)} "Please enter your new password"]
|
[:div {:class (stl/css :auth-subtitle)} "Please enter your new password"]
|
||||||
[:hr {:class (stl/css :separator)}]
|
[:hr {:class (stl/css :separator)}]
|
||||||
[:& recovery-form {:params params}]
|
[:> recovery-form* {:params params}]
|
||||||
|
|
||||||
[:div {:class (stl/css :links)}
|
[:div {:class (stl/css :links)}
|
||||||
[:div {:class (stl/css :go-back)}
|
[:div {:class (stl/css :go-back)}
|
||||||
|
|||||||
@ -18,15 +18,15 @@
|
|||||||
[app.main.ui.settings.feedback :refer [feedback-page*]]
|
[app.main.ui.settings.feedback :refer [feedback-page*]]
|
||||||
[app.main.ui.settings.integrations :refer [integrations-page*]]
|
[app.main.ui.settings.integrations :refer [integrations-page*]]
|
||||||
[app.main.ui.settings.notifications :refer [notifications-page*]]
|
[app.main.ui.settings.notifications :refer [notifications-page*]]
|
||||||
[app.main.ui.settings.options :refer [options-page]]
|
[app.main.ui.settings.options :refer [options-page*]]
|
||||||
[app.main.ui.settings.password :refer [password-page]]
|
[app.main.ui.settings.password :refer [password-page*]]
|
||||||
[app.main.ui.settings.profile :refer [profile-page]]
|
[app.main.ui.settings.profile :refer [profile-page*]]
|
||||||
[app.main.ui.settings.sidebar :refer [sidebar]]
|
[app.main.ui.settings.sidebar :refer [sidebar*]]
|
||||||
[app.main.ui.settings.subscription :refer [subscription-page*]]
|
[app.main.ui.settings.subscription :refer [subscription-page*]]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc header
|
(mf/defc header*
|
||||||
{::mf/wrap [mf/memo]}
|
{::mf/wrap [mf/memo]}
|
||||||
[]
|
[]
|
||||||
[:header {:class (stl/css :dashboard-header) :data-testid "dashboard-header"}
|
[:header {:class (stl/css :dashboard-header) :data-testid "dashboard-header"}
|
||||||
@ -49,15 +49,15 @@
|
|||||||
[:section {:class (stl/css :dashboard-layout-refactor :dashboard)}
|
[:section {:class (stl/css :dashboard-layout-refactor :dashboard)}
|
||||||
|
|
||||||
|
|
||||||
[:& sidebar {:profile profile
|
[:> sidebar* {:profile profile
|
||||||
:section section}]
|
:section section}]
|
||||||
|
|
||||||
[:div {:class (stl/css :dashboard-content)}
|
[:div {:class (stl/css :dashboard-content)}
|
||||||
[:& header]
|
[:> header*]
|
||||||
[:section {:class (stl/css :dashboard-container)}
|
[:section {:class (stl/css :dashboard-container)}
|
||||||
(case section
|
(case section
|
||||||
:settings-profile
|
:settings-profile
|
||||||
[:& profile-page]
|
[:> profile-page*]
|
||||||
|
|
||||||
:settings-feedback
|
:settings-feedback
|
||||||
[:> feedback-page* {:type type
|
[:> feedback-page* {:type type
|
||||||
@ -65,10 +65,10 @@
|
|||||||
:error-href error-href}]
|
:error-href error-href}]
|
||||||
|
|
||||||
:settings-password
|
:settings-password
|
||||||
[:& password-page]
|
[:> password-page*]
|
||||||
|
|
||||||
:settings-options
|
:settings-options
|
||||||
[:& options-page]
|
[:> options-page*]
|
||||||
|
|
||||||
:settings-subscription
|
:settings-subscription
|
||||||
[:> subscription-page* {:profile profile}]
|
[:> subscription-page* {:profile profile}]
|
||||||
@ -77,10 +77,9 @@
|
|||||||
[:> integrations-page*]
|
[:> integrations-page*]
|
||||||
|
|
||||||
:settings-notifications
|
:settings-notifications
|
||||||
[:& notifications-page* {:profile profile}])]]]]))
|
[:> notifications-page* {:profile profile}])]]]]))
|
||||||
|
|
||||||
(mf/defc settings-page*
|
(mf/defc settings-page*
|
||||||
{::mf/lazy-load true}
|
{::mf/lazy-load true}
|
||||||
[props]
|
[props]
|
||||||
[:> settings* props])
|
[:> settings* props])
|
||||||
|
|
||||||
|
|||||||
@ -41,8 +41,7 @@
|
|||||||
(st/emit! (du/update-profile data)
|
(st/emit! (du/update-profile data)
|
||||||
(du/persist-profile {:on-success on-success}))))
|
(du/persist-profile {:on-success on-success}))))
|
||||||
|
|
||||||
(mf/defc options-form
|
(mf/defc options-form*
|
||||||
{::mf/wrap-props false}
|
|
||||||
[]
|
[]
|
||||||
(let [profile (mf/deref refs/profile)
|
(let [profile (mf/deref refs/profile)
|
||||||
initial (mf/with-memo [profile]
|
initial (mf/with-memo [profile]
|
||||||
@ -116,7 +115,7 @@
|
|||||||
:on-change handle-render-change}]]
|
:on-change handle-render-change}]]
|
||||||
[:> text* {:typography t/body-medium :class (stl/css :feedback)} [:a {:href "#" :on-click go-settings-feedback :class (stl/css :link)} (tr "dashboard.webgl-switch.feedback") [:> icon* {:icon-id "arrow-up-right" :size "s"}]]]]))
|
[:> text* {:typography t/body-medium :class (stl/css :feedback)} [:a {:href "#" :on-click go-settings-feedback :class (stl/css :link)} (tr "dashboard.webgl-switch.feedback") [:> icon* {:icon-id "arrow-up-right" :size "s"}]]]]))
|
||||||
|
|
||||||
(mf/defc options-page
|
(mf/defc options-page*
|
||||||
[]
|
[]
|
||||||
(let [profile (mf/deref refs/profile)
|
(let [profile (mf/deref refs/profile)
|
||||||
renderer (or (-> profile :props :renderer) :svg)]
|
renderer (or (-> profile :props :renderer) :svg)]
|
||||||
@ -127,7 +126,6 @@
|
|||||||
[:*
|
[:*
|
||||||
[:div {:class (stl/css :form-container) :data-testid "settings-form"}
|
[:div {:class (stl/css :form-container) :data-testid "settings-form"}
|
||||||
[:h2 (tr "labels.settings")]
|
[:h2 (tr "labels.settings")]
|
||||||
[:& options-form {}]]
|
[:> options-form*]]
|
||||||
(when (contains? cf/flags :render-switch)
|
(when (contains? cf/flags :render-switch)
|
||||||
[:> webgl-settings* {:renderer renderer}])]]))
|
[:> webgl-settings* {:renderer renderer}])]]))
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
(fn [{:keys [password-1 password-2]}]
|
(fn [{:keys [password-1 password-2]}]
|
||||||
(= password-1 password-2))]])
|
(= password-1 password-2))]])
|
||||||
|
|
||||||
(mf/defc password-form
|
(mf/defc password-form*
|
||||||
[]
|
[]
|
||||||
(let [initial (mf/with-memo []
|
(let [initial (mf/with-memo []
|
||||||
{:password-old ""
|
{:password-old ""
|
||||||
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
;; --- Password Page
|
;; --- Password Page
|
||||||
|
|
||||||
(mf/defc password-page
|
(mf/defc password-page*
|
||||||
[]
|
[]
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
(dom/set-html-title (tr "title.settings.password")))
|
(dom/set-html-title (tr "title.settings.password")))
|
||||||
@ -107,4 +107,4 @@
|
|||||||
[:section {:class (stl/css :dashboard-settings)}
|
[:section {:class (stl/css :dashboard-settings)}
|
||||||
[:div {:class (stl/css :form-container)}
|
[:div {:class (stl/css :form-container)}
|
||||||
[:h2 (tr "dashboard.password-change")]
|
[:h2 (tr "dashboard.password-change")]
|
||||||
[:& password-form]]])
|
[:> password-form*]]])
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
;; --- Profile Form
|
;; --- Profile Form
|
||||||
|
|
||||||
(mf/defc profile-form
|
(mf/defc profile-form*
|
||||||
{::mf/private true}
|
{::mf/private true}
|
||||||
[]
|
[]
|
||||||
(let [profile (mf/deref refs/profile)
|
(let [profile (mf/deref refs/profile)
|
||||||
@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
;; --- Profile Photo Form
|
;; --- Profile Photo Form
|
||||||
|
|
||||||
(mf/defc profile-photo-form
|
(mf/defc profile-photo-form*
|
||||||
{::mf/private true}
|
{::mf/private true}
|
||||||
[]
|
[]
|
||||||
(let [input-ref (mf/use-ref nil)
|
(let [input-ref (mf/use-ref nil)
|
||||||
@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
;; --- Profile Page
|
;; --- Profile Page
|
||||||
|
|
||||||
(mf/defc profile-page
|
(mf/defc profile-page*
|
||||||
[]
|
[]
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
(dom/set-html-title (tr "title.settings.profile")))
|
(dom/set-html-title (tr "title.settings.profile")))
|
||||||
@ -146,6 +146,5 @@
|
|||||||
[:div {:class (stl/css :dashboard-settings)}
|
[:div {:class (stl/css :dashboard-settings)}
|
||||||
[:div {:class (stl/css :form-container)}
|
[:div {:class (stl/css :form-container)}
|
||||||
[:h2 (tr "labels.profile")]
|
[:h2 (tr "labels.profile")]
|
||||||
[:& profile-photo-form]
|
[:> profile-photo-form*]
|
||||||
[:& profile-form]]])
|
[:> profile-form*]]])
|
||||||
|
|
||||||
|
|||||||
@ -57,8 +57,7 @@
|
|||||||
(st/emit! (modal/show {:type :onboarding}))
|
(st/emit! (modal/show {:type :onboarding}))
|
||||||
(st/emit! (modal/show {:type :release-notes :version version})))))
|
(st/emit! (modal/show {:type :release-notes :version version})))))
|
||||||
|
|
||||||
(mf/defc sidebar-content
|
(mf/defc sidebar-content*
|
||||||
{::mf/props :obj}
|
|
||||||
[{:keys [profile section]}]
|
[{:keys [profile section]}]
|
||||||
(let [profile? (= section :settings-profile)
|
(let [profile? (= section :settings-profile)
|
||||||
password? (= section :settings-password)
|
password? (= section :settings-password)
|
||||||
@ -135,12 +134,10 @@
|
|||||||
feedback-icon
|
feedback-icon
|
||||||
[:span {:class (stl/css :element-title)} (tr "labels.contact-us")]])]]]))
|
[:span {:class (stl/css :element-title)} (tr "labels.contact-us")]])]]]))
|
||||||
|
|
||||||
(mf/defc sidebar
|
(mf/defc sidebar*
|
||||||
{::mf/wrap [mf/memo]
|
{::mf/wrap [mf/memo]}
|
||||||
::mf/props :obj}
|
|
||||||
[{:keys [profile section]}]
|
[{:keys [profile section]}]
|
||||||
[:div {:class (stl/css :dashboard-sidebar :settings)}
|
[:div {:class (stl/css :dashboard-sidebar :settings)}
|
||||||
[:& sidebar-content {:profile profile
|
[:> sidebar-content* {:profile profile
|
||||||
:section section}]
|
:section section}]
|
||||||
[:> profile-section* {:profile profile}]])
|
[:> profile-section* {:profile profile}]])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user