[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:
@ -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