The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Use the shared separator for inbox unread messages (#28669)
Raphaël Bosi53938d11537c
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatMessage.tsx b/packages/twenty-front/src/modules/ai/components/AiChatMessage.tsxindex 46680807c29..94cfc14a52f 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatMessage.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatMessage.tsx@@ -27,9 +27,9 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateimport { isExtendedFileUIPart } from 'twenty-shared/ai';import { isDefined, isNonEmptyArray } from 'twenty-shared/utils';+import { LabeledSeparator } from 'twenty-ui/components/layout';import { Avatar } from 'twenty-ui/primitives/data-display';import { themeCssVariables } from 'twenty-ui/theme';-import { LabeledDivider } from '@/ui/layout/line/components/LabeledDivider';import { dateLocaleState } from '@/localization/states/dateLocaleState';import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';@@ -289,11 +289,11 @@ export const AiChatMessage = ({return (<>{isAiChatInboxEnabled && agentChatFirstUnreadMessageId === messageId && (- <LabeledDivider- textPosition="end"- color={themeCssVariables.tag.text.red}- noMargin- >{t`New`}</LabeledDivider>+ <LabeledSeparator+ labelPosition="end"+ tone="danger"+ hasStartMarker+ >{t`New`}</LabeledSeparator>)}<StyledMessageBubble isRightAligned={isRightAligned}>{hasHeader && (isUser || isDefined(senderId)) && (diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsxindex 8388e171cd8..b35544c4732 100644--- a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx+++ b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatMessage.stories.tsx@@ -508,7 +508,12 @@ export const MultiplayerConversation: Story = {await expect(await canvas.findByText('Marco Rossi')).toBeVisible();await expect(await canvas.findByText('Assistant')).toBeVisible();- await expect(canvas.getByText('New')).toBeVisible();+ const unreadSeparator = canvas.getByRole('separator', { name: 'New' });+ await expect(unreadSeparator).toBeVisible();+ await expect(unreadSeparator).toHaveAttribute(+ 'aria-orientation',+ 'horizontal',+ );const selectedReaction = canvas.getByRole('button', { name: '👍 by You' });await expect(selectedReaction).toBeVisible();selectedReaction.focus();diff --git a/packages/twenty-front/src/modules/ui/layout/line/components/LabeledDivider.tsx b/packages/twenty-front/src/modules/ui/layout/line/components/LabeledDivider.tsxdeleted file mode 100644index d97764e0005..00000000000--- a/packages/twenty-front/src/modules/ui/layout/line/components/LabeledDivider.tsx+++ /dev/null@@ -1,54 +0,0 @@-import { styled } from '@linaria/react';-import { Separator } from 'twenty-ui/primitives/layout';-import { Text } from 'twenty-ui/primitives/typography';-import { themeCssVariables } from 'twenty-ui/theme';--const StyledContainer = styled.div<{ noMargin: boolean }>`- align-items: center;- display: flex;- margin-block: ${({ noMargin }) =>- noMargin ? '0' : themeCssVariables.spacing[3]};- width: 100%;-`;--const StyledLabel = styled(Text)`- margin-inline: ${themeCssVariables.spacing[2]};-`;--type LabeledDividerProps = {- children: string;- noMargin?: boolean;- color?: string;- textPosition?: 'center' | 'end';-};--export const LabeledDivider = ({- children,- noMargin = false,- color,- textPosition = 'center',-}: LabeledDividerProps) => {- const separatorStyle = {- backgroundColor: color,- flexGrow: 1,- width: 'auto',- };-- return (- <StyledContainer role="separator" aria-label={children} noMargin={noMargin}>- <Separator aria-hidden style={separatorStyle} />- <StyledLabel- size="xs"- weight="semibold"- color="light"- render={<span />}- style={{ color }}- >- {children}- </StyledLabel>- {textPosition === 'center' && (- <Separator aria-hidden style={separatorStyle} />- )}- </StyledContainer>- );-};