0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-18 13:04:38 -05:00

🐛 Show new dashboard only in v2, and fix loading screen

This commit is contained in:
Andrés Moya 2022-09-30 12:31:18 +02:00 committed by Eva
parent 7dcd362abd
commit a6d9a65843
2 changed files with 21 additions and 16 deletions

View file

@ -355,8 +355,7 @@
(dnd/has-type? e "application/x-moz-file")) (dnd/has-type? e "application/x-moz-file"))
(dom/prevent-default e) (dom/prevent-default e)
(reset! dragging? false) (reset! dragging? false)
(import-files (.-files (.-dataTransfer e)))))) (import-files (.-files (.-dataTransfer e))))))]
]
[:section.dashboard-grid [:section.dashboard-grid
{:on-drag-enter on-drag-enter {:on-drag-enter on-drag-enter

View file

@ -9,6 +9,7 @@
[app.common.data :as d] [app.common.data :as d]
[app.common.math :as mth] [app.common.math :as mth]
[app.main.data.dashboard :as dd] [app.main.data.dashboard :as dd]
[app.main.features :as features]
[app.main.refs :as refs] [app.main.refs :as refs]
[app.main.store :as st] [app.main.store :as st]
[app.main.ui.dashboard.grid :refer [grid]] [app.main.ui.dashboard.grid :refer [grid]]
@ -20,20 +21,25 @@
(mf/defc libraries-page (mf/defc libraries-page
[{:keys [team] :as props}] [{:keys [team] :as props}]
(let [files-map (mf/deref refs/dashboard-shared-files) (let [files-map (mf/deref refs/dashboard-shared-files)
projects (mf/deref refs/dashboard-projects) projects (mf/deref refs/dashboard-projects)
default-project (->> projects vals (d/seek :is-default)) default-project (->> projects vals (d/seek :is-default))
files (->> (vals files-map) files (->> (vals files-map)
(sort-by :modified-at) (sort-by :modified-at)
(reverse)) (reverse)
(not-empty))
width (mf/use-state nil) components-v2 (features/use-feature :components-v2)
rowref (mf/use-ref)
itemsize 330 width (mf/use-state nil)
ratio (if (some? @width) (/ @width itemsize) 0) rowref (mf/use-ref)
nitems (mth/floor ratio) itemsize (if (>= @width 1030)
limit (min 10 nitems) 280
limit (max 1 limit)] 230)
ratio (if (some? @width) (/ @width itemsize) 0)
nitems (mth/floor ratio)
limit (min 10 nitems)
limit (max 1 limit)]
(mf/use-effect (mf/use-effect
(mf/deps team) (mf/deps team)
(fn [] (fn []
@ -46,7 +52,7 @@
(mf/use-effect (mf/use-effect
#(st/emit! (dd/fetch-shared-files) #(st/emit! (dd/fetch-shared-files)
(dd/clear-selected-files))) (dd/clear-selected-files)))
(mf/with-effect (mf/with-effect
(let [node (mf/ref-val rowref) (let [node (mf/ref-val rowref)
mnt? (volatile! true) mnt? (volatile! true)
@ -71,5 +77,5 @@
:project default-project :project default-project
:origin :libraries :origin :libraries
:limit limit :limit limit
:library-view? true}]]])) :library-view? components-v2}]]]))