From dff067c1a7605aca9f26b77bf32e409d92fd28ad Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 26 Apr 2021 12:30:12 +0200 Subject: [PATCH] :bug: Fix issues with promote owner panel --- CHANGES.md | 3 ++- .../resources/styles/main/partials/modal.scss | 5 +++++ .../src/app/main/ui/dashboard/sidebar.cljs | 20 +++++++++++++------ frontend/translations/en.po | 5 +++++ frontend/translations/es.po | 7 ++++++- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 16f841339..85b71fde9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -33,7 +33,8 @@ - Fix problem displaying team statistics [#859](https://github.com/penpot/penpot/issues/859) - Fix problems with text editor selection [Taiga #1546](https://tree.taiga.io/project/penpot/issue/1546) - Fix problem when opening the context menu in dashboard at the bottom [#856](https://github.com/penpot/penpot/issues/856) -- Fix visual problem with group invite[Taiga #1290](https://tree.taiga.io/project/penpot/issue/1290) +- Fix visual problem with group invite [Taiga #1290](https://tree.taiga.io/project/penpot/issue/1290) +- Fix issues with promote owner panel [Taiga #763](https://tree.taiga.io/project/penpot/issue/763) ### :arrow_up: Deps updates diff --git a/frontend/resources/styles/main/partials/modal.scss b/frontend/resources/styles/main/partials/modal.scss index fee4b62d6..d67985d15 100644 --- a/frontend/resources/styles/main/partials/modal.scss +++ b/frontend/resources/styles/main/partials/modal.scss @@ -134,6 +134,11 @@ margin-bottom: 0px; } } + + } + + .btn-disabled { + opacity: 0.5; } } diff --git a/frontend/src/app/main/ui/dashboard/sidebar.cljs b/frontend/src/app/main/ui/dashboard/sidebar.cljs index 64dd8ede3..f2b331a0e 100644 --- a/frontend/src/app/main/ui/dashboard/sidebar.cljs +++ b/frontend/src/app/main/ui/dashboard/sidebar.cljs @@ -14,6 +14,7 @@ [app.main.data.dashboard :as dd] [app.main.data.messages :as dm] [app.main.data.modal :as modal] + [app.main.data.users :as du] [app.main.refs :as refs] [app.main.repo :as rp] [app.main.store :as st] @@ -241,6 +242,8 @@ ::mf/register-as ::leave-and-reassign} [{:keys [members profile team accept]}] (let [form (fm/use-form :spec ::leave-modal-form :initial {}) + not-current-user? (fn [{:keys [id]}] (not= id (:id profile))) + members (->> members (filterv not-current-user?)) options (into [{:value "" :label (tr "modals.leave-and-reassign.select-memeber-to-promote")}] (map #(hash-map :label (:name %) :value (str (:id %))) members)) @@ -264,11 +267,14 @@ [:div.modal-content.generic-form [:p (tr "modals.leave-and-reassign.hint1" (:name team))] - [:p (tr "modals.leave-and-reassign.hint2")] - [:& fm/form {:form form} - [:& fm/select {:name :member-id - :options options}]]] + (if (empty? members) + [:p (tr "modals.leave-and-reassign.forbiden")] + [:* + [:p (tr "modals.leave-and-reassign.hint2")] + [:& fm/form {:form form} + [:& fm/select {:name :member-id + :options options}]]])] [:div.modal-footer [:div.action-buttons @@ -279,7 +285,7 @@ [:input.accept-button {:type "button" - :class (when-not (:valid @form) "btn-disabled") + :class (if (:valid @form) "primary" "btn-disabled") :disabled (not (:valid @form)) :value (tr "modals.leave-and-reassign.promote-and-leave") :on-click on-accept}]]]]])) @@ -314,7 +320,9 @@ (fn [] (let [team-id (:default-team-id profile)] (da/set-current-team! team-id) - (st/emit! (rt/nav :dashboard-projects {:team-id team-id}))))) + (st/emit! (modal/hide) + (du/fetch-teams) + (rt/nav :dashboard-projects {:team-id team-id}))))) leave-fn (mf/use-callback diff --git a/frontend/translations/en.po b/frontend/translations/en.po index ff39c7075..eb0eee9d9 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -1194,6 +1194,11 @@ msgstr "Send invitation" msgid "modals.invite-member.title" msgstr "Invite to join the team" +msgid "modals.leave-and-reassign.forbiden" +msgstr "" +"You can not leave the team if there is no other member to promote to owner. " +"You might want to delete the team." + #: src/app/main/ui/dashboard/sidebar.cljs msgid "modals.leave-and-reassign.hint1" msgstr "You are %s owner." diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 93c79ce90..46bacd4eb 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -1184,6 +1184,11 @@ msgstr "Enviar invitacion" msgid "modals.invite-member.title" msgstr "Invitar a unirse al equipo" +msgid "modals.leave-and-reassign.forbiden" +msgstr "" +"No puede abandonar el equipo si no hay otro miembro al que promocionar a " +"dueño. Quizás quiere borrar el equipo." + #: src/app/main/ui/dashboard/sidebar.cljs msgid "modals.leave-and-reassign.hint1" msgstr "Eres %s dueño." @@ -2505,4 +2510,4 @@ msgid "workspace.updates.update" msgstr "Actualizar" msgid "workspace.viewport.click-to-close-path" -msgstr "Pulsar para cerrar la ruta" +msgstr "Pulsar para cerrar la ruta" \ No newline at end of file