[BUGFIX] Account owner should not be clickable & [Refactor] Chip.tsx links (#10359)
# Introduction closes #10196 Initially fixing the `Account Owner` record field value should not be clickable and redirects on current page bug. This has been fixed computing whereas the current filed is a workspace member dynamically rendering a stale Chip components instead of an interactive one ## Refactor Refactored the `AvatarChip` `to` props logic to be scoped to lower level scope `Chip`. Now we have `LinkChip` `Chip`, `LinkAvatarChip` and `AvatarChip` all exported from twenty-ui. The caller has to determine which one to call from the design system ## New rule regarding chip links As discussed with @charlesBochet and @FelixMalfait A chip link will now ***always*** have `to` defined. ( and optionally an `onClick` ). `ChipLinks` cannot be used as buttons anymore ## Factorization Deleted the `RecordIndexRecordChip.tsx` file ( aka `RecordIdentifierChip` component ) that was duplicating some logic, refactored the `RecordChip` in order to handle what was covered by `RecordIdentifierChip` ## Conclusion As always any suggestions are more than welcomed ! Took few opinionated decision/refactor regarding nested long ternaries rendering `ReactNode` elements ## Misc https://github.com/user-attachments/assets/8ef11fb2-7ba6-4e96-bd59-b0be5a425156 --------- Co-authored-by: Mohammed Razak <mohammedrazak2001@gmail.com> Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -125,7 +125,7 @@ export const CalendarEventDetails = ({
|
||||
size={ChipSize.Large}
|
||||
variant={ChipVariant.Highlighted}
|
||||
clickable={false}
|
||||
leftComponent={<IconCalendarEvent size={theme.icon.size.md} />}
|
||||
leftComponent={() => <IconCalendarEvent size={theme.icon.size.md} />}
|
||||
label="Event"
|
||||
/>
|
||||
<StyledHeader>
|
||||
|
||||
@ -51,16 +51,20 @@ export const MessageThreadSubscribersChip = ({
|
||||
<Chip
|
||||
label={label}
|
||||
variant={ChipVariant.Highlighted}
|
||||
leftComponent={
|
||||
isOnlyOneSubscriber ? (
|
||||
<Avatar
|
||||
avatarUrl={firstAvatarUrl}
|
||||
placeholderColorSeed={firstAvatarColorSeed}
|
||||
placeholder={firstAvatarPlaceholder}
|
||||
size="md"
|
||||
type={'rounded'}
|
||||
/>
|
||||
) : (
|
||||
leftComponent={() => {
|
||||
if (isOnlyOneSubscriber) {
|
||||
return (
|
||||
<Avatar
|
||||
avatarUrl={firstAvatarUrl}
|
||||
placeholderColorSeed={firstAvatarColorSeed}
|
||||
placeholder={firstAvatarPlaceholder}
|
||||
size="md"
|
||||
type={'rounded'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AvatarGroup
|
||||
avatars={subscriberNames.map((name, index) => (
|
||||
<Avatar
|
||||
@ -71,9 +75,9 @@ export const MessageThreadSubscribersChip = ({
|
||||
/>
|
||||
))}
|
||||
/>
|
||||
)
|
||||
}
|
||||
rightComponent={<IconChevronDown size={theme.icon.size.sm} />}
|
||||
);
|
||||
}}
|
||||
rightComponent={() => <IconChevronDown size={theme.icon.size.sm} />}
|
||||
clickable
|
||||
/>
|
||||
);
|
||||
|
||||
@ -16,7 +16,11 @@ import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconCalendar, OverflowingTextWithTooltip } from 'twenty-ui';
|
||||
import {
|
||||
IconCalendar,
|
||||
OverflowingTextWithTooltip,
|
||||
isModifiedEvent,
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
||||
import { getFileNameAndExtension } from '~/utils/file/getFileNameAndExtension';
|
||||
@ -145,7 +149,7 @@ export const AttachmentRow = ({
|
||||
|
||||
const handleOpenDocument = (e: React.MouseEvent) => {
|
||||
// Cmd/Ctrl+click opens new tab, right click opens context menu
|
||||
if (e.metaKey || e.ctrlKey || e.button === 2) {
|
||||
if (isModifiedEvent(e) || e.button === 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
import { AvatarChip, AvatarChipVariant } from 'twenty-ui';
|
||||
import {
|
||||
AvatarChip,
|
||||
AvatarChipVariant,
|
||||
ChipSize,
|
||||
LinkAvatarChip,
|
||||
isModifiedEvent,
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { getLinkToShowPage } from '@/object-metadata/utils/getLinkToShowPage';
|
||||
@ -6,14 +12,16 @@ import { useRecordChipData } from '@/object-record/hooks/useRecordChipData';
|
||||
import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
||||
import { MouseEvent } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
export type RecordChipProps = {
|
||||
objectNameSingular: string;
|
||||
record: ObjectRecord;
|
||||
className?: string;
|
||||
variant?: AvatarChipVariant;
|
||||
forceDisableClick?: boolean;
|
||||
maxWidth?: number;
|
||||
to?: string | undefined;
|
||||
size?: ChipSize;
|
||||
};
|
||||
|
||||
export const RecordChip = ({
|
||||
@ -21,6 +29,10 @@ export const RecordChip = ({
|
||||
record,
|
||||
className,
|
||||
variant,
|
||||
maxWidth,
|
||||
to,
|
||||
size,
|
||||
forceDisableClick = false,
|
||||
}: RecordChipProps) => {
|
||||
const { recordChipData } = useRecordChipData({
|
||||
objectNameSingular,
|
||||
@ -33,30 +45,52 @@ export const RecordChip = ({
|
||||
recordIndexOpenRecordInSelector,
|
||||
);
|
||||
|
||||
const handleClick = (e: MouseEvent<Element>) => {
|
||||
e.stopPropagation();
|
||||
if (recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL) {
|
||||
openRecordInCommandMenu({
|
||||
recordId: record.id,
|
||||
objectNameSingular,
|
||||
});
|
||||
}
|
||||
};
|
||||
// TODO temporary until we create a record show page for Workspaces members
|
||||
if (forceDisableClick) {
|
||||
return (
|
||||
<AvatarChip
|
||||
size={size}
|
||||
maxWidth={maxWidth}
|
||||
placeholderColorSeed={record.id}
|
||||
name={recordChipData.name}
|
||||
avatarType={recordChipData.avatarType}
|
||||
avatarUrl={recordChipData.avatarUrl ?? ''}
|
||||
className={className}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const isSidePanelViewOpenRecordInType =
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL;
|
||||
const onClick = isSidePanelViewOpenRecordInType
|
||||
? () =>
|
||||
openRecordInCommandMenu({
|
||||
recordId: record.id,
|
||||
objectNameSingular,
|
||||
})
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<AvatarChip
|
||||
<LinkAvatarChip
|
||||
size={size}
|
||||
maxWidth={maxWidth}
|
||||
placeholderColorSeed={record.id}
|
||||
name={recordChipData.name}
|
||||
avatarType={recordChipData.avatarType}
|
||||
avatarUrl={recordChipData.avatarUrl ?? ''}
|
||||
className={className}
|
||||
variant={variant}
|
||||
onClick={handleClick}
|
||||
to={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.RECORD_PAGE
|
||||
? getLinkToShowPage(objectNameSingular, record)
|
||||
: undefined
|
||||
}
|
||||
to={to ?? getLinkToShowPage(objectNameSingular, record)}
|
||||
onClick={(clickEvent) => {
|
||||
// TODO refactor wrapper event listener to avoid colliding events
|
||||
clickEvent.stopPropagation();
|
||||
|
||||
const isModifiedEventResult = isModifiedEvent(clickEvent);
|
||||
if (isSidePanelViewOpenRecordInType && !isModifiedEventResult) {
|
||||
clickEvent.preventDefault();
|
||||
onClick?.();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -8,8 +8,11 @@ import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/r
|
||||
import { isRecordBoardCompactModeActiveComponentState } from '@/object-record/record-board/states/isRecordBoardCompactModeActiveComponentState';
|
||||
import { recordBoardVisibleFieldDefinitionsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardVisibleFieldDefinitionsComponentSelector';
|
||||
|
||||
import { RecordBoardCardBody } from '@/object-record/record-board/record-board-card/components/RecordBoardCardBody';
|
||||
import { RecordBoardCardHeader } from '@/object-record/record-board/record-board-card/components/RecordBoardCardHeader';
|
||||
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
|
||||
import { RecordValueSetterEffect } from '@/object-record/record-store/components/RecordValueSetterEffect';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { RecordBoardScrollWrapperContext } from '@/ui/utilities/scroll/contexts/ScrollWrapperContexts';
|
||||
import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyStateV2';
|
||||
@ -19,12 +22,10 @@ import styled from '@emotion/styled';
|
||||
import { useContext, useState } from 'react';
|
||||
import { InView, useInView } from 'react-intersection-observer';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { AnimatedEaseInOut } from 'twenty-ui';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import { RecordBoardCardBody } from '@/object-record/record-board/record-board-card/components/RecordBoardCardBody';
|
||||
import { RecordBoardCardHeader } from '@/object-record/record-board/record-board-card/components/RecordBoardCardHeader';
|
||||
import { useNavigateApp } from '~/hooks/useNavigateApp';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
|
||||
const StyledBoardCard = styled.div<{ selected: boolean }>`
|
||||
background-color: ${({ theme, selected }) =>
|
||||
@ -169,7 +170,7 @@ export const RecordBoardCard = ({
|
||||
onMouseLeave={onMouseLeaveBoard}
|
||||
onClick={handleCardClick}
|
||||
>
|
||||
{labelIdentifierField && (
|
||||
{isDefined(labelIdentifierField) && (
|
||||
<RecordBoardCardHeader
|
||||
identifierFieldDefinition={labelIdentifierField}
|
||||
isCreating={isCreating}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { RecordChip } from '@/object-record/components/RecordChip';
|
||||
import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext';
|
||||
import { useRecordBoardSelection } from '@/object-record/record-board/hooks/useRecordBoardSelection';
|
||||
import { RecordBoardCardHeaderContainer } from '@/object-record/record-board/record-board-card/components/RecordBoardCardHeaderContainer';
|
||||
@ -16,14 +16,12 @@ import {
|
||||
} from '@/object-record/record-field/contexts/FieldContext';
|
||||
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { getFieldButtonIcon } from '@/object-record/record-field/utils/getFieldButtonIcon';
|
||||
import { RecordIdentifierChip } from '@/object-record/record-index/components/RecordIndexRecordChip';
|
||||
import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';
|
||||
import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
|
||||
import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell';
|
||||
import { RecordInlineCellEditMode } from '@/object-record/record-inline-cell/components/RecordInlineCellEditMode';
|
||||
import { InlineCellHotkeyScope } from '@/object-record/record-inline-cell/types/InlineCellHotkeyScope';
|
||||
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyStateV2';
|
||||
@ -32,6 +30,7 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
||||
import styled from '@emotion/styled';
|
||||
import { Dispatch, SetStateAction, useContext, useState } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import {
|
||||
AvatarChipVariant,
|
||||
Checkbox,
|
||||
@ -123,8 +122,6 @@ export const RecordBoardCardHeader = ({
|
||||
recordIndexOpenRecordInSelector,
|
||||
);
|
||||
|
||||
const { openRecordInCommandMenu } = useCommandMenu();
|
||||
|
||||
return (
|
||||
<RecordBoardCardHeaderContainer showCompactView={showCompactView}>
|
||||
<StopPropagationContainer>
|
||||
@ -156,7 +153,7 @@ export const RecordBoardCardHeader = ({
|
||||
) : isIdentifierEmpty ? (
|
||||
<FieldContext.Provider
|
||||
value={{
|
||||
recordId: (record as ObjectRecord).id,
|
||||
recordId,
|
||||
maxWidth: 156,
|
||||
recoilScopeId:
|
||||
(isCreating ? 'new' : recordId) +
|
||||
@ -182,27 +179,19 @@ export const RecordBoardCardHeader = ({
|
||||
<RecordInlineCell />
|
||||
</FieldContext.Provider>
|
||||
) : (
|
||||
<RecordIdentifierChip
|
||||
objectNameSingular={objectMetadataItem.nameSingular}
|
||||
record={record as ObjectRecord}
|
||||
variant={AvatarChipVariant.Transparent}
|
||||
maxWidth={150}
|
||||
onClick={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
|
||||
? () => {
|
||||
openRecordInCommandMenu({
|
||||
recordId,
|
||||
objectNameSingular: objectMetadataItem.nameSingular,
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
to={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.RECORD_PAGE
|
||||
? indexIdentifierUrl(recordId)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
isDefined(record) && (
|
||||
<RecordChip
|
||||
objectNameSingular={objectMetadataItem.nameSingular}
|
||||
record={record}
|
||||
variant={AvatarChipVariant.Transparent}
|
||||
maxWidth={150}
|
||||
to={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.RECORD_PAGE
|
||||
? indexIdentifierUrl(recordId)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</StopPropagationContainer>
|
||||
|
||||
|
||||
@ -1,52 +1,22 @@
|
||||
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
|
||||
import { RecordChip } from '@/object-record/components/RecordChip';
|
||||
import { useChipFieldDisplay } from '@/object-record/record-field/meta-types/hooks/useChipFieldDisplay';
|
||||
import { RecordIdentifierChip } from '@/object-record/record-index/components/RecordIndexRecordChip';
|
||||
import { recordIndexOpenRecordInSelector } from '@/object-record/record-index/states/selectors/recordIndexOpenRecordInSelector';
|
||||
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { ChipSize } from 'twenty-ui';
|
||||
|
||||
export const ChipFieldDisplay = () => {
|
||||
const {
|
||||
recordValue,
|
||||
objectNameSingular,
|
||||
isLabelIdentifier,
|
||||
labelIdentifierLink,
|
||||
} = useChipFieldDisplay();
|
||||
const { recordValue, objectNameSingular, labelIdentifierLink } =
|
||||
useChipFieldDisplay();
|
||||
|
||||
const recordIndexOpenRecordIn = useRecoilValue(
|
||||
recordIndexOpenRecordInSelector,
|
||||
);
|
||||
|
||||
const { openRecordInCommandMenu } = useCommandMenu();
|
||||
|
||||
if (!recordValue) {
|
||||
if (!isDefined(recordValue)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return isLabelIdentifier ? (
|
||||
<RecordIdentifierChip
|
||||
return (
|
||||
<RecordChip
|
||||
objectNameSingular={objectNameSingular}
|
||||
record={recordValue}
|
||||
size={ChipSize.Small}
|
||||
to={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.RECORD_PAGE
|
||||
? labelIdentifierLink
|
||||
: undefined
|
||||
}
|
||||
onClick={
|
||||
recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL
|
||||
? () => {
|
||||
openRecordInCommandMenu({
|
||||
recordId: recordValue.id,
|
||||
objectNameSingular,
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
to={labelIdentifierLink}
|
||||
/>
|
||||
) : (
|
||||
<RecordChip objectNameSingular={objectNameSingular} record={recordValue} />
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,17 +1,22 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { RecordChip } from '@/object-record/components/RecordChip';
|
||||
import { useRelationToOneFieldDisplay } from '@/object-record/record-field/meta-types/hooks/useRelationToOneFieldDisplay';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const RelationToOneFieldDisplay = () => {
|
||||
const { fieldValue, fieldDefinition, generateRecordChipData } =
|
||||
useRelationToOneFieldDisplay();
|
||||
|
||||
if (
|
||||
!fieldValue ||
|
||||
!fieldDefinition?.metadata.relationObjectMetadataNameSingular
|
||||
!isDefined(fieldValue) ||
|
||||
!isDefined(fieldDefinition?.metadata.relationObjectMetadataNameSingular)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isWorkspaceMemberFieldMetadataRelation =
|
||||
fieldDefinition.metadata.relationObjectMetadataNameSingular ===
|
||||
CoreObjectNameSingular.WorkspaceMember;
|
||||
const recordChipData = generateRecordChipData(fieldValue);
|
||||
|
||||
return (
|
||||
@ -19,6 +24,7 @@ export const RelationToOneFieldDisplay = () => {
|
||||
key={recordChipData.recordId}
|
||||
objectNameSingular={recordChipData.objectNameSingular}
|
||||
record={fieldValue}
|
||||
forceDisableClick={isWorkspaceMemberFieldMetadataRelation}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandardObjectIcon';
|
||||
import { useRecordChipData } from '@/object-record/hooks/useRecordChipData';
|
||||
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { AvatarChip, AvatarChipVariant, ChipSize } from 'twenty-ui';
|
||||
|
||||
export type RecordIdentifierChipProps = {
|
||||
objectNameSingular: string;
|
||||
record: ObjectRecord;
|
||||
variant?: AvatarChipVariant;
|
||||
size?: ChipSize;
|
||||
to?: string;
|
||||
maxWidth?: number;
|
||||
onClick?: () => void;
|
||||
};
|
||||
|
||||
export const RecordIdentifierChip = ({
|
||||
objectNameSingular,
|
||||
record,
|
||||
variant,
|
||||
size,
|
||||
onClick,
|
||||
to,
|
||||
maxWidth,
|
||||
}: RecordIdentifierChipProps) => {
|
||||
const { recordChipData } = useRecordChipData({
|
||||
objectNameSingular,
|
||||
record,
|
||||
});
|
||||
|
||||
const { Icon: LeftIcon, IconColor: LeftIconColor } =
|
||||
useGetStandardObjectIcon(objectNameSingular);
|
||||
|
||||
if (!isNonEmptyString(recordChipData.name.trim())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<AvatarChip
|
||||
placeholderColorSeed={record.id}
|
||||
name={recordChipData.name}
|
||||
avatarType={recordChipData.avatarType}
|
||||
avatarUrl={recordChipData.avatarUrl ?? ''}
|
||||
to={to}
|
||||
onClick={onClick}
|
||||
variant={variant}
|
||||
LeftIcon={LeftIcon}
|
||||
LeftIconColor={LeftIconColor}
|
||||
size={size}
|
||||
maxWidth={maxWidth}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -4,7 +4,6 @@ import { ConnectedAccountProvider } from 'twenty-shared';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
AvatarChip,
|
||||
AvatarChipVariant,
|
||||
IconApi,
|
||||
IconCalendar,
|
||||
IconCsv,
|
||||
@ -71,7 +70,6 @@ export const ActorDisplay = ({
|
||||
LeftIcon={LeftIcon}
|
||||
avatarUrl={avatarUrl ?? undefined}
|
||||
isIconInverted={isIconInverted}
|
||||
variant={AvatarChipVariant.Transparent}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { ReactElement, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { AnimatedContainer, Chip, ChipVariant } from 'twenty-ui';
|
||||
import {
|
||||
AnimatedContainer,
|
||||
ChipSize,
|
||||
OverflowingTextWithTooltip,
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { ExpandedListDropdown } from '@/ui/layout/expandable-list/components/ExpandedListDropdown';
|
||||
import { isFirstOverflowingChildElement } from '@/ui/layout/expandable-list/utils/isFirstOverflowingChildElement';
|
||||
@ -34,7 +38,7 @@ const StyledChildContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledChipCount = styled(Chip)`
|
||||
const StyledUnShrinkableContainer = styled.div`
|
||||
flex-shrink: 0;
|
||||
`;
|
||||
|
||||
@ -150,11 +154,12 @@ export const ExpandableList = ({
|
||||
</StyledChildrenContainer>
|
||||
{canDisplayChipCount && (
|
||||
<AnimatedContainer>
|
||||
<StyledChipCount
|
||||
label={`+${hiddenChildrenCount}`}
|
||||
variant={ChipVariant.Highlighted}
|
||||
onClick={handleChipCountClick}
|
||||
/>
|
||||
<StyledUnShrinkableContainer onClick={handleChipCountClick}>
|
||||
<OverflowingTextWithTooltip
|
||||
text={`+${hiddenChildrenCount}`}
|
||||
size={ChipSize.Small}
|
||||
/>
|
||||
</StyledUnShrinkableContainer>
|
||||
</AnimatedContainer>
|
||||
)}
|
||||
{isListExpanded && (
|
||||
|
||||
@ -102,7 +102,7 @@ export const RightDrawerTopBar = () => {
|
||||
<Chip
|
||||
disabled={isNewViewableRecordLoading}
|
||||
label={label}
|
||||
leftComponent={<Icon size={theme.icon.size.md} />}
|
||||
leftComponent={() => <Icon size={theme.icon.size.md} />}
|
||||
size={ChipSize.Large}
|
||||
accent={ChipAccent.TextSecondary}
|
||||
clickable={false}
|
||||
|
||||
Reference in New Issue
Block a user