diff --git a/web/roles/create-roles-modal.react.js b/web/roles/create-roles-modal.react.js --- a/web/roles/create-roles-modal.react.js +++ b/web/roles/create-roles-modal.react.js @@ -63,6 +63,8 @@ const [roleCreationFailed, setRoleCreationFailed] = React.useState(false); + const createButtonText = action === 'create_role' ? 'Create' : 'Save'; + const onChangeRoleName = React.useCallback( (event: SyntheticEvent) => { setRoleCreationFailed(false); @@ -206,8 +208,8 @@ ); } - return 'Save'; - }, [createRolesLoadingStatus]); + return createButtonText; + }, [createRolesLoadingStatus, createButtonText]); return ( diff --git a/web/roles/role-actions-menu.react.js b/web/roles/role-actions-menu.react.js --- a/web/roles/role-actions-menu.react.js +++ b/web/roles/role-actions-menu.react.js @@ -2,9 +2,12 @@ import * as React from 'react'; +import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; +import { useRoleUserSurfacedPermissions } from 'lib/shared/thread-utils.js'; import type { ThreadInfo } from 'lib/types/thread-types.js'; +import CreateRolesModal from './create-roles-modal.react.js'; import css from './role-actions-menu.css'; import MenuItem from '../components/menu-item.react.js'; import Menu from '../components/menu.react.js'; @@ -18,6 +21,7 @@ function RoleActionsMenu(props: RoleActionsMenuProps): React.Node { const { threadInfo, roleName } = props; + const { pushModal } = useModalContext(); const defaultRoleID = Object.keys(threadInfo.roles).find( roleID => threadInfo.roles[roleID].isDefault, @@ -30,7 +34,28 @@ roleName !== 'Admins' && defaultRoleID !== existingRoleID; const isEditableRole = roleName !== 'Admins'; - const openEditRoleModal = React.useCallback(() => {}, []); + const roleNamesToUserSurfacedPermissions = + useRoleUserSurfacedPermissions(threadInfo); + + const openEditRoleModal = React.useCallback( + () => + pushModal( + , + ), + [ + existingRoleID, + pushModal, + roleName, + roleNamesToUserSurfacedPermissions, + threadInfo, + ], + ); const openDeleteRoleModal = React.useCallback(() => {}, []); const items = React.useMemo(() => {