0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-16 08:51:32 -05:00

🐛 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 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

View file

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

View file

@ -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

View file

@ -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."

View file

@ -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"