Files
twenty/packages/twenty-front/src/modules/activities/components/ParticipantChip.tsx
T
Raphaël Bosi c596a5e342 Rename twenty-ui to twenty-ui-deprecated and twenty-new-ui to twenty-ui to prepare package release (#21315)
## Description

Promotes the next-gen UI library (formerly `twenty-new-ui`) to the name
**`twenty-ui`** (v0.1.0, publishable) and renames the old package to
**`twenty-ui-deprecated`**. Rewrites ~1,730 `twenty-ui` imports →
`twenty-ui-deprecated`, updates all configs/CI/Docker/deps, and migrates
twenty-front's `Toggle` to the new package (first consumer) as a
drop-in.

## Next steps
- Wire the `ui/v*` publish dispatch (`cd-deploy-tag.yaml` +
`.yarnrc.yml`), then tag `ui/v0.1.0` to publish.
- Continue migrating components from `twenty-ui-deprecated` →
`twenty-ui`.
2026-06-08 18:12:28 +02:00

84 lines
2.3 KiB
TypeScript

import { styled } from '@linaria/react';
import React from 'react';
import { getDisplayNameFromParticipant } from '@/activities/emails/utils/getDisplayNameFromParticipant';
import { CoreObjectNameSingular } from 'twenty-shared/types';
import { RecordChip } from '@/object-record/components/RecordChip';
import { Avatar } from 'twenty-ui-deprecated/display';
import { themeCssVariables } from 'twenty-ui-deprecated/theme-constants';
const StyledAvatarContainer = styled.span`
margin-right: ${themeCssVariables.spacing[1]};
`;
const StyledSenderName = styled.span<{ variant?: 'default' | 'bold' }>`
color: ${themeCssVariables.font.color.primary};
font-size: ${themeCssVariables.font.size.md};
font-weight: ${({ variant }) =>
variant === 'bold'
? themeCssVariables.font.weight.medium
: themeCssVariables.font.weight.regular};
overflow: hidden;
text-overflow: ellipsis;
`;
const StyledContainer = styled.div`
align-items: flex-start;
display: flex;
`;
const StyledChip = styled.div`
align-items: center;
box-sizing: border-box;
display: flex;
gap: ${themeCssVariables.spacing[1]};
height: 20px;
padding: ${themeCssVariables.spacing[1]};
white-space: nowrap;
`;
type ParticipantChipVariant = 'default' | 'bold';
export const ParticipantChip = ({
participant,
variant = 'default',
className,
}: {
participant: any;
variant?: ParticipantChipVariant;
className?: string;
}) => {
const { person, workspaceMember } = participant;
const displayName = getDisplayNameFromParticipant({
participant,
shouldUseFullName: true,
});
const avatarUrl = person?.avatarUrl ?? workspaceMember?.avatarUrl ?? '';
return (
<StyledContainer className={className}>
{person ? (
<RecordChip
objectNameSingular={CoreObjectNameSingular.Person}
record={person}
isBold={variant === 'bold'}
/>
) : (
<StyledChip>
<StyledAvatarContainer>
<Avatar
avatarUrl={avatarUrl}
type="rounded"
placeholder={displayName}
size="sm"
/>
</StyledAvatarContainer>
<StyledSenderName variant={variant}>{displayName}</StyledSenderName>
</StyledChip>
)}
</StyledContainer>
);
};