mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 08:46:12 +02:00
♻️ Remove new-css-system from dashboard
This commit is contained in:
parent
3f151f16ce
commit
af99bf05e2
52 changed files with 1917 additions and 9738 deletions
|
@ -11,7 +11,6 @@
|
|||
[app.main.data.events :as ev]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
[app.main.ui.context :as ctx]
|
||||
[app.main.ui.dashboard.grid :refer [grid]]
|
||||
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
|
||||
[app.main.ui.dashboard.project-menu :refer [project-menu]]
|
||||
|
@ -26,8 +25,7 @@
|
|||
|
||||
(mf/defc header
|
||||
[{:keys [project create-fn] :as props}]
|
||||
(let [new-css-system (mf/use-ctx ctx/new-css-system)
|
||||
local (mf/use-state
|
||||
(let [local (mf/use-state
|
||||
{:menu-open false
|
||||
:edition false})
|
||||
|
||||
|
@ -64,137 +62,75 @@
|
|||
(dd/clear-selected-files))))]
|
||||
|
||||
|
||||
(if new-css-system
|
||||
[:header {:class (stl/css :dashboard-header)}
|
||||
(if (:is-default project)
|
||||
[:div#dashboard-drafts-title {:class (stl/css :dashboard-title)}
|
||||
[:h1 (tr "labels.drafts")]]
|
||||
[:header {:class (stl/css :dashboard-header)}
|
||||
(if (:is-default project)
|
||||
[:div#dashboard-drafts-title {:class (stl/css :dashboard-title)}
|
||||
[:h1 (tr "labels.drafts")]]
|
||||
|
||||
(if (:edition @local)
|
||||
[:& inline-edition
|
||||
{:content (:name project)
|
||||
:on-end (fn [name]
|
||||
(let [name (str/trim name)]
|
||||
(when-not (str/empty? name)
|
||||
(st/emit! (-> (dd/rename-project (assoc project :name name))
|
||||
(with-meta {::ev/origin "project"}))))
|
||||
(swap! local assoc :edition false)))}]
|
||||
[:div {:class (stl/css :dashboard-title)}
|
||||
[:h1 {:on-double-click on-edit
|
||||
:data-test "project-title"
|
||||
:id (:id project)}
|
||||
(:name project)]]))
|
||||
(if (:edition @local)
|
||||
[:& inline-edition
|
||||
{:content (:name project)
|
||||
:on-end (fn [name]
|
||||
(let [name (str/trim name)]
|
||||
(when-not (str/empty? name)
|
||||
(st/emit! (-> (dd/rename-project (assoc project :name name))
|
||||
(with-meta {::ev/origin "project"}))))
|
||||
(swap! local assoc :edition false)))}]
|
||||
[:div {:class (stl/css :dashboard-title)}
|
||||
[:h1 {:on-double-click on-edit
|
||||
:data-test "project-title"
|
||||
:id (:id project)}
|
||||
(:name project)]]))
|
||||
|
||||
[:& project-menu {:project project
|
||||
:show? (:menu-open @local)
|
||||
:left (- (:x (:menu-pos @local)) 180)
|
||||
:top (:y (:menu-pos @local))
|
||||
:on-edit on-edit
|
||||
:on-menu-close on-menu-close
|
||||
:on-import on-import}]
|
||||
[:& project-menu {:project project
|
||||
:show? (:menu-open @local)
|
||||
:left (- (:x (:menu-pos @local)) 180)
|
||||
:top (:y (:menu-pos @local))
|
||||
:on-edit on-edit
|
||||
:on-menu-close on-menu-close
|
||||
:on-import on-import}]
|
||||
|
||||
[:div {:class (stl/css :dashboard-header-actions)}
|
||||
[:a
|
||||
{:class (stl/css :btn-secondary :btn-small)
|
||||
[:div {:class (stl/css :dashboard-header-actions)}
|
||||
[:a
|
||||
{:class (stl/css :btn-secondary :btn-small)
|
||||
:tab-index "0"
|
||||
:on-click on-create-click
|
||||
:data-test "new-file"
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-create-click event)))}
|
||||
(tr "dashboard.new-file")]
|
||||
|
||||
(when-not (:is-default project)
|
||||
[:button
|
||||
{:class (stl/css-case :icon true
|
||||
:pin-icon true
|
||||
:tooltip true
|
||||
:tooltip-bottom true
|
||||
:active (:is-pinned project))
|
||||
:tab-index "0"
|
||||
:on-click on-create-click
|
||||
:data-test "new-file"
|
||||
:on-click toggle-pin
|
||||
:alt (tr "dashboard.pin-unpin")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-create-click event)))}
|
||||
(tr "dashboard.new-file")]
|
||||
(toggle-pin event)))}
|
||||
(if (:is-pinned project)
|
||||
i/pin-fill
|
||||
i/pin)])
|
||||
|
||||
(when-not (:is-default project)
|
||||
[:button
|
||||
{:class (stl/css-case :icon true
|
||||
:pin-icon true
|
||||
:tooltip true
|
||||
:tooltip-bottom true
|
||||
:active (:is-pinned project))
|
||||
:tab-index "0"
|
||||
:on-click toggle-pin
|
||||
:alt (tr "dashboard.pin-unpin")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(toggle-pin event)))}
|
||||
(if (:is-pinned project)
|
||||
i/pin-fill
|
||||
i/pin)])
|
||||
|
||||
[:div
|
||||
{:class (stl/css :icon :tooltip :tooltip-bottom-left)
|
||||
:tab-index "0"
|
||||
:on-click on-menu-click
|
||||
:alt (tr "dashboard.options")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-menu-click event)))}
|
||||
i/actions]]]
|
||||
|
||||
;; OLD
|
||||
[:header.dashboard-header
|
||||
(if (:is-default project)
|
||||
[:div.dashboard-title#dashboard-drafts-title
|
||||
[:h1 (tr "labels.drafts")]]
|
||||
|
||||
(if (:edition @local)
|
||||
[:& inline-edition {:content (:name project)
|
||||
:on-end (fn [name]
|
||||
(let [name (str/trim name)]
|
||||
(when-not (str/empty? name)
|
||||
(st/emit! (-> (dd/rename-project (assoc project :name name))
|
||||
(with-meta {::ev/origin "project"}))))
|
||||
(swap! local assoc :edition false)))}]
|
||||
[:div.dashboard-title
|
||||
[:h1 {:on-double-click on-edit
|
||||
:data-test "project-title"
|
||||
:id (:id project)}
|
||||
(:name project)]]))
|
||||
|
||||
[:& project-menu {:project project
|
||||
:show? (:menu-open @local)
|
||||
:left (- (:x (:menu-pos @local)) 180)
|
||||
:top (:y (:menu-pos @local))
|
||||
:on-edit on-edit
|
||||
:on-menu-close on-menu-close
|
||||
:on-import on-import}]
|
||||
|
||||
[:div.dashboard-header-actions
|
||||
[:a.btn-secondary.btn-small
|
||||
{:tab-index "0"
|
||||
:on-click on-create-click
|
||||
:data-test "new-file"
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-create-click event)))}
|
||||
(tr "dashboard.new-file")]
|
||||
|
||||
(when-not (:is-default project)
|
||||
[:button.icon.pin-icon.tooltip.tooltip-bottom
|
||||
{:tab-index "0"
|
||||
:class (when (:is-pinned project) "active")
|
||||
:on-click toggle-pin
|
||||
:alt (tr "dashboard.pin-unpin")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(toggle-pin event)))}
|
||||
(if (:is-pinned project)
|
||||
i/pin-fill
|
||||
i/pin)])
|
||||
|
||||
[:div.icon.tooltip.tooltip-bottom-left
|
||||
{:tab-index "0"
|
||||
:on-click on-menu-click
|
||||
:alt (tr "dashboard.options")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-menu-click event)))}
|
||||
i/actions]]])))
|
||||
[:div
|
||||
{:class (stl/css :icon :tooltip :tooltip-bottom-left)
|
||||
:tab-index "0"
|
||||
:on-click on-menu-click
|
||||
:alt (tr "dashboard.options")
|
||||
:on-key-down (fn [event]
|
||||
(when (kbd/enter? event)
|
||||
(on-menu-click event)))}
|
||||
i/actions]]]))
|
||||
|
||||
(mf/defc files-section
|
||||
[{:keys [project team] :as props}]
|
||||
(let [new-css-system (mf/use-ctx ctx/new-css-system)
|
||||
files-map (mf/deref refs/dashboard-files)
|
||||
(let [files-map (mf/deref refs/dashboard-files)
|
||||
project-id (:id project)
|
||||
|
||||
[rowref limit] (hooks/use-dynamic-grid-item-width)
|
||||
|
@ -233,28 +169,15 @@
|
|||
(st/emit! (dd/fetch-files {:project-id project-id})
|
||||
(dd/clear-selected-files)))
|
||||
|
||||
(if new-css-system
|
||||
[:*
|
||||
[:& header {:team team
|
||||
:project project
|
||||
:create-fn create-file}]
|
||||
[:section {:class (stl/css :dashboard-container :no-bg)
|
||||
:ref rowref}
|
||||
[:& grid {:project project
|
||||
:files files
|
||||
:origin :files
|
||||
:create-fn create-file
|
||||
:limit limit}]]]
|
||||
|
||||
;; OLD
|
||||
[:*
|
||||
[:& header {:team team
|
||||
:project project
|
||||
:create-fn create-file}]
|
||||
[:section.dashboard-container.no-bg {:ref rowref}
|
||||
[:& grid {:project project
|
||||
:files files
|
||||
:origin :files
|
||||
:create-fn create-file
|
||||
:limit limit}]]])))
|
||||
[:*
|
||||
[:& header {:team team
|
||||
:project project
|
||||
:create-fn create-file}]
|
||||
[:section {:class (stl/css :dashboard-container :no-bg)
|
||||
:ref rowref}
|
||||
[:& grid {:project project
|
||||
:files files
|
||||
:origin :files
|
||||
:create-fn create-file
|
||||
:limit limit}]]]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue