diff --git a/web/modals/threads/members/change-member-role-modal.react.js b/web/modals/threads/members/change-member-role-modal.react.js --- a/web/modals/threads/members/change-member-role-modal.react.js +++ b/web/modals/threads/members/change-member-role-modal.react.js @@ -11,6 +11,7 @@ import Dropdown from '../../../components/dropdown.react.js'; import UserAvatar from '../../../components/user-avatar.react.js'; import Modal from '../../modal.react.js'; +import UnsavedChangesModal from '../../unsaved-changes-modal.react.js'; type ChangeMemberRoleModalProps = { +memberInfo: RelativeMemberInfo, @@ -19,7 +20,7 @@ function ChangeMemberRoleModal(props: ChangeMemberRoleModalProps): React.Node { const { memberInfo, threadInfo } = props; - const { popModal } = useModalContext(); + const { pushModal, popModal } = useModalContext(); const roleOptions = React.useMemo( () => @@ -40,6 +41,15 @@ const [selectedRole, setSelectedRole] = React.useState(initialSelectedRole); + const onBackClick = React.useCallback(() => { + if (selectedRole === initialSelectedRole) { + popModal(); + return; + } + + pushModal(); + }, [initialSelectedRole, popModal, pushModal, selectedRole]); + return (
@@ -60,7 +70,11 @@ />
- + +
+
+ ); +} + +export default UnsavedChangesModal; diff --git a/web/theme.css b/web/theme.css --- a/web/theme.css +++ b/web/theme.css @@ -231,4 +231,5 @@ --dropdown-selected-option-check-color: var(--violet-dark-100); --change-member-role-modal-description-text: var(--shades-white-80); --change-member-role-modal-generic-text: var(--shades-white-100); + --unsaved-changes-modal-text-color: var(--shades-white-60); }