🐛 Fix issues with promote owner panel

This commit is contained in:
alonso.torres 2021-04-26 12:30:12 +02:00 committed by Andrés Moya
parent a507ab0e07
commit dff067c1a7
5 changed files with 32 additions and 8 deletions

View file

@ -33,7 +33,8 @@
- Fix problem displaying team statistics [#859](https://github.com/penpot/penpot/issues/859) - 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 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 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 ### :arrow_up: Deps updates

View file

@ -134,6 +134,11 @@
margin-bottom: 0px; margin-bottom: 0px;
} }
} }
}
.btn-disabled {
opacity: 0.5;
} }
} }

View file

@ -14,6 +14,7 @@
[app.main.data.dashboard :as dd] [app.main.data.dashboard :as dd]
[app.main.data.messages :as dm] [app.main.data.messages :as dm]
[app.main.data.modal :as modal] [app.main.data.modal :as modal]
[app.main.data.users :as du]
[app.main.refs :as refs] [app.main.refs :as refs]
[app.main.repo :as rp] [app.main.repo :as rp]
[app.main.store :as st] [app.main.store :as st]
@ -241,6 +242,8 @@
::mf/register-as ::leave-and-reassign} ::mf/register-as ::leave-and-reassign}
[{:keys [members profile team accept]}] [{:keys [members profile team accept]}]
(let [form (fm/use-form :spec ::leave-modal-form :initial {}) (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")}] options (into [{:value "" :label (tr "modals.leave-and-reassign.select-memeber-to-promote")}]
(map #(hash-map :label (:name %) :value (str (:id %))) members)) (map #(hash-map :label (:name %) :value (str (:id %))) members))
@ -264,11 +267,14 @@
[:div.modal-content.generic-form [:div.modal-content.generic-form
[:p (tr "modals.leave-and-reassign.hint1" (:name team))] [:p (tr "modals.leave-and-reassign.hint1" (:name team))]
[:p (tr "modals.leave-and-reassign.hint2")]
(if (empty? members)
[:p (tr "modals.leave-and-reassign.forbiden")]
[:*
[:p (tr "modals.leave-and-reassign.hint2")]
[:& fm/form {:form form} [:& fm/form {:form form}
[:& fm/select {:name :member-id [:& fm/select {:name :member-id
:options options}]]] :options options}]]])]
[:div.modal-footer [:div.modal-footer
[:div.action-buttons [:div.action-buttons
@ -279,7 +285,7 @@
[:input.accept-button [:input.accept-button
{:type "button" {:type "button"
:class (when-not (:valid @form) "btn-disabled") :class (if (:valid @form) "primary" "btn-disabled")
:disabled (not (:valid @form)) :disabled (not (:valid @form))
:value (tr "modals.leave-and-reassign.promote-and-leave") :value (tr "modals.leave-and-reassign.promote-and-leave")
:on-click on-accept}]]]]])) :on-click on-accept}]]]]]))
@ -314,7 +320,9 @@
(fn [] (fn []
(let [team-id (:default-team-id profile)] (let [team-id (:default-team-id profile)]
(da/set-current-team! team-id) (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 leave-fn
(mf/use-callback (mf/use-callback

View file

@ -1194,6 +1194,11 @@ msgstr "Send invitation"
msgid "modals.invite-member.title" msgid "modals.invite-member.title"
msgstr "Invite to join the team" 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 #: src/app/main/ui/dashboard/sidebar.cljs
msgid "modals.leave-and-reassign.hint1" msgid "modals.leave-and-reassign.hint1"
msgstr "You are %s owner." msgstr "You are %s owner."

View file

@ -1184,6 +1184,11 @@ msgstr "Enviar invitacion"
msgid "modals.invite-member.title" msgid "modals.invite-member.title"
msgstr "Invitar a unirse al equipo" 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 #: src/app/main/ui/dashboard/sidebar.cljs
msgid "modals.leave-and-reassign.hint1" msgid "modals.leave-and-reassign.hint1"
msgstr "Eres %s dueño." msgstr "Eres %s dueño."