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 @@ -12,6 +12,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, @@ -20,7 +21,7 @@ function ChangeMemberRoleModal(props: ChangeMemberRoleModalProps): React.Node { const { memberInfo, threadInfo } = props; - const { popModal } = useModalContext(); + const { pushModal, popModal } = useModalContext(); const roleOptions = React.useMemo( () => @@ -36,6 +37,15 @@ const [selectedRole, setSelectedRole] = React.useState(initialSelectedRole); + const onBackClick = React.useCallback(() => { + if (selectedRole === initialSelectedRole) { + popModal(); + return; + } + + pushModal(); + }, [initialSelectedRole, popModal, pushModal, selectedRole]); + return (
@@ -56,7 +66,11 @@ />
- + +
+
+ ); +} + +export default UnsavedChangesModal; diff --git a/web/theme.css b/web/theme.css --- a/web/theme.css +++ b/web/theme.css @@ -233,4 +233,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); }