Files
twenty/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx
Weiko 43af5ceb5e Add object level permission permissions to role page (ReadOnly) (#11568)
## Context
This PR adds the display of object-level permissions. A following PR
will add the ability to update those permissions.
The PR contains the SettingsRoleObjectLevel page but it's not fully
implemented yet (save won't trigger the corresponding mutation)

<img width="616" alt="Screenshot 2025-04-14 at 18 02 40"
src="https://github.com/user-attachments/assets/f8c58193-31f3-468a-a96d-f06a9f2e1423"
/>
2025-04-15 18:46:36 +02:00

51 lines
1.3 KiB
TypeScript

import { useRecoilState } from 'recoil';
import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';
import { TitleInput } from '@/ui/input/components/TitleInput';
import styled from '@emotion/styled';
const ROLE_LABEL_EDIT_HOTKEY_SCOPE = 'role-label-edit';
const StyledHeaderTitle = styled.div`
color: ${({ theme }) => theme.font.color.primary};
font-weight: ${({ theme }) => theme.font.weight.semiBold};
font-size: ${({ theme }) => theme.font.size.lg};
width: fit-content;
max-width: 420px;
& > input:disabled {
color: ${({ theme }) => theme.font.color.primary};
}
`;
type SettingsRoleLabelContainerProps = {
roleId: string;
};
export const SettingsRoleLabelContainer = ({
roleId,
}: SettingsRoleLabelContainerProps) => {
const [settingsDraftRole, setSettingsDraftRole] = useRecoilState(
settingsDraftRoleFamilyState(roleId),
);
const handleChange = (newValue: string) => {
setSettingsDraftRole({
...settingsDraftRole,
label: newValue,
});
};
return (
<StyledHeaderTitle>
<TitleInput
disabled={!settingsDraftRole.isEditable}
sizeVariant="md"
value={settingsDraftRole.label}
onChange={handleChange}
placeholder="Role name"
hotkeyScope={ROLE_LABEL_EDIT_HOTKEY_SCOPE}
/>
</StyledHeaderTitle>
);
};