mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 12:46:14 +02:00
✨ Adapt code to rumext changes.
This commit is contained in:
parent
247be4a8a4
commit
176ca590e1
8 changed files with 15 additions and 22 deletions
|
@ -57,9 +57,8 @@
|
||||||
" the projects will be periodicaly wiped."]])
|
" the projects will be periodicaly wiped."]])
|
||||||
|
|
||||||
(mf/defc login-form
|
(mf/defc login-form
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[]
|
[]
|
||||||
(let [data (mf/react form-data)
|
(let [data (mf/deref form-data)
|
||||||
valid? (fm/valid? ::login-form data)]
|
valid? (fm/valid? ::login-form data)]
|
||||||
[:form {:on-submit #(on-submit % data)}
|
[:form {:on-submit #(on-submit % data)}
|
||||||
[:div.login-content
|
[:div.login-content
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
|
|
||||||
;; --- Profile Form
|
;; --- Profile Form
|
||||||
(mf/def profile-form
|
(mf/def profile-form
|
||||||
:mixins [mf/memo mf/reactive mf/sync-render (fm/clear-mixin st/store :profile)]
|
:mixins [mf/memo mf/reactive (fm/clear-mixin st/store :profile)]
|
||||||
:render
|
:render
|
||||||
(fn [own props]
|
(fn [own props]
|
||||||
(let [data (merge {:language @i18n/locale}
|
(let [data (merge {:language @i18n/locale}
|
||||||
|
@ -113,7 +113,6 @@
|
||||||
;; --- Profile Photo Form
|
;; --- Profile Photo Form
|
||||||
|
|
||||||
(mf/defc profile-photo-form
|
(mf/defc profile-photo-form
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[]
|
[]
|
||||||
(letfn [(on-change [event]
|
(letfn [(on-change [event]
|
||||||
(let [target (dom/get-target event)
|
(let [target (dom/get-target event)
|
||||||
|
@ -122,7 +121,7 @@
|
||||||
(first))]
|
(first))]
|
||||||
(st/emit! (udu/update-photo file))
|
(st/emit! (udu/update-photo file))
|
||||||
(dom/clean-value! target)))]
|
(dom/clean-value! target)))]
|
||||||
(let [{:keys [photo]} (mf/react profile-ref)
|
(let [{:keys [photo]} (mf/deref profile-ref)
|
||||||
photo (if (or (str/empty? photo) (nil? photo))
|
photo (if (or (str/empty? photo) (nil? photo))
|
||||||
"images/avatar.jpg"
|
"images/avatar.jpg"
|
||||||
photo)]
|
photo)]
|
||||||
|
|
|
@ -49,10 +49,9 @@
|
||||||
(l/derive st/state)))
|
(l/derive st/state)))
|
||||||
|
|
||||||
(mf/defc user
|
(mf/defc user
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[_]
|
[_]
|
||||||
(let [open (mf/use-state false)
|
(let [open (mf/use-state false)
|
||||||
profile (mf/react profile-ref)
|
profile (mf/deref profile-ref)
|
||||||
photo (if (str/empty? (:photo profile ""))
|
photo (if (str/empty? (:photo profile ""))
|
||||||
"/images/avatar.jpg"
|
"/images/avatar.jpg"
|
||||||
(:photo profile))]
|
(:photo profile))]
|
||||||
|
|
|
@ -83,8 +83,8 @@
|
||||||
:no-tool-bar-left (not left-sidebar?)
|
:no-tool-bar-left (not left-sidebar?)
|
||||||
:scrolling (:viewport-positionig workspace))]
|
:scrolling (:viewport-positionig workspace))]
|
||||||
|
|
||||||
(mf/use-effect {:deps #js [canvas page]
|
(mf/use-effect #(subscribe canvas page)
|
||||||
:fn #(subscribe canvas page)})
|
#js [(:id page)])
|
||||||
[:*
|
[:*
|
||||||
(messages-widget)
|
(messages-widget)
|
||||||
[:& header {:page page
|
[:& header {:page page
|
||||||
|
|
|
@ -29,9 +29,8 @@
|
||||||
;; --- Zoom Widget
|
;; --- Zoom Widget
|
||||||
|
|
||||||
(mf/defc zoom-widget
|
(mf/defc zoom-widget
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[props]
|
[props]
|
||||||
(let [zoom (mf/react refs/selected-zoom)
|
(let [zoom (mf/deref refs/selected-zoom)
|
||||||
increase #(st/emit! (dw/increase-zoom))
|
increase #(st/emit! (dw/increase-zoom))
|
||||||
decrease #(st/emit! (dw/decrease-zoom))]
|
decrease #(st/emit! (dw/decrease-zoom))]
|
||||||
[:ul.options-view
|
[:ul.options-view
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
[uxbox.builtins.icons :as i]
|
[uxbox.builtins.icons :as i]
|
||||||
[uxbox.main.data.icons :as udi]
|
[uxbox.main.data.icons :as udi]
|
||||||
[uxbox.main.data.workspace :as dw]
|
[uxbox.main.data.workspace :as dw]
|
||||||
[uxbox.main.lenses :as ul]
|
|
||||||
[uxbox.main.store :as st]
|
[uxbox.main.store :as st]
|
||||||
[uxbox.main.ui.dashboard.icons :as icons]
|
[uxbox.main.ui.dashboard.icons :as icons]
|
||||||
[uxbox.main.ui.shapes.icon :as icon]
|
[uxbox.main.ui.shapes.icon :as icon]
|
||||||
|
@ -22,12 +21,12 @@
|
||||||
|
|
||||||
;; --- Refs
|
;; --- Refs
|
||||||
|
|
||||||
(def ^:private drawing-shape-ref
|
;; (def ^:private drawing-shape-ref
|
||||||
"A focused vision of the drawing property
|
;; "A focused vision of the drawing property
|
||||||
of the workspace status. This avoids
|
;; of the workspace status. This avoids
|
||||||
rerender the whole toolbox on each workspace
|
;; rerender the whole toolbox on each workspace
|
||||||
change."
|
;; change."
|
||||||
(l/derive ul/selected-drawing st/state))
|
;; (l/derive ul/selected-drawing st/state))
|
||||||
|
|
||||||
(def ^:private icons-toolbox-ref
|
(def ^:private icons-toolbox-ref
|
||||||
(-> (l/in [:workspace :icons-toolbox])
|
(-> (l/in [:workspace :icons-toolbox])
|
||||||
|
|
|
@ -56,9 +56,8 @@
|
||||||
(l/derive st/state)))
|
(l/derive st/state)))
|
||||||
|
|
||||||
(mf/defc app
|
(mf/defc app
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[]
|
[]
|
||||||
(let [route (mf/react route-ref)]
|
(let [route (mf/deref route-ref)]
|
||||||
(case (get-in route [:data :name])
|
(case (get-in route [:data :name])
|
||||||
:view/notfound (notfound-page)
|
:view/notfound (notfound-page)
|
||||||
:view/viewer (let [{:keys [token id]} (get-in route [:params :path])]
|
:view/viewer (let [{:keys [token id]} (get-in route [:params :path])]
|
||||||
|
|
|
@ -34,9 +34,8 @@
|
||||||
;; --- Component
|
;; --- Component
|
||||||
|
|
||||||
(mf/defc viewer-page
|
(mf/defc viewer-page
|
||||||
{:wrap [mf/wrap-reactive]}
|
|
||||||
[{:keys [token id]}]
|
[{:keys [token id]}]
|
||||||
(let [{:keys [project pages flags]} (mf/react state-ref)]
|
(let [{:keys [project pages flags]} (mf/deref state-ref)]
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
{:fn #(st/emit! (dv/initialize token))})
|
{:fn #(st/emit! (dv/initialize token))})
|
||||||
(when (seq pages)
|
(when (seq pages)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue