From 10db35eab488fa74de1738e7f00f10b97e5918f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 9 Aug 2021 09:34:01 +0200 Subject: [PATCH] :sparkles: Hide options for drafts project in dashboard --- CHANGES.md | 3 ++ frontend/src/app/main/ui/dashboard/files.cljs | 33 ++++++++++--------- .../app/main/ui/dashboard/project_menu.cljs | 14 +++++--- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 706ba30aa..4f30db240 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,9 @@ - Use space + mouse drag to pan, instead of only space [Taiga #1800](https://tree.taiga.io/project/penpot/us/1800). ### :bug: Bugs fixed + +- Prevent deleting or moving the drafts project [Taiga #1935](https://tree.taiga.io/project/penpot/issue/1935). + ### :arrow_up: Deps updates ### :boom: Breaking changes ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/ui/dashboard/files.cljs b/frontend/src/app/main/ui/dashboard/files.cljs index b982d8ced..4b44e09ef 100644 --- a/frontend/src/app/main/ui/dashboard/files.cljs +++ b/frontend/src/app/main/ui/dashboard/files.cljs @@ -66,26 +66,29 @@ (swap! local assoc :edition false))}] [:div.dashboard-title [:h1 {:on-double-click on-edit} - (: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}]])) + (: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 {:on-click on-create-clicked} (tr "dashboard.new-file")] - [:div.icon.pin-icon.tooltip.tooltip-bottom - {:class (when (:is-pinned project) "active") - :on-click toggle-pin :alt (tr "dashboard.pin-unpin")} - (if (:is-pinned project) - i/pin-fill - i/pin)] + (when-not (:is-default project) + [:div.icon.pin-icon.tooltip.tooltip-bottom + {:class (when (:is-pinned project) "active") + :on-click toggle-pin :alt (tr "dashboard.pin-unpin")} + (if (:is-pinned project) + i/pin-fill + i/pin)]) - [:div.icon.tooltip.tooltip-bottom + [:div.icon.tooltip.tooltip-bottom-left {:on-click on-menu-click :alt (tr "dashboard.options")} i/actions]]])) diff --git a/frontend/src/app/main/ui/dashboard/project_menu.cljs b/frontend/src/app/main/ui/dashboard/project_menu.cljs index f6923cc78..b3654ff59 100644 --- a/frontend/src/app/main/ui/dashboard/project_menu.cljs +++ b/frontend/src/app/main/ui/dashboard/project_menu.cljs @@ -99,14 +99,18 @@ :left left :options [(when-not (:is-default project) [(tr "labels.rename") on-edit]) - [(tr "dashboard.duplicate") on-duplicate] - [(tr "dashboard.pin-unpin") toggle-pin] - (when (seq teams) + (when-not (:is-default project) + [(tr "dashboard.duplicate") on-duplicate]) + (when-not (:is-default project) + [(tr "dashboard.pin-unpin") toggle-pin]) + (when (and (seq teams) (not (:is-default project))) [(tr "dashboard.move-to") nil (for [team teams] [(:name team) (on-move (:id team))])]) (when (some? on-import) [(tr "dashboard.import") on-import-files]) - [:separator] - [(tr "labels.delete") on-delete]]}]])) + (when-not (:is-default project) + [:separator]) + (when-not (:is-default project) + [(tr "labels.delete") on-delete])]}]]))