♻️ Migrate account settings to modern syntax (#9401)

Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
sxxtony 2026-06-10 11:52:14 +03:00 committed by GitHub
parent 32d974aa3e
commit bfad78d39c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 35 additions and 42 deletions

View File

@ -11,7 +11,7 @@
[app.main.data.auth :as da]
[app.main.store :as st]
[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.register :refer [register-page* register-success-page* register-validate-page* terms-register*]]
[app.main.ui.icons :as deprecated-icon]
@ -69,7 +69,7 @@
[:& recovery-request-page]
:auth-recovery
[:& recovery-page {:params params}])
[:> recovery-page* {:params params}])
(when (= section :auth-register)
[:> terms-register*])]]))

View File

@ -44,8 +44,8 @@
:password (get-in @form [:clean-data :password-2])}]
(st/emit! (du/recover-profile (with-meta params mdata)))))
(mf/defc recovery-form
[{:keys [params] :as props}]
(mf/defc recovery-form*
[{:keys [params]}]
(let [form (fm/use-form :schema schema:recovery-form
:initial params)]
@ -73,13 +73,13 @@
;; --- Recovery Request Page
(mf/defc recovery-page
[{:keys [params] :as props}]
(mf/defc recovery-page*
[{:keys [params]}]
[:div {:class (stl/css :auth-form-wrapper)}
[:h1 {:class (stl/css :auth-title)} "Forgot your password?"]
[:div {:class (stl/css :auth-subtitle)} "Please enter your new password"]
[:hr {:class (stl/css :separator)}]
[:& recovery-form {:params params}]
[:> recovery-form* {:params params}]
[:div {:class (stl/css :links)}
[:div {:class (stl/css :go-back)}

View File

@ -18,15 +18,15 @@
[app.main.ui.settings.feedback :refer [feedback-page*]]
[app.main.ui.settings.integrations :refer [integrations-page*]]
[app.main.ui.settings.notifications :refer [notifications-page*]]
[app.main.ui.settings.options :refer [options-page]]
[app.main.ui.settings.password :refer [password-page]]
[app.main.ui.settings.profile :refer [profile-page]]
[app.main.ui.settings.sidebar :refer [sidebar]]
[app.main.ui.settings.options :refer [options-page*]]
[app.main.ui.settings.password :refer [password-page*]]
[app.main.ui.settings.profile :refer [profile-page*]]
[app.main.ui.settings.sidebar :refer [sidebar*]]
[app.main.ui.settings.subscription :refer [subscription-page*]]
[app.util.i18n :as i18n :refer [tr]]
[rumext.v2 :as mf]))
(mf/defc header
(mf/defc header*
{::mf/wrap [mf/memo]}
[]
[:header {:class (stl/css :dashboard-header) :data-testid "dashboard-header"}
@ -49,15 +49,15 @@
[:section {:class (stl/css :dashboard-layout-refactor :dashboard)}
[:& sidebar {:profile profile
:section section}]
[:> sidebar* {:profile profile
:section section}]
[:div {:class (stl/css :dashboard-content)}
[:& header]
[:> header*]
[:section {:class (stl/css :dashboard-container)}
(case section
:settings-profile
[:& profile-page]
[:> profile-page*]
:settings-feedback
[:> feedback-page* {:type type
@ -65,10 +65,10 @@
:error-href error-href}]
:settings-password
[:& password-page]
[:> password-page*]
:settings-options
[:& options-page]
[:> options-page*]
:settings-subscription
[:> subscription-page* {:profile profile}]
@ -77,10 +77,9 @@
[:> integrations-page*]
:settings-notifications
[:& notifications-page* {:profile profile}])]]]]))
[:> notifications-page* {:profile profile}])]]]]))
(mf/defc settings-page*
{::mf/lazy-load true}
[props]
[:> settings* props])

View File

@ -41,8 +41,7 @@
(st/emit! (du/update-profile data)
(du/persist-profile {:on-success on-success}))))
(mf/defc options-form
{::mf/wrap-props false}
(mf/defc options-form*
[]
(let [profile (mf/deref refs/profile)
initial (mf/with-memo [profile]
@ -116,7 +115,7 @@
: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"}]]]]))
(mf/defc options-page
(mf/defc options-page*
[]
(let [profile (mf/deref refs/profile)
renderer (or (-> profile :props :renderer) :svg)]
@ -127,7 +126,6 @@
[:*
[:div {:class (stl/css :form-container) :data-testid "settings-form"}
[:h2 (tr "labels.settings")]
[:& options-form {}]]
[:> options-form*]]
(when (contains? cf/flags :render-switch)
[:> webgl-settings* {:renderer renderer}])]]))

View File

@ -59,7 +59,7 @@
(fn [{:keys [password-1 password-2]}]
(= password-1 password-2))]])
(mf/defc password-form
(mf/defc password-form*
[]
(let [initial (mf/with-memo []
{:password-old ""
@ -99,7 +99,7 @@
;; --- Password Page
(mf/defc password-page
(mf/defc password-page*
[]
(mf/with-effect []
(dom/set-html-title (tr "title.settings.password")))
@ -107,4 +107,4 @@
[:section {:class (stl/css :dashboard-settings)}
[:div {:class (stl/css :form-container)}
[:h2 (tr "dashboard.password-change")]
[:& password-form]]])
[:> password-form*]]])

View File

@ -37,7 +37,7 @@
;; --- Profile Form
(mf/defc profile-form
(mf/defc profile-form*
{::mf/private true}
[]
(let [profile (mf/deref refs/profile)
@ -87,7 +87,7 @@
;; --- Profile Photo Form
(mf/defc profile-photo-form
(mf/defc profile-photo-form*
{::mf/private true}
[]
(let [input-ref (mf/use-ref nil)
@ -138,7 +138,7 @@
;; --- Profile Page
(mf/defc profile-page
(mf/defc profile-page*
[]
(mf/with-effect []
(dom/set-html-title (tr "title.settings.profile")))
@ -146,6 +146,5 @@
[:div {:class (stl/css :dashboard-settings)}
[:div {:class (stl/css :form-container)}
[:h2 (tr "labels.profile")]
[:& profile-photo-form]
[:& profile-form]]])
[:> profile-photo-form*]
[:> profile-form*]]])

View File

@ -57,8 +57,7 @@
(st/emit! (modal/show {:type :onboarding}))
(st/emit! (modal/show {:type :release-notes :version version})))))
(mf/defc sidebar-content
{::mf/props :obj}
(mf/defc sidebar-content*
[{:keys [profile section]}]
(let [profile? (= section :settings-profile)
password? (= section :settings-password)
@ -135,12 +134,10 @@
feedback-icon
[:span {:class (stl/css :element-title)} (tr "labels.contact-us")]])]]]))
(mf/defc sidebar
{::mf/wrap [mf/memo]
::mf/props :obj}
(mf/defc sidebar*
{::mf/wrap [mf/memo]}
[{:keys [profile section]}]
[:div {:class (stl/css :dashboard-sidebar :settings)}
[:& sidebar-content {:profile profile
:section section}]
[:> sidebar-content* {:profile profile
:section section}]
[:> profile-section* {:profile profile}]])