Add icons next to permission settings labels (#10673)
## Context as title Before <img width="842" alt="Screenshot 2025-03-05 at 15 11 19" src="https://github.com/user-attachments/assets/1c228f29-368b-460d-8067-90bb2afc6e41" /> After <img width="862" alt="Screenshot 2025-03-05 at 15 09 51" src="https://github.com/user-attachments/assets/e7f9d02a-0c4a-49f3-977f-a0d6bef20862" />
This commit is contained in:
@ -2,14 +2,22 @@ import { RolePermissionsObjectsTableHeader } from '@/settings/roles/role-permiss
|
|||||||
import { RolePermissionsSettingsTableHeader } from '@/settings/roles/role-permissions/components/RolePermissionsSettingsTableHeader';
|
import { RolePermissionsSettingsTableHeader } from '@/settings/roles/role-permissions/components/RolePermissionsSettingsTableHeader';
|
||||||
import { RolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/components/RolePermissionsSettingsTableRow';
|
import { RolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/components/RolePermissionsSettingsTableRow';
|
||||||
import { RolePermissionsObjectPermission } from '@/settings/roles/types/RolePermissionsObjectPermission';
|
import { RolePermissionsObjectPermission } from '@/settings/roles/types/RolePermissionsObjectPermission';
|
||||||
|
import { RolePermissionsSettingPermission } from '@/settings/roles/types/RolePermissionsSettingPermission';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import {
|
import {
|
||||||
H2Title,
|
H2Title,
|
||||||
|
IconCode,
|
||||||
IconEye,
|
IconEye,
|
||||||
|
IconHierarchy,
|
||||||
|
IconKey,
|
||||||
|
IconLock,
|
||||||
IconPencil,
|
IconPencil,
|
||||||
|
IconSettings,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
IconTrashX,
|
IconTrashX,
|
||||||
|
IconUserCog,
|
||||||
|
IconUsers,
|
||||||
Section,
|
Section,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
import { Role } from '~/generated-metadata/graphql';
|
import { Role } from '~/generated-metadata/graphql';
|
||||||
@ -44,71 +52,78 @@ export const RolePermissions = ({ role }: RolePermissionsProps) => {
|
|||||||
{
|
{
|
||||||
key: 'seeRecords',
|
key: 'seeRecords',
|
||||||
label: 'See Records on All Objects',
|
label: 'See Records on All Objects',
|
||||||
icon: <IconEye size={14} />,
|
Icon: IconEye,
|
||||||
value: role.canReadAllObjectRecords,
|
value: role.canReadAllObjectRecords,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'editRecords',
|
key: 'editRecords',
|
||||||
label: 'Edit Records on All Objects',
|
label: 'Edit Records on All Objects',
|
||||||
icon: <IconPencil size={14} />,
|
Icon: IconPencil,
|
||||||
value: role.canUpdateAllObjectRecords,
|
value: role.canUpdateAllObjectRecords,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'deleteRecords',
|
key: 'deleteRecords',
|
||||||
label: 'Delete Records on All Objects',
|
label: 'Delete Records on All Objects',
|
||||||
icon: <IconTrash size={14} />,
|
Icon: IconTrash,
|
||||||
value: role.canSoftDeleteAllObjectRecords,
|
value: role.canSoftDeleteAllObjectRecords,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'destroyRecords',
|
key: 'destroyRecords',
|
||||||
label: 'Destroy Records on All Objects',
|
label: 'Destroy Records on All Objects',
|
||||||
icon: <IconTrashX size={14} />,
|
Icon: IconTrashX,
|
||||||
value: role.canDestroyAllObjectRecords,
|
value: role.canDestroyAllObjectRecords,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const settingsPermissionsConfig = [
|
const settingsPermissionsConfig: RolePermissionsSettingPermission[] = [
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.API_KEYS_AND_WEBHOOKS,
|
key: SettingsPermissions.API_KEYS_AND_WEBHOOKS,
|
||||||
label: 'API Keys and Webhooks',
|
label: 'Manage API Keys & Webhooks',
|
||||||
type: 'Developer',
|
type: 'Developer',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
},
|
Icon: IconCode,
|
||||||
{
|
|
||||||
key: SettingsPermissions.ROLES,
|
|
||||||
label: 'Roles',
|
|
||||||
type: 'Members',
|
|
||||||
value: role.canUpdateAllSettings,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.WORKSPACE,
|
key: SettingsPermissions.WORKSPACE,
|
||||||
label: 'Workspace Settings',
|
label: 'Manage Workspace Settings',
|
||||||
type: 'General',
|
type: 'General',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconSettings,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.WORKSPACE_MEMBERS,
|
key: SettingsPermissions.WORKSPACE_MEMBERS,
|
||||||
label: 'Workspace Users',
|
label: 'Manage Members',
|
||||||
type: 'Members',
|
type: 'Members',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconUsers,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: SettingsPermissions.ROLES,
|
||||||
|
label: 'Manage Roles',
|
||||||
|
type: 'Members',
|
||||||
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconLock,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.DATA_MODEL,
|
key: SettingsPermissions.DATA_MODEL,
|
||||||
label: 'Data Model',
|
label: 'Manage Data Model',
|
||||||
type: 'Data Model',
|
type: 'Data Model',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconHierarchy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.ADMIN_PANEL,
|
key: SettingsPermissions.ADMIN_PANEL,
|
||||||
label: 'Admin Panel',
|
label: 'Manage Admin Panel',
|
||||||
type: 'Admin Panel',
|
type: 'Admin Panel',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconUserCog,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SettingsPermissions.SECURITY,
|
key: SettingsPermissions.SECURITY,
|
||||||
label: 'Security Settings',
|
label: 'Manage Security Settings',
|
||||||
type: 'Security',
|
type: 'Security',
|
||||||
value: role.canUpdateAllSettings,
|
value: role.canUpdateAllSettings,
|
||||||
|
Icon: IconKey,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,9 @@ export const RolePermissionsObjectsTableRow = ({
|
|||||||
<StyledTableRow key={permission.key}>
|
<StyledTableRow key={permission.key}>
|
||||||
<StyledPermissionCell>
|
<StyledPermissionCell>
|
||||||
<StyledIconWrapper>
|
<StyledIconWrapper>
|
||||||
<StyledIcon>{permission.icon}</StyledIcon>
|
<StyledIcon>
|
||||||
|
<permission.Icon size={14} />
|
||||||
|
</StyledIcon>
|
||||||
</StyledIconWrapper>
|
</StyledIconWrapper>
|
||||||
<StyledLabel>{permission.label}</StyledLabel>
|
<StyledLabel>{permission.label}</StyledLabel>
|
||||||
</StyledPermissionCell>
|
</StyledPermissionCell>
|
||||||
|
|||||||
@ -34,6 +34,12 @@ const StyledTableRow = styled(TableRow)`
|
|||||||
display: flex;
|
display: flex;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledIconContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`;
|
||||||
|
|
||||||
type RolePermissionsSettingsTableRowProps = {
|
type RolePermissionsSettingsTableRowProps = {
|
||||||
permission: RolePermissionsSettingPermission;
|
permission: RolePermissionsSettingPermission;
|
||||||
};
|
};
|
||||||
@ -47,6 +53,9 @@ export const RolePermissionsSettingsTableRow = ({
|
|||||||
<StyledLabel>{permission.label}</StyledLabel>
|
<StyledLabel>{permission.label}</StyledLabel>
|
||||||
</StyledPermissionCell>
|
</StyledPermissionCell>
|
||||||
<StyledPermissionCell>
|
<StyledPermissionCell>
|
||||||
|
<StyledIconContainer>
|
||||||
|
<permission.Icon size={14} />
|
||||||
|
</StyledIconContainer>
|
||||||
<StyledType>{permission.type}</StyledType>
|
<StyledType>{permission.type}</StyledType>
|
||||||
</StyledPermissionCell>
|
</StyledPermissionCell>
|
||||||
<StyledCheckboxCell>
|
<StyledCheckboxCell>
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
import { IconComponent } from 'twenty-ui';
|
||||||
|
|
||||||
export type RolePermissionsObjectPermission = {
|
export type RolePermissionsObjectPermission = {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
icon: React.ReactNode;
|
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
Icon: IconComponent;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
|
import { IconComponent } from 'twenty-ui';
|
||||||
|
|
||||||
export type RolePermissionsSettingPermission = {
|
export type RolePermissionsSettingPermission = {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
type: string;
|
type: string;
|
||||||
value: boolean;
|
value: boolean;
|
||||||
|
Icon: IconComponent;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,10 +12,10 @@ export {
|
|||||||
IconArrowDown,
|
IconArrowDown,
|
||||||
IconArrowLeft,
|
IconArrowLeft,
|
||||||
IconArrowRight,
|
IconArrowRight,
|
||||||
IconArrowUp,
|
|
||||||
IconArrowUpRight,
|
|
||||||
IconArrowsDiagonal,
|
IconArrowsDiagonal,
|
||||||
IconArrowsVertical,
|
IconArrowsVertical,
|
||||||
|
IconArrowUp,
|
||||||
|
IconArrowUpRight,
|
||||||
IconAt,
|
IconAt,
|
||||||
IconBaselineDensitySmall,
|
IconBaselineDensitySmall,
|
||||||
IconBell,
|
IconBell,
|
||||||
@ -44,8 +44,8 @@ export {
|
|||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconChevronLeft,
|
IconChevronLeft,
|
||||||
IconChevronRight,
|
IconChevronRight,
|
||||||
IconChevronUp,
|
|
||||||
IconChevronsRight,
|
IconChevronsRight,
|
||||||
|
IconChevronUp,
|
||||||
IconCircleDot,
|
IconCircleDot,
|
||||||
IconCircleOff,
|
IconCircleOff,
|
||||||
IconCirclePlus,
|
IconCirclePlus,
|
||||||
@ -156,6 +156,7 @@ export {
|
|||||||
IconHeart,
|
IconHeart,
|
||||||
IconHeartOff,
|
IconHeartOff,
|
||||||
IconHelpCircle,
|
IconHelpCircle,
|
||||||
|
IconHierarchy,
|
||||||
IconHierarchy2,
|
IconHierarchy2,
|
||||||
IconHistory,
|
IconHistory,
|
||||||
IconHistoryToggle,
|
IconHistoryToggle,
|
||||||
@ -269,6 +270,7 @@ export {
|
|||||||
IconUpload,
|
IconUpload,
|
||||||
IconUser,
|
IconUser,
|
||||||
IconUserCircle,
|
IconUserCircle,
|
||||||
|
IconUserCog,
|
||||||
IconUserPin,
|
IconUserPin,
|
||||||
IconUserPlus,
|
IconUserPlus,
|
||||||
IconUsers,
|
IconUsers,
|
||||||
|
|||||||
Reference in New Issue
Block a user