mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 21:49:10 +00:00
♻️ Migrate dashboard assets to modern syntax (#9404)
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
bfad78d39c
commit
ebb5738c7b
@ -273,9 +273,8 @@
|
|||||||
:on-click on-delete}
|
:on-click on-delete}
|
||||||
deprecated-icon/close]]]))]]))
|
deprecated-icon/close]]]))]]))
|
||||||
|
|
||||||
(mf/defc installed-font-context-menu
|
(mf/defc installed-font-context-menu*
|
||||||
{::mf/props :obj
|
{::mf/private true}
|
||||||
::mf/private true}
|
|
||||||
[{:keys [is-open on-close on-edit on-download on-delete]}]
|
[{:keys [is-open on-close on-edit on-download on-delete]}]
|
||||||
(let [options (mf/with-memo [on-edit on-download on-delete]
|
(let [options (mf/with-memo [on-edit on-download on-delete]
|
||||||
[{:name (tr "labels.edit")
|
[{:name (tr "labels.edit")
|
||||||
@ -296,10 +295,9 @@
|
|||||||
:left -115
|
:left -115
|
||||||
:options options}]))
|
:options options}]))
|
||||||
|
|
||||||
(mf/defc installed-font
|
(mf/defc installed-font*
|
||||||
{::mf/props :obj
|
{::mf/private true
|
||||||
::mf/private true
|
::mf/wrap [mf/memo]}
|
||||||
::mf/memo true}
|
|
||||||
[{:keys [font-id variants can-edit]}]
|
[{:keys [font-id variants can-edit]}]
|
||||||
(let [font (first variants)
|
(let [font (first variants)
|
||||||
|
|
||||||
@ -445,7 +443,7 @@
|
|||||||
:on-click on-menu-open}
|
:on-click on-menu-open}
|
||||||
deprecated-icon/menu]
|
deprecated-icon/menu]
|
||||||
|
|
||||||
[:& installed-font-context-menu
|
[:> installed-font-context-menu*
|
||||||
{:on-close on-menu-close
|
{:on-close on-menu-close
|
||||||
:is-open menu-open?
|
:is-open menu-open?
|
||||||
:on-delete on-delete-font
|
:on-delete on-delete-font
|
||||||
@ -480,10 +478,10 @@
|
|||||||
(for [[font-id variants] (->> (vals fonts)
|
(for [[font-id variants] (->> (vals fonts)
|
||||||
(filter matches?)
|
(filter matches?)
|
||||||
(group-by :font-id))]
|
(group-by :font-id))]
|
||||||
[:& installed-font {:key (dm/str font-id "-installed")
|
[:> installed-font* {:key (dm/str font-id "-installed")
|
||||||
:font-id font-id
|
:font-id font-id
|
||||||
:can-edit can-edit
|
:can-edit can-edit
|
||||||
:variants variants}])]
|
:variants variants}])]
|
||||||
|
|
||||||
(nil? fonts)
|
(nil? fonts)
|
||||||
[:div {:class (stl/css :fonts-placeholder)}
|
[:div {:class (stl/css :fonts-placeholder)}
|
||||||
|
|||||||
@ -50,10 +50,8 @@
|
|||||||
:entries entries
|
:entries entries
|
||||||
:on-finish-import on-finish-import})))))))
|
:on-finish-import on-finish-import})))))))
|
||||||
|
|
||||||
(mf/defc import-form
|
(mf/defc import-form*
|
||||||
{::mf/forward-ref true
|
{::mf/forward-ref true}
|
||||||
::mf/props :obj}
|
|
||||||
|
|
||||||
[{:keys [project-id on-finish-import]} external-ref]
|
[{:keys [project-id on-finish-import]} external-ref]
|
||||||
(let [on-file-selected (use-import-file project-id on-finish-import)]
|
(let [on-file-selected (use-import-file project-id on-finish-import)]
|
||||||
[:form.import-file {:aria-hidden "true"}
|
[:form.import-file {:aria-hidden "true"}
|
||||||
|
|||||||
@ -59,9 +59,9 @@
|
|||||||
[:div {:class (stl/css :empty-project-card-subtitle)}
|
[:div {:class (stl/css :empty-project-card-subtitle)}
|
||||||
(tr "dashboard.empty-project.explore")]]
|
(tr "dashboard.empty-project.explore")]]
|
||||||
|
|
||||||
[:& udi/import-form {:ref file-input
|
[:> udi/import-form* {:ref file-input
|
||||||
:project-id project-id
|
:project-id project-id
|
||||||
:on-finish-import on-finish-import}]]))
|
:on-finish-import on-finish-import}]]))
|
||||||
|
|
||||||
(defn- make-has-other-files-or-projects-ref
|
(defn- make-has-other-files-or-projects-ref
|
||||||
"Return a ref that resolves to true or false if there are at least some
|
"Return a ref that resolves to true or false if there are at least some
|
||||||
|
|||||||
@ -137,8 +137,7 @@
|
|||||||
:top top
|
:top top
|
||||||
:left left
|
:left left
|
||||||
:options options}]
|
:options options}]
|
||||||
[:& udi/import-form {:ref file-input
|
[:> udi/import-form* {:ref file-input
|
||||||
:project-id (:id project)
|
:project-id (:id project)
|
||||||
:on-finish-import on-finish-import}]]))
|
:on-finish-import on-finish-import}]]))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -91,8 +91,7 @@
|
|||||||
[:span {:class (stl/css :title-icon)}
|
[:span {:class (stl/css :title-icon)}
|
||||||
arrow-icon]])]]))
|
arrow-icon]])]]))
|
||||||
|
|
||||||
(mf/defc card-item
|
(mf/defc card-item*
|
||||||
{::mf/wrap-props false}
|
|
||||||
[{:keys [item index is-visible collapsed on-import]}]
|
[{:keys [item index is-visible collapsed on-import]}]
|
||||||
(let [id (dm/str "card-container-" index)
|
(let [id (dm/str "card-container-" index)
|
||||||
href (u/join cf/public-uri (dm/str "images/thumbnails/template-" (:id item) ".jpg"))
|
href (u/join cf/public-uri (dm/str "images/thumbnails/template-" (:id item) ".jpg"))
|
||||||
@ -134,8 +133,7 @@
|
|||||||
(:name item))]
|
(:name item))]
|
||||||
download-icon]]]))
|
download-icon]]]))
|
||||||
|
|
||||||
(mf/defc card-item-link
|
(mf/defc card-item-link*
|
||||||
{::mf/wrap-props false}
|
|
||||||
[{:keys [total is-visible collapsed section]}]
|
[{:keys [total is-visible collapsed section]}]
|
||||||
(let [id (dm/str "card-container-" total)
|
(let [id (dm/str "card-container-" total)
|
||||||
|
|
||||||
@ -270,7 +268,7 @@
|
|||||||
:ref content-ref}
|
:ref content-ref}
|
||||||
|
|
||||||
(for [index (range (count templates))]
|
(for [index (range (count templates))]
|
||||||
[:& card-item
|
[:> card-item*
|
||||||
{:on-import on-import-template
|
{:on-import on-import-template
|
||||||
:item (nth templates index)
|
:item (nth templates index)
|
||||||
:index index
|
:index index
|
||||||
@ -278,7 +276,7 @@
|
|||||||
:is-visible true
|
:is-visible true
|
||||||
:collapsed collapsed}])
|
:collapsed collapsed}])
|
||||||
|
|
||||||
[:& card-item-link
|
[:> card-item-link*
|
||||||
{:is-visible true
|
{:is-visible true
|
||||||
:collapsed collapsed
|
:collapsed collapsed
|
||||||
:section section
|
:section section
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user