mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 13:18:28 +02:00
♻️ Refactor dashboard bootstrap
This commit is contained in:
parent
b31afcfb47
commit
b17d7c0289
45 changed files with 1684 additions and 1500 deletions
|
@ -7,9 +7,7 @@
|
|||
(ns app.main.ui.dashboard.libraries
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.features :as features]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.dashboard.grid :refer [grid]]
|
||||
|
@ -18,35 +16,32 @@
|
|||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc libraries-page
|
||||
(mf/defc libraries-page*
|
||||
{::mf/props :obj}
|
||||
[{:keys [team] :as props}]
|
||||
(let [files-map (mf/deref refs/dashboard-shared-files)
|
||||
projects (mf/deref refs/dashboard-projects)
|
||||
can-edit (-> team :permissions :can-edit)
|
||||
[{:keys [team default-project]}]
|
||||
(let [files
|
||||
(mf/deref refs/shared-files)
|
||||
|
||||
default-project (->> projects vals (d/seek :is-default))
|
||||
files
|
||||
(mf/with-memo [files]
|
||||
(->> (vals files)
|
||||
(sort-by :modified-at)
|
||||
(reverse)))
|
||||
|
||||
files (mf/with-memo [files-map]
|
||||
(if (nil? files-map)
|
||||
nil
|
||||
(->> (vals files-map)
|
||||
(sort-by :modified-at)
|
||||
(reverse))))
|
||||
can-edit
|
||||
(-> team :permissions :can-edit)
|
||||
|
||||
components-v2 (features/use-feature "components/v2")
|
||||
|
||||
[rowref limit] (hooks/use-dynamic-grid-item-width 350)]
|
||||
[rowref limit]
|
||||
(hooks/use-dynamic-grid-item-width 350)]
|
||||
|
||||
(mf/with-effect [team]
|
||||
(when team
|
||||
(let [tname (if (:is-default team)
|
||||
(tr "dashboard.your-penpot")
|
||||
(:name team))]
|
||||
(dom/set-html-title (tr "title.dashboard.shared-libraries" tname)))))
|
||||
(let [tname (if (:is-default team)
|
||||
(tr "dashboard.your-penpot")
|
||||
(:name team))]
|
||||
(dom/set-html-title (tr "title.dashboard.shared-libraries" tname))))
|
||||
|
||||
(mf/with-effect []
|
||||
(st/emit! (dd/fetch-shared-files (:id team))
|
||||
(mf/with-effect [team]
|
||||
(st/emit! (dd/fetch-shared-files)
|
||||
(dd/clear-selected-files)))
|
||||
|
||||
[:*
|
||||
|
@ -58,6 +53,5 @@
|
|||
:project default-project
|
||||
:origin :libraries
|
||||
:limit limit
|
||||
:can-edit can-edit
|
||||
:library-view? components-v2}]]]))
|
||||
:can-edit can-edit}]]]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue