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 Button, { buttonThemes } from '../../../components/button.react.js'; import Dropdown from '../../../components/dropdown.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 @@ -235,4 +235,5 @@ --dropdown-disabled-color: var(--shades-black-60); --change-member-role-modal-description-text: var(--shades-white-60); --change-member-role-modal-generic-text: var(--shades-white-100); + --unsaved-changes-modal-text-color: var(--shades-white-60); }