Fix filter sub-field icons (#12456)
This PR fixes filter sub-field icons, with more relevant icons. Fixes https://github.com/twentyhq/core-team-issues/issues/1006
This commit is contained in:
@ -11,6 +11,8 @@ import { objectFilterDropdownIsSelectingCompositeFieldComponentState } from '@/o
|
|||||||
import { objectFilterDropdownSubMenuFieldTypeComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState';
|
import { objectFilterDropdownSubMenuFieldTypeComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState';
|
||||||
import { getCompositeSubFieldLabel } from '@/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel';
|
import { getCompositeSubFieldLabel } from '@/object-record/object-filter-dropdown/utils/getCompositeSubFieldLabel';
|
||||||
import { getFilterableFieldTypeLabel } from '@/object-record/object-filter-dropdown/utils/getFilterableFieldTypeLabel';
|
import { getFilterableFieldTypeLabel } from '@/object-record/object-filter-dropdown/utils/getFilterableFieldTypeLabel';
|
||||||
|
import { DEFAULT_ANY_SUB_FIELD_ICON_NAME } from '@/object-record/record-filter/constants/DefaultAnySubFieldIconName';
|
||||||
|
import { ICON_NAME_BY_ANY_SUB_FIELD } from '@/object-record/record-filter/constants/IconNameByAnySubField';
|
||||||
import { ICON_NAME_BY_SUB_FIELD } from '@/object-record/record-filter/constants/IconNameBySubField';
|
import { ICON_NAME_BY_SUB_FIELD } from '@/object-record/record-filter/constants/IconNameBySubField';
|
||||||
import { areCompositeTypeSubFieldsFilterable } from '@/object-record/record-filter/utils/areCompositeTypeSubFieldsFilterable';
|
import { areCompositeTypeSubFieldsFilterable } from '@/object-record/record-filter/utils/areCompositeTypeSubFieldsFilterable';
|
||||||
import { isCompositeTypeFilterableByAnySubField } from '@/object-record/record-filter/utils/isCompositeTypeFilterableByAnySubField';
|
import { isCompositeTypeFilterableByAnySubField } from '@/object-record/record-filter/utils/isCompositeTypeFilterableByAnySubField';
|
||||||
@ -23,7 +25,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl
|
|||||||
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
|
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
|
||||||
import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';
|
import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState';
|
||||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||||
import { IconApps, IconChevronLeft, useIcons } from 'twenty-ui/display';
|
import { IconChevronLeft, useIcons } from 'twenty-ui/display';
|
||||||
import { MenuItem } from 'twenty-ui/navigation';
|
import { MenuItem } from 'twenty-ui/navigation';
|
||||||
|
|
||||||
type AdvancedFilterSubFieldSelectMenuProps = {
|
type AdvancedFilterSubFieldSelectMenuProps = {
|
||||||
@ -110,6 +112,16 @@ export const AdvancedFilterSubFieldSelectMenu = ({
|
|||||||
...subFieldNames.map((subFieldName) => subFieldName),
|
...subFieldNames.map((subFieldName) => subFieldName),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const iconNameForAnySubField = isDefined(fieldMetadataItemUsedInDropdown)
|
||||||
|
? ICON_NAME_BY_ANY_SUB_FIELD[fieldMetadataItemUsedInDropdown?.type]
|
||||||
|
: (null ?? null);
|
||||||
|
|
||||||
|
const anySubFieldIcon = getIcon(
|
||||||
|
iconNameForAnySubField ??
|
||||||
|
fieldMetadataItemUsedInDropdown?.icon ??
|
||||||
|
DEFAULT_ANY_SUB_FIELD_ICON_NAME,
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownContent>
|
<DropdownContent>
|
||||||
<DropdownMenuHeader
|
<DropdownMenuHeader
|
||||||
@ -143,8 +155,8 @@ export const AdvancedFilterSubFieldSelectMenu = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSelectFilter(fieldMetadataItemUsedInDropdown);
|
handleSelectFilter(fieldMetadataItemUsedInDropdown);
|
||||||
}}
|
}}
|
||||||
LeftIcon={IconApps}
|
LeftIcon={anySubFieldIcon}
|
||||||
text={`Any ${getFilterableFieldTypeLabel(objectFilterDropdownSubMenuFieldType)} field`}
|
text={`Any ${fieldMetadataItemUsedInDropdown.label} field`}
|
||||||
/>
|
/>
|
||||||
</SelectableListItem>
|
</SelectableListItem>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
export const DEFAULT_ANY_SUB_FIELD_ICON_NAME = 'IconApps';
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
import { FieldMetadataType } from 'twenty-shared/types';
|
||||||
|
|
||||||
|
export const ICON_NAME_BY_ANY_SUB_FIELD: Partial<
|
||||||
|
Record<FieldMetadataType, string>
|
||||||
|
> = {
|
||||||
|
[FieldMetadataType.LINKS]: 'IconLink',
|
||||||
|
[FieldMetadataType.EMAILS]: 'IconMail',
|
||||||
|
[FieldMetadataType.PHONES]: 'IconPhone',
|
||||||
|
[FieldMetadataType.ADDRESS]: 'IconMap',
|
||||||
|
[FieldMetadataType.ACTOR]: 'IconCreativeCommonsSa',
|
||||||
|
[FieldMetadataType.FULL_NAME]: 'IconUser',
|
||||||
|
[FieldMetadataType.POSITION]: 'IconBriefcase',
|
||||||
|
};
|
||||||
@ -5,13 +5,22 @@ export const ICON_NAME_BY_SUB_FIELD: Partial<
|
|||||||
> = {
|
> = {
|
||||||
currencyCode: 'IconCurrencyDollar',
|
currencyCode: 'IconCurrencyDollar',
|
||||||
amountMicros: 'IconNumber95Small',
|
amountMicros: 'IconNumber95Small',
|
||||||
name: 'IconAlignJustified',
|
name: 'IconTextSize',
|
||||||
source: 'IconFileArrowLeft',
|
source: 'IconTransferIn',
|
||||||
primaryEmail: 'IconMail',
|
primaryEmail: 'IconMail',
|
||||||
additionalEmails: 'IconList',
|
additionalEmails: 'IconMailPlus',
|
||||||
primaryLinkLabel: 'IconLabel',
|
primaryLinkLabel: 'IconTextSize',
|
||||||
primaryLinkUrl: 'IconLink',
|
primaryLinkUrl: 'IconLink',
|
||||||
secondaryLinks: 'IconList',
|
secondaryLinks: 'IconLinkPlus',
|
||||||
primaryPhoneCallingCode: 'IconPlus',
|
primaryPhoneNumber: 'IconPhoneCall',
|
||||||
additionalPhones: 'IconList',
|
primaryPhoneCallingCode: 'IconFlag',
|
||||||
|
additionalPhones: 'IconPhonePlus',
|
||||||
|
addressCity: 'IconMapPin',
|
||||||
|
addressCountry: 'IconMapPin',
|
||||||
|
addressPostcode: 'IconMapPin',
|
||||||
|
addressStreet1: 'IconMapPin',
|
||||||
|
addressStreet2: 'IconMapPin',
|
||||||
|
addressState: 'IconMapPin',
|
||||||
|
firstName: 'IconTextSize',
|
||||||
|
lastName: 'IconTextSize',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,18 +4,18 @@ export {
|
|||||||
IconAlertCircle,
|
IconAlertCircle,
|
||||||
IconAlertTriangle,
|
IconAlertTriangle,
|
||||||
IconApi,
|
IconApi,
|
||||||
IconApps,
|
|
||||||
IconAppWindow,
|
IconAppWindow,
|
||||||
|
IconApps,
|
||||||
IconArchive,
|
IconArchive,
|
||||||
IconArchiveOff,
|
IconArchiveOff,
|
||||||
IconArrowBackUp,
|
IconArrowBackUp,
|
||||||
IconArrowDown,
|
IconArrowDown,
|
||||||
IconArrowLeft,
|
IconArrowLeft,
|
||||||
IconArrowRight,
|
IconArrowRight,
|
||||||
IconArrowsDiagonal,
|
|
||||||
IconArrowsVertical,
|
|
||||||
IconArrowUp,
|
IconArrowUp,
|
||||||
IconArrowUpRight,
|
IconArrowUpRight,
|
||||||
|
IconArrowsDiagonal,
|
||||||
|
IconArrowsVertical,
|
||||||
IconAt,
|
IconAt,
|
||||||
IconBaselineDensitySmall,
|
IconBaselineDensitySmall,
|
||||||
IconBell,
|
IconBell,
|
||||||
@ -47,8 +47,8 @@ export {
|
|||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconChevronLeft,
|
IconChevronLeft,
|
||||||
IconChevronRight,
|
IconChevronRight,
|
||||||
IconChevronsRight,
|
|
||||||
IconChevronUp,
|
IconChevronUp,
|
||||||
|
IconChevronsRight,
|
||||||
IconCircleDot,
|
IconCircleDot,
|
||||||
IconCircleOff,
|
IconCircleOff,
|
||||||
IconCirclePlus,
|
IconCirclePlus,
|
||||||
@ -190,6 +190,7 @@ export {
|
|||||||
IconLifebuoy,
|
IconLifebuoy,
|
||||||
IconLink,
|
IconLink,
|
||||||
IconLinkOff,
|
IconLinkOff,
|
||||||
|
IconLinkPlus,
|
||||||
IconList,
|
IconList,
|
||||||
IconListCheck,
|
IconListCheck,
|
||||||
IconListDetails,
|
IconListDetails,
|
||||||
|
|||||||
@ -2530,6 +2530,7 @@ import {
|
|||||||
IconLineHeight,
|
IconLineHeight,
|
||||||
IconLink,
|
IconLink,
|
||||||
IconLinkOff,
|
IconLinkOff,
|
||||||
|
IconLinkPlus,
|
||||||
IconList,
|
IconList,
|
||||||
IconListCheck,
|
IconListCheck,
|
||||||
IconListDetails,
|
IconListDetails,
|
||||||
@ -6714,6 +6715,7 @@ export const ALL_ICONS = {
|
|||||||
IconLineDotted,
|
IconLineDotted,
|
||||||
IconLineHeight,
|
IconLineHeight,
|
||||||
IconLink,
|
IconLink,
|
||||||
|
IconLinkPlus,
|
||||||
IconLinkOff,
|
IconLinkOff,
|
||||||
IconList,
|
IconList,
|
||||||
IconListCheck,
|
IconListCheck,
|
||||||
|
|||||||
@ -65,18 +65,18 @@ export {
|
|||||||
IconAlertCircle,
|
IconAlertCircle,
|
||||||
IconAlertTriangle,
|
IconAlertTriangle,
|
||||||
IconApi,
|
IconApi,
|
||||||
IconApps,
|
|
||||||
IconAppWindow,
|
IconAppWindow,
|
||||||
|
IconApps,
|
||||||
IconArchive,
|
IconArchive,
|
||||||
IconArchiveOff,
|
IconArchiveOff,
|
||||||
IconArrowBackUp,
|
IconArrowBackUp,
|
||||||
IconArrowDown,
|
IconArrowDown,
|
||||||
IconArrowLeft,
|
IconArrowLeft,
|
||||||
IconArrowRight,
|
IconArrowRight,
|
||||||
IconArrowsDiagonal,
|
|
||||||
IconArrowsVertical,
|
|
||||||
IconArrowUp,
|
IconArrowUp,
|
||||||
IconArrowUpRight,
|
IconArrowUpRight,
|
||||||
|
IconArrowsDiagonal,
|
||||||
|
IconArrowsVertical,
|
||||||
IconAt,
|
IconAt,
|
||||||
IconBaselineDensitySmall,
|
IconBaselineDensitySmall,
|
||||||
IconBell,
|
IconBell,
|
||||||
@ -108,8 +108,8 @@ export {
|
|||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconChevronLeft,
|
IconChevronLeft,
|
||||||
IconChevronRight,
|
IconChevronRight,
|
||||||
IconChevronsRight,
|
|
||||||
IconChevronUp,
|
IconChevronUp,
|
||||||
|
IconChevronsRight,
|
||||||
IconCircleDot,
|
IconCircleDot,
|
||||||
IconCircleOff,
|
IconCircleOff,
|
||||||
IconCirclePlus,
|
IconCirclePlus,
|
||||||
@ -251,6 +251,7 @@ export {
|
|||||||
IconLifebuoy,
|
IconLifebuoy,
|
||||||
IconLink,
|
IconLink,
|
||||||
IconLinkOff,
|
IconLinkOff,
|
||||||
|
IconLinkPlus,
|
||||||
IconList,
|
IconList,
|
||||||
IconListCheck,
|
IconListCheck,
|
||||||
IconListDetails,
|
IconListDetails,
|
||||||
|
|||||||
Reference in New Issue
Block a user