diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx index f5507c427..0ab4afc86 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx @@ -7,7 +7,7 @@ import { Select } from '@/ui/input/components/Select'; import { t } from '@lingui/core/macro'; import { useRecoilState } from 'recoil'; import { isDefined } from 'twenty-shared/utils'; -import { H2Title, IconUserPin } from 'twenty-ui/display'; +import { H2Title, IconUserPin, useIcons } from 'twenty-ui/display'; import { Card, Section } from 'twenty-ui/layout'; import { Role, @@ -51,10 +51,18 @@ export const SettingsRoleDefaultRole = ({ }); }; + const { getIcon } = useIcons(); + if (!currentWorkspace || !defaultRole) { return null; } + const options = roles.map((role) => ({ + label: role.label, + value: role.id, + Icon: getIcon(role.icon), + })); + return (
({ - label: role.label, - value: role.id, - }))} + options={options} value={defaultRole?.id ?? ''} onChange={(value) => updateDefaultRole(value as string, currentWorkspace) diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx index 33e4ae3f9..797f04f04 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx @@ -9,11 +9,12 @@ import { SettingsPath } from '@/types/SettingsPath'; import { TableCell } from '@/ui/layout/table/components/TableCell'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useRecoilValue } from 'recoil'; +import { H2Title, IconPlus } from 'twenty-ui/display'; +import { Button } from 'twenty-ui/input'; +import { Section } from 'twenty-ui/layout'; import { FeatureFlagKey } from '~/generated/graphql'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; -import { Button } from 'twenty-ui/input'; -import { H2Title, IconPlus } from 'twenty-ui/display'; -import { Section } from 'twenty-ui/layout'; +import { sortByAscString } from '~/utils/array/sortByAscString'; const StyledCreateRoleSection = styled(Section)` border-top: 1px solid ${({ theme }) => theme.border.color.light}; @@ -40,6 +41,10 @@ export const SettingsRolesList = () => { const settingsAllRoles = useRecoilValue(settingsAllRolesSelector); + const sortedSettingsAllRoles = [...settingsAllRoles].sort((a, b) => + sortByAscString(a.label, b.label), + ); + return (
{ - {settingsAllRoles.length === 0 ? ( + {sortedSettingsAllRoles.length === 0 ? ( {t`No roles found`} ) : ( - settingsAllRoles.map((role) => ( + sortedSettingsAllRoles.map((role) => ( )) )} diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx index c638e9859..10c0a4a18 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx @@ -111,11 +111,8 @@ export const SettingsRolesTableRow = ({ role }: SettingsRolesTableRowProps) => { {role.workspaceMembers.length} - - + + ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx index d91842700..1b2851867 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx @@ -243,6 +243,7 @@ export const SettingsRoleAssignment = ({
@@ -256,7 +257,7 @@ export const SettingsRoleAssignment = ({