Skip to content

The open alternative to Salesforce, designed for AI.

Match inbox channel navigation (#28868)

Raphaël Bosifacae67b00ef
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
index 91c53f4b720..e9df26184ea 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql
@@ -55,9 +55,13 @@ type AgentChatChannelRole {
}
type AgentChatChannelSummary {
+ assignedToMeCount: Int!
channelId: UUID!
+ doneCount: Int!
+ hasUnreadAssignedToMe: Boolean!
hasUnreadOpen: Boolean!
openCount: Int!
+ snoozedCount: Int!
}
type AgentChatChannelThreadIds {
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.ts
index fc27ced5285..1369db00350 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts
+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts
@@ -57,9 +57,13 @@ export interface AgentChatChannelRole {
}
export interface AgentChatChannelSummary {
+ assignedToMeCount: Scalars['Int']
channelId: Scalars['UUID']
+ doneCount: Scalars['Int']
+ hasUnreadAssignedToMe: Scalars['Boolean']
hasUnreadOpen: Scalars['Boolean']
openCount: Scalars['Int']
+ snoozedCount: Scalars['Int']
__typename: 'AgentChatChannelSummary'
}
@@ -4241,9 +4245,13 @@ export interface AgentChatChannelRoleGenqlSelection{
}
export interface AgentChatChannelSummaryGenqlSelection{
+ assignedToMeCount?: boolean | number
channelId?: boolean | number
+ doneCount?: boolean | number
+ hasUnreadAssignedToMe?: boolean | number
hasUnreadOpen?: boolean | number
openCount?: boolean | number
+ snoozedCount?: boolean | number
__typename?: boolean | number
__scalar?: boolean | number
}
diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.ts
index 496c9a5a74e..964b94e78ea 100644
--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts
+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts
@@ -250,15 +250,27 @@ export default {
]
},
"AgentChatChannelSummary": {
+ "assignedToMeCount": [
+ 10
+ ],
"channelId": [
524
],
+ "doneCount": [
+ 10
+ ],
+ "hasUnreadAssignedToMe": [
+ 4
+ ],
"hasUnreadOpen": [
4
],
"openCount": [
10
],
+ "snoozedCount": [
+ 10
+ ],
"__typename": [
1
]
diff --git a/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx b/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx
index 0afae90f200..e6e87f0cea1 100644
--- a/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/icon/catalog.mdx
@@ -102,6 +102,7 @@ Supported props: `color`, `size`, `stroke`, `title`. Native SVG attributes and r
- `IconChevronUp`
- `IconChevronsRight`
- `IconCircle`
+- `IconCircleCheck`
- `IconCircleDashed`
- `IconCircleDot`
- `IconCircleOff`
diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts
index d25cff426d2..81292a13782 100644
--- a/packages/twenty-front/src/generated-metadata/graphql.ts
+++ b/packages/twenty-front/src/generated-metadata/graphql.ts
@@ -81,9 +81,13 @@ export type AgentChatChannelRole = {
export type AgentChatChannelSummary = {
__typename?: 'AgentChatChannelSummary';
+ assignedToMeCount: Scalars['Int']['output'];
channelId: Scalars['UUID']['output'];
+ doneCount: Scalars['Int']['output'];
+ hasUnreadAssignedToMe: Scalars['Boolean']['output'];
hasUnreadOpen: Scalars['Boolean']['output'];
openCount: Scalars['Int']['output'];
+ snoozedCount: Scalars['Int']['output'];
};
export type AgentChatChannelThreadIds = {
@@ -8920,7 +8924,7 @@ export type GetAgentChatChannelRolesQuery = { __typename?: 'Query', agentChatCha
export type GetAgentChatChannelSummariesQueryVariables = Exact<{ [key: string]: never; }>;
-export type GetAgentChatChannelSummariesQuery = { __typename?: 'Query', agentChatChannelSummaries: Array<{ __typename?: 'AgentChatChannelSummary', channelId: string, openCount: number, hasUnreadOpen: boolean }> };
+export type GetAgentChatChannelSummariesQuery = { __typename?: 'Query', agentChatChannelSummaries: Array<{ __typename?: 'AgentChatChannelSummary', channelId: string, openCount: number, hasUnreadOpen: boolean, assignedToMeCount: number, hasUnreadAssignedToMe: boolean, snoozedCount: number, doneCount: number }> };
export type GetAgentChatChannelThreadIdsQueryVariables = Exact<{
channelId: Scalars['UUID']['input'];
@@ -11553,7 +11557,7 @@ export const FindManySkillsForSuggestionDocument = {"kind":"Document","definitio
export const FindOneAgentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneAgent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneAgent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<FindOneAgentQuery, FindOneAgentQueryVariables>;
export const FindOneSkillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneSkill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"skill"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SkillFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SkillFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Skill"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<FindOneSkillQuery, FindOneSkillQueryVariables>;
export const GetAgentChatChannelRolesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatChannelRoles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatChannelRoles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"canAccessAllAgentChatChannels"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatChannelRolesQuery, GetAgentChatChannelRolesQueryVariables>;
-export const GetAgentChatChannelSummariesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatChannelSummaries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatChannelSummaries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"openCount"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadOpen"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatChannelSummariesQuery, GetAgentChatChannelSummariesQueryVariables>;
+export const GetAgentChatChannelSummariesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatChannelSummaries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatChannelSummaries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"openCount"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadOpen"}},{"kind":"Field","name":{"kind":"Name","value":"assignedToMeCount"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadAssignedToMe"}},{"kind":"Field","name":{"kind":"Name","value":"snoozedCount"}},{"kind":"Field","name":{"kind":"Name","value":"doneCount"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatChannelSummariesQuery, GetAgentChatChannelSummariesQueryVariables>;
export const GetAgentChatChannelThreadIdsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatChannelThreadIds"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"channelId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"status"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatChannelThreadStatus"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"assignment"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"AgentChatChannelAssignmentFilter"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatChannelThreadIds"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"channelId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"channelId"}}},{"kind":"Argument","name":{"kind":"Name","value":"status"},"value":{"kind":"Variable","name":{"kind":"Name","value":"status"}}},{"kind":"Argument","name":{"kind":"Name","value":"assignment"},"value":{"kind":"Variable","name":{"kind":"Name","value":"assignment"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threadIds"}},{"kind":"Field","name":{"kind":"Name","value":"hasNextPage"}},{"kind":"Field","name":{"kind":"Name","value":"endCursor"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatChannelThreadIdsQuery, GetAgentChatChannelThreadIdsQueryVariables>;
export const GetAgentChatChannelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatChannels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatChannels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"roleIds"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isAccessible"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatChannelsQuery, GetAgentChatChannelsQueryVariables>;
export const GetAgentChatOpenThreadsSummaryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAgentChatOpenThreadsSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"agentChatOpenThreadsSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"openThreadCount"}},{"kind":"Field","name":{"kind":"Name","value":"needsInputThreadCount"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadOpenThread"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadMentionThread"}},{"kind":"Field","name":{"kind":"Name","value":"hasUnreadAssignedThread"}}]}}]}}]} as unknown as DocumentNode<GetAgentChatOpenThreadsSummaryQuery, GetAgentChatOpenThreadsSummaryQueryVariables>;
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx
index 7164a705bab..9e87fdc9dd7 100644
--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx
@@ -1,32 +1,26 @@
import { styled } from '@linaria/react';
import { AppPath } from 'twenty-shared/types';
import { getAppPath } from 'twenty-shared/utils';
-import { themeCssVariables, useTheme } from 'twenty-ui/theme';
+import { themeCssVariables } from 'twenty-ui/theme';
-import { useAgentChatInboxViewHeading } from '@/ai/hooks/useAgentChatInboxViewHeading';
+import { AiChatInboxViewHeading } from '@/ai/components/AiChatInboxViewHeading';
import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink/UndecoratedLink';
-const StyledBreadcrumb = styled.span`
+const StyledBreadcrumb = styled(UndecoratedLink)`
align-items: center;
color: ${themeCssVariables.font.color.tertiary};
display: flex;
- flex-shrink: 0;
font-weight: ${themeCssVariables.font.weight.medium};
gap: ${themeCssVariables.spacing[1]};
+ min-width: 0;
white-space: nowrap;
`;
export const AiChatInboxBreadcrumb = () => {
- const theme = useTheme();
- const { HeadingIcon, headingLabel } = useAgentChatInboxViewHeading();
-
return (
- <UndecoratedLink to={getAppPath(AppPath.AiChatInbox, { threadId: null })}>
- <StyledBreadcrumb>
- <HeadingIcon size={theme.icon.size.md} />
- {headingLabel}
- <span aria-hidden>/</span>
- </StyledBreadcrumb>
- </UndecoratedLink>
+ <StyledBreadcrumb to={getAppPath(AppPath.AiChatInbox, { threadId: null })}>
+ <AiChatInboxViewHeading />
+ <span aria-hidden>/</span>
+ </StyledBreadcrumb>
);
};
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelToolbar.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelToolbar.tsx
deleted file mode 100644
index 9fb41aa7342..00000000000
--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelToolbar.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { styled } from '@linaria/react';
-import { useLingui } from '@lingui/react/macro';
-import { SegmentedControl } from 'twenty-ui/components/input';
-import { themeCssVariables } from 'twenty-ui/theme';
-
-import { agentChatChannelViewState } from '@/ai/states/agentChatChannelViewState';
-import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
-import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
-import {
- AgentChatChannelAssignmentFilter,
- AgentChatChannelThreadStatus,
-} from '~/generated-metadata/graphql';
-
-const StyledToolbar = styled.div`
- align-items: center;
- border-bottom: 1px solid ${themeCssVariables.border.color.light};
- display: flex;
- flex-wrap: wrap;
- gap: ${themeCssVariables.spacing[2]};
- justify-content: space-between;
- padding: ${themeCssVariables.spacing[2]};
-`;
-
-type AiChatInboxChannelToolbarProps = {
- channelView: AgentChatChannelView;
-};
-
-export const AiChatInboxChannelToolbar = ({
- channelView,
-}: AiChatInboxChannelToolbarProps) => {
- const { t } = useLingui();
- const setAgentChatChannelView = useSetAtomState(agentChatChannelViewState);
-
- return (
- <StyledToolbar>
- <SegmentedControl
- aria-label={t`Status`}
- itemWidth="content"
- value={channelView.channelStatus}
- onValueChange={(channelStatus: AgentChatChannelThreadStatus) =>
- setAgentChatChannelView({ ...channelView, channelStatus })
- }
- options={[
- { value: AgentChatChannelThreadStatus.OPEN, label: t`Open` },
- { value: AgentChatChannelThreadStatus.SNOOZED, label: t`Snoozed` },
- { value: AgentChatChannelThreadStatus.DONE, label: t`Done` },
- ]}
- />
- <SegmentedControl
- aria-label={t`Assignee`}
- itemWidth="content"
- value={channelView.assignment}
- onValueChange={(assignment: AgentChatChannelAssignmentFilter) =>
- setAgentChatChannelView({ ...channelView, assignment })
- }
- options={[
- { value: AgentChatChannelAssignmentFilter.ANY, label: t`All` },
- {
- value: AgentChatChannelAssignmentFilter.UNASSIGNED,
- label: t`Unassigned`,
- },
- {
- value: AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME,
- label: t`Mine`,
- },
- ]}
- />
- </StyledToolbar>
- );
-};
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelViewDropdown.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelViewDropdown.tsx
new file mode 100644
index 00000000000..7c9604865fb
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxChannelViewDropdown.tsx
@@ -0,0 +1,99 @@
+import { useLingui } from '@lingui/react/macro';
+import { useId } from 'react';
+import { IconButton } from 'twenty-ui/components/input';
+import { Dropdown } from 'twenty-ui/components/navigation';
+import { IconFilter } from 'twenty-ui/icon';
+
+import { AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS } from '@/ai/constants/AgentChatChannelNavigationItems';
+import { agentChatChannelViewState } from '@/ai/states/agentChatChannelViewState';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { getAgentChatChannelNavigationItemOrThrow } from '@/ai/utils/getAgentChatChannelNavigationItemOrThrow';
+import { useResetRecordSelection } from '@/object-record/record-selection/hooks/useResetRecordSelection';
+import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';
+import { DropdownRoot } from '@/ui/layout/dropdown/components/DropdownRoot';
+import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
+import { AgentChatChannelAssignmentFilter } from '~/generated-metadata/graphql';
+
+type AiChatInboxChannelViewDropdownProps = {
+ channelView: AgentChatChannelView;
+};
+
+export const AiChatInboxChannelViewDropdown = ({
+ channelView,
+}: AiChatInboxChannelViewDropdownProps) => {
+ const { t } = useLingui();
+ const instanceId = useId();
+ const setAgentChatChannelView = useSetAtomState(agentChatChannelViewState);
+ const { resetRecordSelection } = useResetRecordSelection();
+ const selectedNavigationItem =
+ getAgentChatChannelNavigationItemOrThrow(channelView);
+ const assignmentOptions = [
+ { value: AgentChatChannelAssignmentFilter.ANY, label: t`All` },
+ {
+ value: AgentChatChannelAssignmentFilter.UNASSIGNED,
+ label: t`Unassigned`,
+ },
+ { value: AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME, label: t`Mine` },
+ ];
+
+ const handleAssignmentSelect = (
+ assignment: AgentChatChannelAssignmentFilter,
+ ) => {
+ resetRecordSelection();
+ setAgentChatChannelView({ ...channelView, assignment });
+ };
+
+ const handleViewSelect = ({
+ channelStatus,
+ assignment,
+ }: Pick<AgentChatChannelView, 'channelStatus' | 'assignment'>) => {
+ resetRecordSelection();
+ setAgentChatChannelView({ ...channelView, channelStatus, assignment });
+ };
+
+ return (
+ <DropdownRoot dropdownId={`ai-chat-channel-view-${instanceId}`} type="menu">
+ <Dropdown.Trigger
+ render={
+ <IconButton
+ size="sm"
+ variant="outline"
+ color={
+ channelView.assignment === AgentChatChannelAssignmentFilter.ANY
+ ? 'neutral'
+ : 'accent'
+ }
+ aria-label={t`Filter channel chats`}
+ >
+ <IconFilter />
+ </IconButton>
+ }
+ />
+ <DropdownContent align="end" aria-label={t`Filter channel chats`}>
+ <Dropdown.Section label={t`View`}>
+ {AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.map((navigationItem) => (
+ <Dropdown.OptionItem
+ key={navigationItem.label.id}
+ startIcon={<navigationItem.Icon />}
+ selected={navigationItem === selectedNavigationItem}
+ onSelect={() => handleViewSelect(navigationItem)}
+ >
+ {t(navigationItem.label)}
+ </Dropdown.OptionItem>
+ ))}
+ </Dropdown.Section>
+ <Dropdown.Section label={t`Assignee`}>
+ {assignmentOptions.map(({ value, label }) => (
+ <Dropdown.OptionItem
+ key={value}
+ selected={value === channelView.assignment}
+ onSelect={() => handleAssignmentSelect(value)}
+ >
+ {label}
+ </Dropdown.OptionItem>
+ ))}
+ </Dropdown.Section>
+ </DropdownContent>
+ </DropdownRoot>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx
index ea839fbaa1b..aa164d601c7 100644
--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx
@@ -1,20 +1,22 @@
import { useLingui } from '@lingui/react/macro';
+import { isDefined } from 'twenty-shared/utils';
import { IconPlus } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/primitives/input';
-import { useTheme } from 'twenty-ui/theme';
import { useIsMobile } from 'twenty-ui/utilities';
+import { AiChatInboxChannelViewDropdown } from '@/ai/components/AiChatInboxChannelViewDropdown';
import { AiChatInboxLayoutDropdown } from '@/ai/components/AiChatInboxLayoutDropdown';
import { AiChatInboxTriageCommandMenuItems } from '@/ai/components/AiChatInboxTriageCommandMenuItems';
-import { useAgentChatInboxViewHeading } from '@/ai/hooks/useAgentChatInboxViewHeading';
+import { AiChatInboxViewHeading } from '@/ai/components/AiChatInboxViewHeading';
import { useSwitchToNewAiChat } from '@/ai/hooks/useSwitchToNewAiChat';
+import { agentChatShownChannelViewSelector } from '@/ai/states/selectors/agentChatShownChannelViewSelector';
import { CommandMenuContextProvider } from '@/command-menu-item/contexts/CommandMenuContextProvider';
import { PinnedCommandMenuItemButtons } from '@/command-menu-item/display/components/PinnedCommandMenuItemButtons';
import { CommandMenuItemContainerType } from '@/command-menu-item/types/CommandMenuItemContainerType';
-import { RecordIndexPageHeaderTitle } from '@/object-record/record-index/components/RecordIndexPageHeaderTitle';
import { useResetRecordSelection } from '@/object-record/record-selection/hooks/useResetRecordSelection';
import { SidePanelToggleButton } from '@/side-panel/components/SidePanelToggleButton';
import { PageCardHeader } from '@/ui/layout/page/components/PageCardHeader';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
type AiChatInboxListHeaderProps = {
selectedThreadCount: number;
@@ -26,8 +28,9 @@ export const AiChatInboxListHeader = ({
isSecondaryPaneShown,
}: AiChatInboxListHeaderProps) => {
const { t } = useLingui();
- const theme = useTheme();
- const { HeadingIcon, headingLabel } = useAgentChatInboxViewHeading();
+ const agentChatShownChannelView = useAtomStateValue(
+ agentChatShownChannelViewSelector,
+ );
const isMobile = useIsMobile();
const { switchToNewChat } = useSwitchToNewAiChat({
shouldOpenInFullPage: true,
@@ -39,14 +42,14 @@ export const AiChatInboxListHeader = ({
switchToNewChat();
};
+ const channelViewDropdown = isDefined(agentChatShownChannelView) && (
+ <AiChatInboxChannelViewDropdown channelView={agentChatShownChannelView} />
+ );
+
return (
<PageCardHeader
- icon={<HeadingIcon size={theme.icon.size.md} />}
title={
- <RecordIndexPageHeaderTitle
- label={headingLabel}
- numberOfSelectedRecords={selectedThreadCount}
- />
+ <AiChatInboxViewHeading selectedThreadCount={selectedThreadCount} />
}
actionButton={
selectedThreadCount > 0 ? (
@@ -59,11 +62,13 @@ export const AiChatInboxListHeader = ({
<PinnedCommandMenuItemButtons />
</AiChatInboxTriageCommandMenuItems>
</CommandMenuContextProvider>
+ {channelViewDropdown}
<SidePanelToggleButton />
</>
) : (
<>
{!isMobile && <AiChatInboxLayoutDropdown />}
+ {channelViewDropdown}
<Button
size="sm"
variant="solid"
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxViewHeading.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxViewHeading.tsx
new file mode 100644
index 00000000000..655bee181c1
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxViewHeading.tsx
@@ -0,0 +1,76 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables, useTheme } from 'twenty-ui/theme';
+
+import { useAgentChatInboxViewHeading } from '@/ai/hooks/useAgentChatInboxViewHeading';
+import { useNumberFormat } from '@/localization/hooks/useNumberFormat';
+import { RecordIndexPageHeaderTitle } from '@/object-record/record-index/components/RecordIndexPageHeaderTitle';
+
+const StyledHeading = styled.div`
+ align-items: center;
+ display: flex;
+ gap: ${themeCssVariables.spacing[1]};
+ min-width: 0;
+ white-space: nowrap;
+`;
+
+const StyledChannelHeading = styled(StyledHeading)`
+ font-weight: ${themeCssVariables.font.weight.medium};
+`;
+
+const StyledChannelName = styled.span`
+ color: ${themeCssVariables.font.color.primary};
+ overflow: hidden;
+ text-overflow: ellipsis;
+`;
+
+const StyledChannelView = styled.div`
+ color: ${themeCssVariables.font.color.tertiary};
+`;
+
+type AiChatInboxViewHeadingProps = {
+ selectedThreadCount?: number;
+};
+
+export const AiChatInboxViewHeading = ({
+ selectedThreadCount = 0,
+}: AiChatInboxViewHeadingProps) => {
+ const { t } = useLingui();
+ const theme = useTheme();
+ const { formatNumber } = useNumberFormat();
+ const { HeadingIcon, headingLabel, channelViewLabel } =
+ useAgentChatInboxViewHeading();
+
+ if (!isDefined(channelViewLabel)) {
+ return (
+ <StyledHeading>
+ <HeadingIcon size={theme.icon.size.md} />
+ <RecordIndexPageHeaderTitle
+ label={headingLabel}
+ numberOfSelectedRecords={selectedThreadCount}
+ />
+ </StyledHeading>
+ );
+ }
+
+ return (
+ <StyledChannelHeading>
+ <HeadingIcon
+ size={theme.icon.size.md}
+ color={theme.font.color.tertiary}
+ />
+ <StyledChannelName>{headingLabel}</StyledChannelName>
+ <span aria-hidden>→</span>
+ <StyledChannelView>{channelViewLabel}</StyledChannelView>
+ {selectedThreadCount > 0 && (
+ <>
+ <span aria-hidden>→</span>
+ <StyledChannelView>
+ {t`${formatNumber(selectedThreadCount)} selected`}
+ </StyledChannelView>
+ </>
+ )}
+ </StyledChannelHeading>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelItem.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelItem.tsx
index b78ccc3d3a8..ce337667b33 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelItem.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelItem.tsx
@@ -8,9 +8,9 @@ import { parseThemeColor } from 'twenty-ui/utilities';
import { AgentChatChannelIcon } from '@/ai/components/AgentChatChannelIcon';
import { NavigationDrawerAiChatChannelActionsDropdown } from '@/ai/components/NavigationDrawerAiChatChannelActionsDropdown';
+import { NavigationDrawerAiChatChannelNavigation } from '@/ai/components/NavigationDrawerAiChatChannelNavigation';
import { useAgentChatChannelIcon } from '@/ai/hooks/useAgentChatChannelIcon';
import { useDeleteAgentChatChannel } from '@/ai/hooks/useDeleteAgentChatChannel';
-import { useOpenAgentChatChannel } from '@/ai/hooks/useOpenAgentChatChannel';
import { useUpdateAgentChatChannel } from '@/ai/hooks/useUpdateAgentChatChannel';
import { agentChatShownChannelViewSelector } from '@/ai/states/selectors/agentChatShownChannelViewSelector';
import { type AgentChatChannelSummary } from '@/ai/types/AgentChatChannelSummary';
@@ -20,8 +20,6 @@ import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';
import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown';
import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
import { NavigationDrawerInput } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerInput';
-import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
-import { NavigationDrawerItemEditingContext } from '@/ui/navigation/navigation-drawer/contexts/NavigationDrawerItemEditingContext';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { type AgentChatChannel } from '~/generated-metadata/graphql';
@@ -41,6 +39,7 @@ type NavigationDrawerAiChatChannelItemProps = {
summary: AgentChatChannelSummary | undefined;
destinationChannels: AgentChatChannel[];
canManage: boolean;
+ isExpandable?: boolean;
};
export const NavigationDrawerAiChatChannelItem = ({
@@ -48,6 +47,7 @@ export const NavigationDrawerAiChatChannelItem = ({
summary,
destinationChannels,
canManage,
+ isExpandable = true,
}: NavigationDrawerAiChatChannelItemProps) => {
const { t } = useLingui();
const location = useLocation();
@@ -63,7 +63,6 @@ export const NavigationDrawerAiChatChannelItem = ({
isDropdownOpenComponentState,
dropdownId,
);
- const { openAgentChatChannel } = useOpenAgentChatChannel();
const { updateAgentChatChannel } = useUpdateAgentChatChannel();
const { deleteAgentChatChannel } = useDeleteAgentChatChannel();
const { openDropdown } = useOpenDropdown();
@@ -104,11 +103,6 @@ export const NavigationDrawerAiChatChannelItem = ({
({ id }) => id === deleteDestinationChannelId,
)?.name;
const channelName = channel.name;
- const openCount = summary?.openCount ?? 0;
- const openCountLabel = openCount > 0 ? `${openCount}` : undefined;
- const secondaryLabel = channel.isAccessible
- ? openCountLabel
- : t`Not open to you`;
const coloredIcon = <AgentChatChannelIcon channel={channel} />;
const icon = canManage ? (
@@ -146,50 +140,41 @@ export const NavigationDrawerAiChatChannelItem = ({
return (
<>
- <NavigationDrawerItemEditingContext.Provider
- value={{ icon, label: undefined, isSelected: false }}
- >
- <NavigationDrawerItem
- label={channel.name}
- secondaryLabel={secondaryLabel}
- variant={channel.isAccessible ? 'default' : 'tertiary'}
- isUnread={summary?.hasUnreadOpen}
- active={
- isAiChatInboxPath(location.pathname) &&
- agentChatShownChannelView?.channelId === channel.id
- }
- onClick={
- channel.isAccessible
- ? () => openAgentChatChannel(channel.id)
- : undefined
- }
- triggerEvent="CLICK"
- isRightOptionsDropdownOpen={isDropdownOpen}
- rightOptions={
- canManage || channel.isAccessible ? (
- <NavigationDrawerAiChatChannelActionsDropdown
- channel={channel}
- destinationChannels={destinationChannels}
- dropdownId={dropdownId}
- canManage={canManage}
- onRename={() => setDraftName(channel.name)}
- onChangeAppearance={() =>
- openDropdown({
- dropdownComponentInstanceIdFromProps: iconPickerDropdownId,
- })
- }
- onUpdate={(input) =>
- void updateAgentChatChannel({ channelId: channel.id, input })
- }
- onDelete={(destinationChannelId) => {
- setDeleteDestinationChannelId(destinationChannelId);
- openDialog(deleteDialogId);
- }}
- />
- ) : undefined
- }
- />
- </NavigationDrawerItemEditingContext.Provider>
+ <NavigationDrawerAiChatChannelNavigation
+ channel={channel}
+ summary={summary}
+ icon={icon}
+ channelView={agentChatShownChannelView}
+ isActive={
+ isAiChatInboxPath(location.pathname) &&
+ agentChatShownChannelView?.channelId === channel.id
+ }
+ isExpandable={isExpandable}
+ isRightOptionsDropdownOpen={isDropdownOpen}
+ rightOptions={
+ canManage || channel.isAccessible ? (
+ <NavigationDrawerAiChatChannelActionsDropdown
+ channel={channel}
+ destinationChannels={destinationChannels}
+ dropdownId={dropdownId}
+ canManage={canManage}
+ onRename={() => setDraftName(channel.name)}
+ onChangeAppearance={() =>
+ openDropdown({
+ dropdownComponentInstanceIdFromProps: iconPickerDropdownId,
+ })
+ }
+ onUpdate={(input) =>
+ void updateAgentChatChannel({ channelId: channel.id, input })
+ }
+ onDelete={(destinationChannelId) => {
+ setDeleteDestinationChannelId(destinationChannelId);
+ openDialog(deleteDialogId);
+ }}
+ />
+ ) : undefined
+ }
+ />
<ConfirmationDialog
dialogId={deleteDialogId}
title={t`Delete ${channelName}?`}
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelNavigation.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelNavigation.tsx
new file mode 100644
index 00000000000..dcdc2120b63
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelNavigation.tsx
@@ -0,0 +1,154 @@
+import { useLingui } from '@lingui/react/macro';
+import { type ReactElement, type ReactNode, useId, useState } from 'react';
+import { isDefined } from 'twenty-shared/utils';
+
+import { AgentChatChannelIcon } from '@/ai/components/AgentChatChannelIcon';
+import { AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS } from '@/ai/constants/AgentChatChannelNavigationItems';
+import { useOpenAgentChatChannel } from '@/ai/hooks/useOpenAgentChatChannel';
+import { type AgentChatChannelSummary } from '@/ai/types/AgentChatChannelSummary';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { getAgentChatChannelNavigationItemOrThrow } from '@/ai/utils/getAgentChatChannelNavigationItemOrThrow';
+import { getAgentChatChannelViewKey } from '@/ai/utils/getAgentChatChannelViewKey';
+import { NavigationMenuItemFolderChevron } from '@/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron';
+import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
+import { NavigationDrawerItemGroup } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemGroup';
+import { useIsNavigationDrawerContentExpanded } from '@/ui/navigation/navigation-drawer/hooks/useIsNavigationDrawerContentExpanded';
+import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment';
+import { type AgentChatChannel } from '~/generated-metadata/graphql';
+
+type NavigationDrawerAiChatChannelNavigationProps = {
+ channel: AgentChatChannel;
+ summary?: AgentChatChannelSummary;
+ channelView: AgentChatChannelView | null;
+ isActive: boolean;
+ isExpandable?: boolean;
+ icon?: ReactElement;
+ rightOptions?: ReactNode;
+ isRightOptionsDropdownOpen?: boolean;
+};
+
+export const NavigationDrawerAiChatChannelNavigation = ({
+ channel,
+ summary,
+ channelView,
+ isActive,
+ isExpandable = true,
+ icon,
+ rightOptions,
+ isRightOptionsDropdownOpen,
+}: NavigationDrawerAiChatChannelNavigationProps) => {
+ const { t } = useLingui();
+ const childrenId = useId();
+ const { openAgentChatChannel } = useOpenAgentChatChannel();
+ const isNavigationDrawerContentExpanded =
+ useIsNavigationDrawerContentExpanded();
+ const channelViewKey = isDefined(channelView)
+ ? getAgentChatChannelViewKey(channelView)
+ : null;
+ const [collapsedChannelViewKey, setCollapsedChannelViewKey] = useState<
+ string | null
+ >(null);
+
+ if (
+ isDefined(collapsedChannelViewKey) &&
+ collapsedChannelViewKey !== channelViewKey
+ ) {
+ setCollapsedChannelViewKey(null);
+ }
+
+ const isChannelAccessible = channel.isAccessible ?? false;
+ const isChannelExpandable = isChannelAccessible && isExpandable;
+ const canShowChildren =
+ isChannelExpandable && isNavigationDrawerContentExpanded;
+ const areChildrenVisible =
+ canShowChildren && isActive && collapsedChannelViewKey !== channelViewKey;
+ const selectedItem =
+ isActive && isDefined(channelView)
+ ? getAgentChatChannelNavigationItemOrThrow(channelView)
+ : undefined;
+ const selectedIndex = AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.findIndex(
+ (item) => item === selectedItem,
+ );
+
+ const handleClick = () => {
+ if (!isActive) {
+ setCollapsedChannelViewKey(null);
+ openAgentChatChannel({ channelId: channel.id });
+
+ return;
+ }
+
+ if (!canShowChildren && isDefined(channelView)) {
+ openAgentChatChannel(channelView);
+
+ return;
+ }
+
+ setCollapsedChannelViewKey(areChildrenVisible ? channelViewKey : null);
+ };
+
+ return (
+ <NavigationDrawerItemGroup>
+ <NavigationDrawerItem
+ label={channel.name}
+ secondaryLabel={isChannelAccessible ? undefined : t`Not open to you`}
+ Icon={icon ?? <AgentChatChannelIcon channel={channel} />}
+ variant={isChannelAccessible ? 'default' : 'tertiary'}
+ isUnread={summary?.hasUnreadOpen}
+ active={isActive && !areChildrenVisible}
+ onClick={isChannelAccessible ? handleClick : undefined}
+ triggerEvent="CLICK"
+ preventCollapseOnMobile={canShowChildren}
+ aria-expanded={canShowChildren ? areChildrenVisible : undefined}
+ aria-controls={areChildrenVisible ? childrenId : undefined}
+ trailingIcon={
+ isChannelExpandable ? (
+ <NavigationMenuItemFolderChevron isOpen={areChildrenVisible} />
+ ) : undefined
+ }
+ rightOptions={rightOptions}
+ isRightOptionsDropdownOpen={isRightOptionsDropdownOpen}
+ />
+ {areChildrenVisible && (
+ <div id={childrenId}>
+ {AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.map(
+ (
+ { channelStatus, assignment, label, Icon, countKey, unreadKey },
+ index,
+ ) => {
+ const count = summary?.[countKey];
+
+ return (
+ <NavigationDrawerItem
+ key={`${channelStatus}-${assignment}`}
+ label={t(label)}
+ secondaryLabel={
+ isDefined(count) && count > 0 ? `${count}` : undefined
+ }
+ Icon={Icon}
+ isUnread={isDefined(unreadKey) ? summary?.[unreadKey] : false}
+ active={index === selectedIndex}
+ indentationLevel={2}
+ subItemIndentation="compact"
+ subItemState={getNavigationSubItemLeftAdornment({
+ index,
+ arrayLength: AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.length,
+ selectedIndex,
+ })}
+ onClick={() =>
+ openAgentChatChannel({
+ channelId: channel.id,
+ channelStatus,
+ assignment,
+ })
+ }
+ triggerEvent="CLICK"
+ />
+ );
+ },
+ )}
+ </div>
+ )}
+ </NavigationDrawerItemGroup>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelsSection.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelsSection.tsx
index a747d619e80..9a7655f4f97 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelsSection.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatChannelsSection.tsx
@@ -15,6 +15,7 @@ import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFla
import { CollapsibleNavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection';
import { NavigationDrawerInput } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerInput';
import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
+import { useIsNavigationDrawerContentExpanded } from '@/ui/navigation/navigation-drawer/hooks/useIsNavigationDrawerContentExpanded';
import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { PermissionFlagType } from '~/generated-metadata/graphql';
@@ -38,6 +39,8 @@ export const NavigationDrawerAiChatChannelsSection = () => {
PermissionFlagType.AI_SETTINGS,
);
const { openAgentChatChannel } = useOpenAgentChatChannel();
+ const isNavigationDrawerContentExpanded =
+ useIsNavigationDrawerContentExpanded();
const [newChannelName, setNewChannelName] = useState<string | null>(null);
if (!isDefined(agentChatChannels)) {
@@ -66,7 +69,7 @@ export const NavigationDrawerAiChatChannelsSection = () => {
const channelId = await createAgentChatChannel(trimmedName);
if (isDefined(channelId)) {
- openAgentChatChannel(channelId);
+ openAgentChatChannel({ channelId });
}
};
@@ -118,10 +121,10 @@ export const NavigationDrawerAiChatChannelsSection = () => {
placeholder={t`Channel name`}
/>
) : (
- agentChatAccessibleChannels.length === 0 &&
- canManageChannels && (
+ canManageChannels &&
+ isNavigationDrawerContentExpanded && (
<NavigationDrawerItem
- label={t`New channel`}
+ label={t`Add channel`}
Icon={IconPlus}
variant="tertiary"
onClick={startCreate}
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatFavoritesSection.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatFavoritesSection.tsx
index 8335ab0643d..1735cb30336 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatFavoritesSection.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatFavoritesSection.tsx
@@ -57,6 +57,7 @@ export const NavigationDrawerAiChatFavoritesSection = ({
({ id }) => id !== channel.id,
)}
canManage={canManageChannels}
+ isExpandable={false}
/>
))}
{threads.map((thread) => (
diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInboxChannelViewDropdown.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInboxChannelViewDropdown.stories.tsx
new file mode 100644
index 00000000000..5b2c66f4f32
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/__stories__/AiChatInboxChannelViewDropdown.stories.tsx
@@ -0,0 +1,234 @@
+import { styled } from '@linaria/react';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, userEvent, within } from 'storybook/test';
+import { assertIsDefinedOrThrow } from 'twenty-shared/utils';
+import { ComponentDecorator } from 'twenty-ui/testing';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+import { AiChatInboxChannelViewDropdown } from '@/ai/components/AiChatInboxChannelViewDropdown';
+import { AiChatInboxViewHeading } from '@/ai/components/AiChatInboxViewHeading';
+import { agentChatChannelViewState } from '@/ai/states/agentChatChannelViewState';
+import { agentChatChannelsState } from '@/ai/states/agentChatChannelsState';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState';
+import { NO_RECORD_GROUP_FAMILY_KEY } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector';
+import { RecordSelectionComponentInstanceContext } from '@/object-record/record-selection/states/contexts/RecordSelectionComponentInstanceContext';
+import { isRecordSelectedComponentFamilyState } from '@/object-record/record-selection/states/isRecordSelectedComponentFamilyState';
+import { selectedRecordIdsComponentSelector } from '@/object-record/record-selection/states/selectors/selectedRecordIdsComponentSelector';
+import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
+import {
+ AgentChatChannelAssignmentFilter,
+ AgentChatChannelThreadStatus,
+} from '~/generated-metadata/graphql';
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+
+const RECORD_SELECTION_INSTANCE_ID = 'channel-view-story';
+const SELECTED_THREAD_ID = 'selected-chat';
+const OPEN_VIEW: AgentChatChannelView = {
+ channelId: 'sales',
+ channelStatus: AgentChatChannelThreadStatus.OPEN,
+ assignment: AgentChatChannelAssignmentFilter.ANY,
+};
+
+const StyledHeader = styled.div`
+ align-items: center;
+ background: ${themeCssVariables.background.secondary};
+ display: flex;
+ gap: ${themeCssVariables.spacing[2]};
+ justify-content: space-between;
+ padding: ${themeCssVariables.spacing[3]};
+ width: 480px;
+`;
+
+const ChannelViewStory = () => {
+ const channelView = useAtomStateValue(agentChatChannelViewState);
+ const selectedRecordIds = useAtomComponentSelectorValue(
+ selectedRecordIdsComponentSelector,
+ );
+
+ assertIsDefinedOrThrow(channelView);
+
+ return (
+ <StyledHeader>
+ <AiChatInboxViewHeading selectedThreadCount={selectedRecordIds.length} />
+ <AiChatInboxChannelViewDropdown channelView={channelView} />
+ </StyledHeader>
+ );
+};
+
+const meta = {
+ title: 'Modules/AI/AiChatInboxChannelViewDropdown',
+ component: AiChatInboxChannelViewDropdown,
+ decorators: [
+ (Story) => (
+ <RecordSelectionComponentInstanceContext.Provider
+ value={{ instanceId: RECORD_SELECTION_INSTANCE_ID }}
+ >
+ <Story />
+ </RecordSelectionComponentInstanceContext.Provider>
+ ),
+ ComponentDecorator,
+ MemoryRouterDecorator,
+ ],
+ render: ChannelViewStory,
+ args: { channelView: OPEN_VIEW },
+ parameters: { container: { width: 560, height: 280 } },
+ beforeEach: ({ args }) => {
+ jotaiStore.set(agentChatChannelsState.atom, [
+ {
+ id: OPEN_VIEW.channelId,
+ name: 'Sales',
+ icon: 'IconBrandShopee',
+ color: 'green',
+ isAccessible: true,
+ isCustom: true,
+ position: 1,
+ roleIds: [],
+ },
+ ]);
+ jotaiStore.set(agentChatChannelViewState.atom, args.channelView);
+ jotaiStore.set(
+ recordIndexRecordIdsByGroupComponentFamilyState.atomFamily({
+ instanceId: RECORD_SELECTION_INSTANCE_ID,
+ familyKey: NO_RECORD_GROUP_FAMILY_KEY,
+ }),
+ [SELECTED_THREAD_ID],
+ );
+ jotaiStore.set(
+ isRecordSelectedComponentFamilyState.atomFamily({
+ instanceId: RECORD_SELECTION_INSTANCE_ID,
+ familyKey: SELECTED_THREAD_ID,
+ }),
+ true,
+ );
+
+ return () => {
+ jotaiStore.set(agentChatChannelViewState.atom, null);
+ };
+ },
+} satisfies Meta<typeof AiChatInboxChannelViewDropdown>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Open: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const body = within(canvasElement.ownerDocument.body);
+ const trigger = canvas.getByRole('button', {
+ name: 'Filter channel chats',
+ });
+
+ await expect(canvas.getByText('Sales')).toBeVisible();
+ await expect(canvas.getByText('Open')).toBeVisible();
+ await expect(canvas.getByText('1 selected')).toBeVisible();
+ await userEvent.click(trigger);
+ await expect(
+ await body.findByRole('menuitemradio', { name: 'All' }),
+ ).toHaveAttribute('aria-checked', 'true');
+ await userEvent.click(
+ body.getByRole('menuitemradio', { name: 'Unassigned' }),
+ );
+ await expect(canvas.getByText('Open · Unassigned')).toBeVisible();
+ await expect(canvas.queryByText('1 selected')).not.toBeInTheDocument();
+
+ await userEvent.click(trigger);
+ await expect(
+ await body.findByRole('menuitemradio', { name: 'Unassigned' }),
+ ).toHaveAttribute('aria-checked', 'true');
+ await userEvent.click(body.getByRole('menuitemradio', { name: 'Mine' }));
+ await expect(canvas.getByText('Assigned')).toBeVisible();
+
+ await userEvent.click(trigger);
+ await userEvent.click(
+ await body.findByRole('menuitemradio', { name: 'All' }),
+ );
+ await expect(canvas.getByText('Open')).toBeVisible();
+ await expect(canvas.getByText('Sales')).toBeVisible();
+ },
+};
+
+export const Snoozed: Story = {
+ args: {
+ channelView: {
+ ...OPEN_VIEW,
+ channelStatus: AgentChatChannelThreadStatus.SNOOZED,
+ },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const body = within(canvasElement.ownerDocument.body);
+
+ await expect(canvas.getByText('Snoozed')).toBeVisible();
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Filter channel chats' }),
+ );
+ await userEvent.click(
+ await body.findByRole('menuitemradio', { name: 'Unassigned' }),
+ );
+ await expect(canvas.getByText('Snoozed · Unassigned')).toBeVisible();
+ await expect(canvas.getByText('Sales')).toBeVisible();
+ await expect(canvas.queryByText('1 selected')).not.toBeInTheDocument();
+ },
+};
+
+export const ChannelsLoading: Story = {
+ beforeEach: () => {
+ jotaiStore.set(agentChatChannelsState.atom, null);
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await expect(canvas.getByText('Open')).toBeVisible();
+ await expect(canvas.queryByText('→')).not.toBeInTheDocument();
+ },
+};
+
+export const EveryView: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const body = within(canvasElement.ownerDocument.body);
+ const trigger = canvas.getByRole('button', {
+ name: 'Filter channel chats',
+ });
+
+ await userEvent.click(trigger);
+ await userEvent.click(
+ await body.findByRole('menuitemradio', { name: 'Snoozed' }),
+ );
+ await expect(canvas.getByText('Snoozed')).toBeVisible();
+ await expect(canvas.queryByText('1 selected')).not.toBeInTheDocument();
+
+ await userEvent.click(trigger);
+ await expect(
+ await body.findByRole('menuitemradio', { name: 'Snoozed' }),
+ ).toHaveAttribute('aria-checked', 'true');
+ await userEvent.click(body.getByRole('menuitemradio', { name: 'Mine' }));
+ await expect(canvas.getByText('Snoozed · Mine')).toBeVisible();
+
+ await userEvent.click(trigger);
+ await userEvent.click(
+ await body.findByRole('menuitemradio', { name: 'Done' }),
+ );
+ await expect(canvas.getByText('Done')).toBeVisible();
+
+ await userEvent.click(trigger);
+ await userEvent.click(
+ await body.findByRole('menuitemradio', { name: 'Assigned' }),
+ );
+ await expect(canvas.getByText('Assigned')).toBeVisible();
+
+ await userEvent.click(trigger);
+ await expect(
+ await body.findByRole('menuitemradio', { name: 'Assigned' }),
+ ).toHaveAttribute('aria-checked', 'true');
+ await expect(
+ body.getByRole('menuitemradio', { name: 'Mine' }),
+ ).toHaveAttribute('aria-checked', 'true');
+ await userEvent.click(body.getByRole('menuitemradio', { name: 'Open' }));
+ await expect(canvas.getByText('Open')).toBeVisible();
+ await expect(canvas.getByText('Sales')).toBeVisible();
+ },
+};
diff --git a/packages/twenty-front/src/modules/ai/components/__stories__/NavigationDrawerAiChatChannelNavigation.stories.tsx b/packages/twenty-front/src/modules/ai/components/__stories__/NavigationDrawerAiChatChannelNavigation.stories.tsx
new file mode 100644
index 00000000000..b358eeabb8a
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/components/__stories__/NavigationDrawerAiChatChannelNavigation.stories.tsx
@@ -0,0 +1,367 @@
+import { styled } from '@linaria/react';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { type ComponentProps } from 'react';
+import { expect, fn, userEvent, within } from 'storybook/test';
+import { IconButton } from 'twenty-ui/components/input';
+import { IconDotsVertical } from 'twenty-ui/icon';
+import { Button } from 'twenty-ui/primitives/input';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+import { NavigationDrawerAiChatChannelNavigation } from '@/ai/components/NavigationDrawerAiChatChannelNavigation';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { agentChatChannelViewState } from '@/ai/states/agentChatChannelViewState';
+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
+import { NAVIGATION_DRAWER_CONSTRAINTS } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerConstraints';
+import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
+import {
+ AgentChatChannelAssignmentFilter,
+ AgentChatChannelThreadStatus,
+} from '~/generated-metadata/graphql';
+import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
+import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
+
+const StyledNavigation = styled.div`
+ background: ${themeCssVariables.background.secondary};
+ box-sizing: border-box;
+ padding: ${themeCssVariables.spacing[2]};
+ width: ${NAVIGATION_DRAWER_CONSTRAINTS.default}px;
+`;
+
+const OPEN_VIEW: AgentChatChannelView = {
+ channelId: 'sales',
+ channelStatus: AgentChatChannelThreadStatus.OPEN,
+ assignment: AgentChatChannelAssignmentFilter.ANY,
+};
+
+const OPEN_CHANNEL_LABEL_PATTERN = /^Open\s*·\s*6$/;
+const ASSIGNED_CHANNEL_LABEL_PATTERN = /^Assigned\s*·\s*1$/;
+const INACCESSIBLE_CHANNEL_LABEL_PATTERN = /^Sales\s*·\s*Not open to you$/;
+
+const onOptions = fn();
+
+const CHANNEL_OPTIONS = (
+ <IconButton aria-label="Channel options" onClick={onOptions} size="sm">
+ <IconDotsVertical />
+ </IconButton>
+);
+
+const ChannelNavigationStory = ({
+ channel,
+ summary,
+ isExpandable,
+ rightOptions,
+}: Pick<
+ ComponentProps<typeof NavigationDrawerAiChatChannelNavigation>,
+ 'channel' | 'summary' | 'isExpandable' | 'rightOptions'
+>) => {
+ const channelView = useAtomStateValue(agentChatChannelViewState);
+
+ return (
+ <StyledNavigation>
+ <NavigationDrawerAiChatChannelNavigation
+ channel={channel}
+ summary={summary}
+ channelView={channelView}
+ isActive={channelView?.channelId === channel.id}
+ isExpandable={isExpandable}
+ rightOptions={rightOptions}
+ />
+ </StyledNavigation>
+ );
+};
+
+const meta = {
+ title: 'Modules/AI/NavigationDrawerAiChatChannelNavigation',
+ component: NavigationDrawerAiChatChannelNavigation,
+ decorators: [IconsProviderDecorator, ComponentWithRouterDecorator],
+ render: ChannelNavigationStory,
+ beforeEach: ({ args }) => {
+ jotaiStore.set(isNavigationDrawerExpandedState.atom, true);
+ jotaiStore.set(agentChatChannelViewState.atom, args.channelView);
+
+ return () => {
+ jotaiStore.set(isNavigationDrawerExpandedState.atom, true);
+ jotaiStore.set(agentChatChannelViewState.atom, null);
+ };
+ },
+ args: {
+ channel: {
+ id: 'sales',
+ name: 'Sales',
+ icon: 'IconBrandShopee',
+ color: 'green',
+ isAccessible: true,
+ isCustom: true,
+ position: 1,
+ roleIds: [],
+ },
+ summary: {
+ openCount: 6,
+ hasUnreadOpen: false,
+ assignedToMeCount: 1,
+ hasUnreadAssignedToMe: false,
+ snoozedCount: 0,
+ doneCount: 0,
+ },
+ channelView: OPEN_VIEW,
+ isActive: true,
+ },
+} satisfies Meta<typeof NavigationDrawerAiChatChannelNavigation>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Open: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await expect(
+ canvas.getByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).toHaveAttribute('aria-current', 'true');
+ await userEvent.click(
+ canvas.getByRole('button', { name: ASSIGNED_CHANNEL_LABEL_PATTERN }),
+ );
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual({
+ ...OPEN_VIEW,
+ assignment: AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME,
+ });
+ await expect(
+ canvas.getByRole('button', { name: ASSIGNED_CHANNEL_LABEL_PATTERN }),
+ ).toHaveAttribute('aria-current', 'true');
+ await userEvent.click(canvas.getByRole('button', { name: 'Snoozed' }));
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual({
+ ...OPEN_VIEW,
+ channelStatus: AgentChatChannelThreadStatus.SNOOZED,
+ });
+ await userEvent.click(canvas.getByRole('button', { name: 'Done' }));
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual({
+ ...OPEN_VIEW,
+ channelStatus: AgentChatChannelThreadStatus.DONE,
+ });
+ await userEvent.click(canvas.getByRole('button', { name: 'Sales' }));
+ await expect(
+ canvas.queryByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).not.toBeInTheDocument();
+ await userEvent.click(canvas.getByRole('button', { name: 'Sales' }));
+ await expect(canvas.getByRole('button', { name: 'Done' })).toHaveAttribute(
+ 'aria-current',
+ 'true',
+ );
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual({
+ ...OPEN_VIEW,
+ channelStatus: AgentChatChannelThreadStatus.DONE,
+ });
+ },
+};
+
+export const Collapsed: Story = {
+ args: { channelView: null, isActive: false },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await expect(channel).toHaveAttribute('aria-expanded', 'false');
+ await userEvent.click(channel);
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual(
+ OPEN_VIEW,
+ );
+ await expect(channel).toHaveAttribute('aria-expanded', 'true');
+ },
+};
+
+export const KeyboardAndOptions: Story = {
+ args: {
+ channelView: null,
+ isActive: false,
+ rightOptions: CHANNEL_OPTIONS,
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await userEvent.tab();
+ await expect(channel).toHaveFocus();
+ await userEvent.keyboard('{Enter}');
+ await expect(channel).toHaveAttribute('aria-expanded', 'true');
+ await userEvent.tab();
+ await expect(
+ canvas.getByRole('button', { name: 'Channel options' }),
+ ).toHaveFocus();
+ await userEvent.keyboard(' ');
+ await expect(onOptions).toHaveBeenCalledTimes(1);
+ await expect(channel).toHaveAttribute('aria-expanded', 'true');
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual(
+ OPEN_VIEW,
+ );
+ await userEvent.tab();
+ await expect(
+ canvas.getByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).toHaveFocus();
+ },
+};
+
+export const Assigned: Story = {
+ args: {
+ channelView: {
+ ...OPEN_VIEW,
+ assignment: AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME,
+ },
+ },
+};
+
+export const Unassigned: Story = {
+ args: {
+ channelView: {
+ ...OPEN_VIEW,
+ assignment: AgentChatChannelAssignmentFilter.UNASSIGNED,
+ },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await expect(
+ canvas.getByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).toHaveAttribute('aria-current', 'true');
+ },
+};
+
+export const CollapsedDrawer: Story = {
+ beforeEach: () => {
+ jotaiStore.set(isNavigationDrawerExpandedState.atom, false);
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await expect(channel).toHaveAttribute('aria-current', 'true');
+ await expect(channel).not.toHaveAttribute('aria-expanded');
+ await expect(
+ canvas.queryByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).not.toBeInTheDocument();
+ },
+};
+
+export const Favorite: Story = {
+ args: { isExpandable: false },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await expect(channel).toHaveAttribute('aria-current', 'true');
+ await expect(channel).not.toHaveAttribute('aria-expanded');
+ await userEvent.click(channel);
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toEqual(
+ OPEN_VIEW,
+ );
+ await expect(
+ canvas.queryByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).not.toBeInTheDocument();
+ },
+};
+
+export const SameViewKeepsCollapsed: Story = {
+ render: (args) => (
+ <>
+ <ChannelNavigationStory channel={args.channel} summary={args.summary} />
+ <Button
+ onClick={() =>
+ jotaiStore.set(agentChatChannelViewState.atom, { ...OPEN_VIEW })
+ }
+ >
+ Reselect view
+ </Button>
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await userEvent.click(channel);
+ await expect(channel).toHaveAttribute('aria-expanded', 'false');
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Reselect view' }),
+ );
+ await expect(channel).toHaveAttribute('aria-expanded', 'false');
+ await expect(
+ canvas.queryByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).not.toBeInTheDocument();
+ },
+};
+
+export const Empty: Story = {
+ args: {
+ summary: {
+ openCount: 0,
+ hasUnreadOpen: false,
+ assignedToMeCount: 0,
+ hasUnreadAssignedToMe: false,
+ snoozedCount: 0,
+ doneCount: 0,
+ },
+ },
+};
+
+export const Unread: Story = {
+ args: {
+ summary: {
+ ...meta.args.summary,
+ hasUnreadOpen: true,
+ hasUnreadAssignedToMe: true,
+ },
+ },
+};
+
+export const Inaccessible: Story = {
+ args: {
+ channel: { ...meta.args.channel, isAccessible: false },
+ channelView: null,
+ isActive: false,
+ summary: undefined,
+ rightOptions: CHANNEL_OPTIONS,
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await expect(
+ canvas.queryByRole('button', {
+ name: INACCESSIBLE_CHANNEL_LABEL_PATTERN,
+ }),
+ ).not.toBeInTheDocument();
+ await userEvent.click(canvas.getByText(/Not open to you/));
+ await expect(jotaiStore.get(agentChatChannelViewState.atom)).toBeNull();
+ await userEvent.tab();
+ await expect(
+ canvas.getByRole('button', { name: 'Channel options' }),
+ ).toHaveFocus();
+ await expect(
+ canvas.queryByRole('button', { name: 'Open' }),
+ ).not.toBeInTheDocument();
+ },
+};
+
+export const ReturnToTriage: Story = {
+ args: { channelView: null, isActive: false },
+ render: (args) => (
+ <>
+ <ChannelNavigationStory channel={args.channel} summary={args.summary} />
+ <Button
+ onClick={() => jotaiStore.set(agentChatChannelViewState.atom, null)}
+ >
+ Open triage
+ </Button>
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const channel = canvas.getByRole('button', { name: 'Sales' });
+
+ await userEvent.click(channel);
+ await expect(channel).toHaveAttribute('aria-expanded', 'true');
+ await userEvent.click(canvas.getByRole('button', { name: 'Open triage' }));
+ await expect(channel).toHaveAttribute('aria-expanded', 'false');
+ await expect(
+ canvas.queryByRole('button', { name: OPEN_CHANNEL_LABEL_PATTERN }),
+ ).not.toBeInTheDocument();
+ },
+};
diff --git a/packages/twenty-front/src/modules/ai/constants/AgentChatChannelNavigationItems.ts b/packages/twenty-front/src/modules/ai/constants/AgentChatChannelNavigationItems.ts
new file mode 100644
index 00000000000..bbdd2d669dd
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/constants/AgentChatChannelNavigationItems.ts
@@ -0,0 +1,47 @@
+import { msg } from '@lingui/core/macro';
+import {
+ IconCircleCheck,
+ IconCircleDashed,
+ IconUsers,
+ IconZzz,
+} from 'twenty-ui/icon';
+
+import {
+ AgentChatChannelAssignmentFilter,
+ AgentChatChannelThreadStatus,
+} from '~/generated-metadata/graphql';
+
+export const AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS = [
+ {
+ channelStatus: AgentChatChannelThreadStatus.OPEN,
+ assignment: AgentChatChannelAssignmentFilter.ANY,
+ label: msg`Open`,
+ Icon: IconCircleDashed,
+ countKey: 'openCount',
+ unreadKey: 'hasUnreadOpen',
+ },
+ {
+ channelStatus: AgentChatChannelThreadStatus.OPEN,
+ assignment: AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME,
+ label: msg`Assigned`,
+ Icon: IconUsers,
+ countKey: 'assignedToMeCount',
+ unreadKey: 'hasUnreadAssignedToMe',
+ },
+ {
+ channelStatus: AgentChatChannelThreadStatus.SNOOZED,
+ assignment: AgentChatChannelAssignmentFilter.ANY,
+ label: msg`Snoozed`,
+ Icon: IconZzz,
+ countKey: 'snoozedCount',
+ unreadKey: undefined,
+ },
+ {
+ channelStatus: AgentChatChannelThreadStatus.DONE,
+ assignment: AgentChatChannelAssignmentFilter.ANY,
+ label: msg`Done`,
+ Icon: IconCircleCheck,
+ countKey: 'doneCount',
+ unreadKey: undefined,
+ },
+] as const;
diff --git a/packages/twenty-front/src/modules/ai/graphql/queries/getAgentChatChannelSummaries.ts b/packages/twenty-front/src/modules/ai/graphql/queries/getAgentChatChannelSummaries.ts
index 4dd8b7bedb5..cecc41625e7 100644
--- a/packages/twenty-front/src/modules/ai/graphql/queries/getAgentChatChannelSummaries.ts
+++ b/packages/twenty-front/src/modules/ai/graphql/queries/getAgentChatChannelSummaries.ts
@@ -6,6 +6,10 @@ export const GET_AGENT_CHAT_CHANNEL_SUMMARIES = gql`
channelId
openCount
hasUnreadOpen
+ assignedToMeCount
+ hasUnreadAssignedToMe
+ snoozedCount
+ doneCount
}
}
`;
diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatInboxViewHeading.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatInboxViewHeading.ts
index 1cd684b57e2..590efa4c9cb 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatInboxViewHeading.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatInboxViewHeading.ts
@@ -7,6 +7,7 @@ import { useAgentChatChannelIcon } from '@/ai/hooks/useAgentChatChannelIcon';
import { agentChatChannelsState } from '@/ai/states/agentChatChannelsState';
import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';
import { agentChatShownChannelViewSelector } from '@/ai/states/selectors/agentChatShownChannelViewSelector';
+import { getAgentChatChannelViewLabel } from '@/ai/utils/getAgentChatChannelViewLabel';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
export const useAgentChatInboxViewHeading = () => {
@@ -22,15 +23,32 @@ export const useAgentChatInboxViewHeading = () => {
);
const ChannelIcon = useAgentChatChannelIcon(channel?.icon);
- if (isDefined(agentChatShownChannelView)) {
- return { HeadingIcon: ChannelIcon, headingLabel: channel?.name ?? '' };
+ if (!isDefined(agentChatShownChannelView)) {
+ return {
+ HeadingIcon:
+ AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[agentChatThreadFilterStatus],
+ headingLabel: t(
+ AGENT_CHAT_THREAD_FILTER_STATUS_LABELS[agentChatThreadFilterStatus],
+ ),
+ channelViewLabel: undefined,
+ };
+ }
+
+ const channelViewLabel = getAgentChatChannelViewLabel(
+ agentChatShownChannelView,
+ );
+
+ if (!isDefined(channel)) {
+ return {
+ HeadingIcon: ChannelIcon,
+ headingLabel: channelViewLabel,
+ channelViewLabel: undefined,
+ };
}
return {
- HeadingIcon:
- AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[agentChatThreadFilterStatus],
- headingLabel: t(
- AGENT_CHAT_THREAD_FILTER_STATUS_LABELS[agentChatThreadFilterStatus],
- ),
+ HeadingIcon: ChannelIcon,
+ headingLabel: channel.name,
+ channelViewLabel,
};
};
diff --git a/packages/twenty-front/src/modules/ai/hooks/useOpenAgentChatChannel.ts b/packages/twenty-front/src/modules/ai/hooks/useOpenAgentChatChannel.ts
index 27fa32b7b41..0d8feecdd09 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useOpenAgentChatChannel.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useOpenAgentChatChannel.ts
@@ -1,26 +1,39 @@
import { useStore } from 'jotai';
import { useCallback } from 'react';
import { AppPath } from 'twenty-shared/types';
+import { getAppPath } from 'twenty-shared/utils';
import { agentChatChannelViewState } from '@/ai/states/agentChatChannelViewState';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
import { useNavigateApp } from '~/hooks/useNavigateApp';
import {
AgentChatChannelAssignmentFilter,
AgentChatChannelThreadStatus,
} from '~/generated-metadata/graphql';
+import { isMatchingPathname } from '~/utils/isMatchingPathname';
export const useOpenAgentChatChannel = () => {
const store = useStore();
const navigate = useNavigateApp();
const openAgentChatChannel = useCallback(
- (channelId: string) => {
+ ({
+ channelId,
+ channelStatus = AgentChatChannelThreadStatus.OPEN,
+ assignment = AgentChatChannelAssignmentFilter.ANY,
+ }: Pick<AgentChatChannelView, 'channelId'> &
+ Partial<Pick<AgentChatChannelView, 'channelStatus' | 'assignment'>>) => {
store.set(agentChatChannelViewState.atom, {
channelId,
- channelStatus: AgentChatChannelThreadStatus.OPEN,
- assignment: AgentChatChannelAssignmentFilter.ANY,
+ channelStatus,
+ assignment,
+ });
+ navigate(AppPath.AiChatInbox, { threadId: null }, undefined, {
+ replace: isMatchingPathname(
+ window.location.pathname,
+ getAppPath(AppPath.AiChatInbox, { threadId: null }),
+ ),
});
- navigate(AppPath.AiChatInbox, { threadId: null });
},
[navigate, store],
);
diff --git a/packages/twenty-front/src/modules/ai/hooks/useRefreshAgentChatChannelSummaries.ts b/packages/twenty-front/src/modules/ai/hooks/useRefreshAgentChatChannelSummaries.ts
index 21efdaaf61e..f92eda2f82b 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useRefreshAgentChatChannelSummaries.ts
+++ b/packages/twenty-front/src/modules/ai/hooks/useRefreshAgentChatChannelSummaries.ts
@@ -26,10 +26,7 @@ export const useRefreshAgentChatChannelSummaries = () => {
}
const summariesByChannelId = Object.fromEntries(
- summaries.map(({ channelId, openCount, hasUnreadOpen }) => [
- channelId,
- { openCount, hasUnreadOpen },
- ]),
+ summaries.map(({ channelId, ...summary }) => [channelId, summary]),
);
// Most chat changes leave the counts as they were
diff --git a/packages/twenty-front/src/modules/ai/types/AgentChatChannelSummary.ts b/packages/twenty-front/src/modules/ai/types/AgentChatChannelSummary.ts
index 238d6eb38ee..108dc71a84e 100644
--- a/packages/twenty-front/src/modules/ai/types/AgentChatChannelSummary.ts
+++ b/packages/twenty-front/src/modules/ai/types/AgentChatChannelSummary.ts
@@ -2,5 +2,10 @@ import { type AgentChatChannelSummary as AgentChatChannelSummaryRow } from '~/ge
export type AgentChatChannelSummary = Pick<
AgentChatChannelSummaryRow,
- 'openCount' | 'hasUnreadOpen'
+ | 'openCount'
+ | 'hasUnreadOpen'
+ | 'assignedToMeCount'
+ | 'hasUnreadAssignedToMe'
+ | 'snoozedCount'
+ | 'doneCount'
>;
diff --git a/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelNavigationItemOrThrow.ts b/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelNavigationItemOrThrow.ts
new file mode 100644
index 00000000000..dcf1fed2037
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelNavigationItemOrThrow.ts
@@ -0,0 +1,29 @@
+import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils';
+
+import { AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS } from '@/ai/constants/AgentChatChannelNavigationItems';
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { AgentChatChannelAssignmentFilter } from '~/generated-metadata/graphql';
+
+export const getAgentChatChannelNavigationItemOrThrow = (
+ channelView: Pick<AgentChatChannelView, 'channelStatus' | 'assignment'>,
+) => {
+ const matchingView = AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.find(
+ ({ channelStatus, assignment }) =>
+ channelStatus === channelView.channelStatus &&
+ assignment === channelView.assignment,
+ );
+
+ if (isDefined(matchingView)) {
+ return matchingView;
+ }
+
+ const matchingStatus = AGENT_CHAT_CHANNEL_NAVIGATION_ITEMS.find(
+ ({ channelStatus, assignment }) =>
+ channelStatus === channelView.channelStatus &&
+ assignment === AgentChatChannelAssignmentFilter.ANY,
+ );
+
+ assertIsDefinedOrThrow(matchingStatus);
+
+ return matchingStatus;
+};
diff --git a/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelViewLabel.ts b/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelViewLabel.ts
new file mode 100644
index 00000000000..5e25876186e
--- /dev/null
+++ b/packages/twenty-front/src/modules/ai/utils/getAgentChatChannelViewLabel.ts
@@ -0,0 +1,23 @@
+import { t } from '@lingui/core/macro';
+
+import { type AgentChatChannelView } from '@/ai/types/AgentChatChannelView';
+import { getAgentChatChannelNavigationItemOrThrow } from '@/ai/utils/getAgentChatChannelNavigationItemOrThrow';
+import { AgentChatChannelAssignmentFilter } from '~/generated-metadata/graphql';
+
+export const getAgentChatChannelViewLabel = (
+ channelView: Pick<AgentChatChannelView, 'channelStatus' | 'assignment'>,
+) => {
+ const navigationItem = getAgentChatChannelNavigationItemOrThrow(channelView);
+ const channelStatusLabel = t(navigationItem.label);
+
+ if (channelView.assignment === navigationItem.assignment) {
+ return channelStatusLabel;
+ }
+
+ const assignmentLabel =
+ channelView.assignment === AgentChatChannelAssignmentFilter.UNASSIGNED
+ ? t`Unassigned`
+ : t`Mine`;
+
+ return t`${channelStatusLabel} · ${assignmentLabel}`;
+};
diff --git a/packages/twenty-front/src/modules/ui/navigation/link/components/UndecoratedLink/UndecoratedLink.tsx b/packages/twenty-front/src/modules/ui/navigation/link/components/UndecoratedLink/UndecoratedLink.tsx
index 57626891eb8..51a284a92cc 100644
--- a/packages/twenty-front/src/modules/ui/navigation/link/components/UndecoratedLink/UndecoratedLink.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/link/components/UndecoratedLink/UndecoratedLink.tsx
@@ -1,4 +1,4 @@
-import { css } from '@linaria/core';
+import { css, cx } from '@linaria/core';
import React from 'react';
import { Link } from 'react-router-dom';
@@ -11,6 +11,7 @@ const styles = {
};
type UndecoratedLinkProps = {
+ className?: string;
to: string | number;
children: React.ReactNode;
replace?: boolean;
@@ -19,6 +20,7 @@ type UndecoratedLinkProps = {
};
export const UndecoratedLink = ({
+ className,
children,
to,
replace = false,
@@ -30,7 +32,7 @@ export const UndecoratedLink = ({
to={to as string}
replace={replace}
onClick={onClick}
- className={styles.undecoratedLink}
+ className={cx(styles.undecoratedLink, className)}
style={fullWidth ? { width: '100%' } : undefined}
>
{children}
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
index 2596542f3dc..e7af3ad363b 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
@@ -5,6 +5,7 @@ import { useIsNavigationDrawerContentExpanded } from '@/ui/navigation/navigation
import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';
import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
import { NavigationDrawerItemBreadcrumb } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb';
+import { NavigationDrawerItemIcon } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemIcon';
import { StyledNavigationDrawerUnreadDot } from '@/ui/navigation/navigation-drawer/components/StyledNavigationDrawerUnreadDot';
import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { NavigationDrawerItemEditingContext } from '@/ui/navigation/navigation-drawer/contexts/NavigationDrawerItemEditingContext';
@@ -19,6 +20,7 @@ import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { Link } from 'react-router-dom';
import { isAbsoluteUrl, isDefined } from 'twenty-shared/utils';
+import { doNotTranslate } from 'twenty-shared/i18n';
import { Badge } from 'twenty-ui/primitives/data-display';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
import {
@@ -28,6 +30,9 @@ import {
import { MOBILE_VIEWPORT, useTheme, themeCssVariables } from 'twenty-ui/theme';
import { openUrlInNewTab } from '~/utils/openUrlInNewTab';
const DEFAULT_INDENTATION_LEVEL = 1;
+const INTERACTIVE_OPTIONS_SELECTOR = doNotTranslate(
+ 'button, a, [role="button"]',
+);
type StyledItemProps = Pick<
NavigationDrawerItemProps,
@@ -112,6 +117,11 @@ const StyledItem = styled.button<StyledItemProps>`
: themeCssVariables.font.color.primary};
}
+ &:has(.navigation-drawer-item-label:focus-visible) {
+ outline: 2px solid ${themeCssVariables.color.blue};
+ outline-offset: -2px;
+ }
+
@media (max-width: ${MOBILE_VIEWPORT}px) {
height: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
}
@@ -131,6 +141,10 @@ const StyledLabelParent = styled.div`
overflow: hidden;
text-overflow: clip;
white-space: nowrap;
+
+ &:focus-visible {
+ outline: none;
+ }
`;
const StyledItemLabel = styled.span<{ $isUnread: boolean }>`
@@ -207,11 +221,15 @@ export const NavigationDrawerItem = ({
secondaryLabel,
indentationLevel = DEFAULT_INDENTATION_LEVEL,
Icon,
+ trailingIcon,
+ 'aria-expanded': ariaExpanded,
+ 'aria-controls': ariaControls,
to,
onClick,
active,
modifier,
subItemState,
+ subItemIndentation = 'default',
rightOptions,
alwaysShowRightOptions = false,
isDragging,
@@ -239,6 +257,14 @@ export const NavigationDrawerItem = ({
const showBreadcrumb = indentationLevel === 2;
const showStyledSpacer = isDefined(modifier) || isDefined(rightOptions);
+ const isRowButton =
+ !isDefined(editingContent) &&
+ !isDefined(to) &&
+ isDefined(rightOptions) &&
+ isDefined(onClick);
+ const isRowKeyboardEnabled =
+ isRowButton && !isSoon && variant !== 'placeholder';
+ const ariaCurrentWhenActive = isDefined(to) ? 'page' : true;
const handleMobileNavigation = () => {
if (isMobile && !preventCollapseOnMobile) {
@@ -307,7 +333,11 @@ export const NavigationDrawerItem = ({
handleMouseDown(event);
}}
active={active}
- aria-current={active ? (isDefined(to) ? 'page' : true) : undefined}
+ aria-current={
+ active && !isRowButton ? ariaCurrentWhenActive : undefined
+ }
+ aria-expanded={isRowButton ? undefined : ariaExpanded}
+ aria-controls={isRowButton ? undefined : ariaControls}
isSoon={isSoon}
variant={variant}
disabled={variant === 'placeholder'}
@@ -319,11 +349,6 @@ export const NavigationDrawerItem = ({
isSelectedInEditMode || editingContent?.isSelected
}
as={elementType}
- role={
- !isDefined(editingContent) && !to && isDefined(rightOptions)
- ? 'button'
- : undefined
- }
to={isInternalLink ? to : undefined}
href={isExternalLink ? to : undefined}
target={isExternalLink ? '_blank' : undefined}
@@ -333,7 +358,10 @@ export const NavigationDrawerItem = ({
<StyledItemElementsContainer>
{showBreadcrumb && (
<NavigationDrawerAnimatedCollapseWrapper>
- <NavigationDrawerItemBreadcrumb state={subItemState} />
+ <NavigationDrawerItemBreadcrumb
+ state={subItemState}
+ isCompact={subItemIndentation === 'compact'}
+ />
</NavigationDrawerAnimatedCollapseWrapper>
)}
@@ -342,9 +370,8 @@ export const NavigationDrawerItem = ({
) : (
isDefined(Icon) && (
<StyledIcon>
- <Icon
- size={theme.icon.size.md}
- stroke={theme.icon.stroke.md}
+ <NavigationDrawerItemIcon
+ Icon={Icon}
color={
showBreadcrumb && !isExpanded
? theme.font.color.light
@@ -358,7 +385,35 @@ export const NavigationDrawerItem = ({
)
)}
- <StyledLabelParent>
+ <StyledLabelParent
+ className="navigation-drawer-item-label"
+ role={isRowButton ? 'button' : undefined}
+ tabIndex={isRowKeyboardEnabled ? 0 : undefined}
+ aria-current={
+ active && isRowButton ? ariaCurrentWhenActive : undefined
+ }
+ aria-expanded={isRowButton ? ariaExpanded : undefined}
+ aria-controls={isRowButton ? ariaControls : undefined}
+ onKeyDown={(event) => {
+ const isRowKeyboardActivation =
+ event.target === event.currentTarget &&
+ isRowKeyboardEnabled &&
+ (event.key === 'Enter' || event.key === ' ');
+
+ if (!isRowKeyboardActivation) {
+ return;
+ }
+
+ event.preventDefault();
+
+ if (event.repeat) {
+ return;
+ }
+
+ handleMobileNavigation();
+ onClick?.();
+ }}
+ >
{editingContent?.label ?? (
<OverflowingTextWithTooltip
text={
@@ -417,6 +472,19 @@ export const NavigationDrawerItem = ({
stopPropagation blocks Link's own preventDefault */}
<StyledRightOptionsContainer
onMouseDown={(e) => e.stopPropagation()}
+ onClick={(event) => {
+ const interactiveOption =
+ event.target instanceof Element
+ ? event.target.closest(INTERACTIVE_OPTIONS_SELECTOR)
+ : null;
+ const isClickInsideInteractiveOption =
+ isDefined(interactiveOption) &&
+ event.currentTarget.contains(interactiveOption);
+
+ if (isClickInsideInteractiveOption) {
+ event.stopPropagation();
+ }
+ }}
onClickCapture={(event) => {
const isClickInsideLinkedOptions =
isDefined(to) &&
@@ -442,6 +510,12 @@ export const NavigationDrawerItem = ({
</StyledRightOptionsContainer>
</NavigationDrawerAnimatedCollapseWrapper>
)}
+
+ {isDefined(trailingIcon) && (
+ <NavigationDrawerAnimatedCollapseWrapper>
+ {trailingIcon}
+ </NavigationDrawerAnimatedCollapseWrapper>
+ )}
</StyledItemElementsContainer>
</StyledItem>
</Tooltip>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
index d815d69dea8..98a0fe95da3 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
@@ -2,15 +2,22 @@ import { type NavigationDrawerSubItemState } from '@/ui/navigation/navigation-dr
import { styled } from '@linaria/react';
import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme';
-export type NavigationDrawerItemBreadcrumbProps = {
+type NavigationDrawerItemBreadcrumbProps = {
state?: NavigationDrawerSubItemState;
+ isCompact?: boolean;
};
-const StyledNavigationDrawerItemBreadcrumbContainer = styled.div`
+const StyledNavigationDrawerItemBreadcrumbContainer = styled.div<{
+ isCompact: boolean;
+}>`
height: ${themeCssVariables.spacing[7]};
- margin-inline-end: ${themeCssVariables.spacing[2]};
- margin-inline-start: 7.5px;
+ margin-inline-end: ${({ isCompact }) =>
+ isCompact ? themeCssVariables.spacing[1] : themeCssVariables.spacing[2]};
+ margin-inline-start: ${({ isCompact }) =>
+ isCompact
+ ? themeCssVariables.spacing['1.5']
+ : `calc(${themeCssVariables.spacing[2]} - ${themeCssVariables.spacing['0.5']} / 4)`};
position: relative;
width: 9px;
@@ -71,6 +78,7 @@ const StyledRoundedProtrusion = styled.div<{ darker: boolean }>`
export const NavigationDrawerItemBreadcrumb = ({
state,
+ isCompact = false,
}: NavigationDrawerItemBreadcrumbProps) => {
const showVerticalBar =
state !== 'last-not-selected' && state !== 'last-selected';
@@ -86,7 +94,7 @@ export const NavigationDrawerItemBreadcrumb = ({
state === 'last-selected';
return (
- <StyledNavigationDrawerItemBreadcrumbContainer>
+ <StyledNavigationDrawerItemBreadcrumbContainer isCompact={isCompact}>
<StyledGapVerticalLine darker={gapShouldBeDarker} />
<StyledRoundedProtrusion darker={protrusionShouldBeDarker} />
{showVerticalBar && (
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemIcon.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemIcon.tsx
new file mode 100644
index 00000000000..6f95d8d2f25
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemIcon.tsx
@@ -0,0 +1,28 @@
+import { isValidElement } from 'react';
+import { useTheme } from 'twenty-ui/theme';
+
+import { type NavigationDrawerItemProps } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps';
+
+type NavigationDrawerItemIconProps = {
+ Icon: NonNullable<NavigationDrawerItemProps['Icon']>;
+ color: string;
+};
+
+export const NavigationDrawerItemIcon = ({
+ Icon,
+ color,
+}: NavigationDrawerItemIconProps) => {
+ const theme = useTheme();
+
+ if (isValidElement(Icon)) {
+ return Icon;
+ }
+
+ return (
+ <Icon
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.md}
+ color={color}
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
index fd2909e0d1f..4b288b2f8d9 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
@@ -1,8 +1,11 @@
import { styled } from '@linaria/react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fn, userEvent, within } from 'storybook/test';
import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
-import { IconSearch } from 'twenty-ui/icon';
+import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
+import { IconChevronRight, IconSearch } from 'twenty-ui/icon';
import { CatalogDecorator, type CatalogStory } from 'twenty-ui/testing';
import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator';
import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
@@ -21,6 +24,9 @@ const meta: Meta<typeof NavigationDrawerItem> = {
Icon: IconSearch,
},
argTypes: { Icon: { control: false } },
+ beforeEach: () => {
+ jotaiStore.set(isNavigationDrawerExpandedState.atom, true);
+ },
};
export default meta;
@@ -37,6 +43,23 @@ export const Default: Story = {
],
};
+export const PassiveRightOptions: Story = {
+ decorators: Default.decorators,
+ args: {
+ label: 'Folder',
+ triggerEvent: 'CLICK',
+ rightOptions: <IconChevronRight role="img" aria-label="Expand folder" />,
+ alwaysShowRightOptions: true,
+ onClick: fn(),
+ },
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+
+ await userEvent.click(canvas.getByRole('img', { name: 'Expand folder' }));
+ await expect(args.onClick).toHaveBeenCalledTimes(1);
+ },
+};
+
export const Breadcrumb: Story = {
decorators: [
(Story) => (
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps.ts
index 70302ce78dd..bc90c7e43f5 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps.ts
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/types/NavigationDrawerItemProps.ts
@@ -1,4 +1,4 @@
-import { type JSX, type ReactNode } from 'react';
+import { type JSX, type ReactElement, type ReactNode } from 'react';
import { type IconComponent, type TablerIconsProps } from 'twenty-ui/icon';
import { type NavigationDrawerItemIndentationLevel } from './NavigationDrawerItemIndentationLevel';
import { type NavigationDrawerItemModifier } from './NavigationDrawerItemModifier';
@@ -11,9 +11,16 @@ export type NavigationDrawerItemProps = {
secondaryLabel?: string;
indentationLevel?: NavigationDrawerItemIndentationLevel;
subItemState?: NavigationDrawerSubItemState;
+ subItemIndentation?: 'default' | 'compact';
to?: string;
onClick?: () => void;
- Icon?: IconComponent | ((props: TablerIconsProps) => JSX.Element);
+ Icon?:
+ | IconComponent
+ | ((props: TablerIconsProps) => JSX.Element)
+ | ReactElement;
+ trailingIcon?: ReactNode;
+ 'aria-expanded'?: boolean;
+ 'aria-controls'?: string;
active?: boolean;
modifier?: NavigationDrawerItemModifier;
rightOptions?: ReactNode;
diff --git a/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx b/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx
index 5a76d8bce85..e2d73099c48 100644
--- a/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx
+++ b/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx
@@ -16,7 +16,6 @@ import { AgentChatChannelThreadsFetchMoreTrigger } from '@/ai/components/AgentCh
import { AgentChatChannelThreadsLoadEffect } from '@/ai/components/AgentChatChannelThreadsLoadEffect';
import { AgentChatThreadsFetchMoreTrigger } from '@/ai/components/AgentChatThreadsFetchMoreTrigger';
import { AiChatInboxBreadcrumb } from '@/ai/components/AiChatInboxBreadcrumb';
-import { AiChatInboxChannelToolbar } from '@/ai/components/AiChatInboxChannelToolbar';
import { AiChatInboxCommandMenuScope } from '@/ai/components/AiChatInboxCommandMenuScope';
import { AiChatInboxConversationPane } from '@/ai/components/AiChatInboxConversationPane';
import { AiChatInboxListHeader } from '@/ai/components/AiChatInboxListHeader';
@@ -292,11 +291,6 @@ const AiChatInboxPageContent = () => {
}
>
<StyledListContent>
- {isDefined(agentChatShownChannelView) && (
- <AiChatInboxChannelToolbar
- channelView={agentChatShownChannelView}
- />
- )}
<StyledThreadListContainer ref={threadListContainerRef}>
<StyledThreadList>
{isLoading && threads.length === 0 ? (
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-channel-summary.dto.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-channel-summary.dto.ts
index cd6d89a5c42..cfb2100d722 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-channel-summary.dto.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-channel-summary.dto.ts
@@ -10,6 +10,18 @@ export class AgentChatChannelSummaryDTO {
@Field(() => Int)
openCount: number;
+ @Field(() => Int)
+ assignedToMeCount: number;
+
+ @Field(() => Int)
+ snoozedCount: number;
+
+ @Field(() => Int)
+ doneCount: number;
+
@Field(() => Boolean)
hasUnreadOpen: boolean;
+
+ @Field(() => Boolean)
+ hasUnreadAssignedToMe: boolean;
}
diff --git a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-threads.service.ts b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-threads.service.ts
index 8df8b8b1b1d..e668d45a6c6 100644
--- a/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-threads.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-threads.service.ts
@@ -25,6 +25,9 @@ import { escapeIdentifier } from 'src/engine/workspace-manager/workspace-migrati
const { IS_UNREAD, STATUS } = AGENT_CHAT_CHANNEL_THREAD_PREDICATES;
+const IS_ASSIGNED_TO_ME =
+ 'thread."assigneeId" = :channelThreadsWorkspaceMemberId::uuid';
+
type MemberArgs = Omit<AgentChatThreadAccessArgs, 'threadId'>;
type ReadableThreadsQuery = (readableThreads: {
@@ -35,7 +38,7 @@ type ReadableThreadsQuery = (readableThreads: {
const ASSIGNMENT_FILTERS: Record<AgentChatChannelAssignmentFilter, string> = {
[AgentChatChannelAssignmentFilter.ANY]: '',
[AgentChatChannelAssignmentFilter.UNASSIGNED]: `AND thread."assigneeId" IS NULL`,
- [AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME]: `AND thread."assigneeId" = :channelThreadsWorkspaceMemberId::uuid`,
+ [AgentChatChannelAssignmentFilter.ASSIGNED_TO_ME]: `AND ${IS_ASSIGNED_TO_ME}`,
};
// Computed here because the client cannot load every chat of every channel to sort them
@@ -130,13 +133,21 @@ export class AgentChatChannelThreadsService {
const counts = await this.queryReadableThreads<{
channelId: string;
openCount: number;
+ assignedToMeCount: number;
+ snoozedCount: number;
+ doneCount: number;
hasUnreadOpen: boolean;
+ hasUnreadAssignedToMe: boolean;
}>({
...args,
buildQuery: ({ fromClause, parameters }) => ({
sql: `SELECT thread."channelId",
count(*) FILTER (WHERE ${STATUS.OPEN})::int AS "openCount",
- COALESCE(bool_or(${STATUS.OPEN} AND ${IS_UNREAD}), false) AS "hasUnreadOpen"
+ count(*) FILTER (WHERE ${STATUS.OPEN} AND ${IS_ASSIGNED_TO_ME})::int AS "assignedToMeCount",
+ count(*) FILTER (WHERE ${STATUS.SNOOZED})::int AS "snoozedCount",
+ count(*) FILTER (WHERE ${STATUS.DONE})::int AS "doneCount",
+ COALESCE(bool_or(${STATUS.OPEN} AND ${IS_UNREAD}), false) AS "hasUnreadOpen",
+ COALESCE(bool_or(${STATUS.OPEN} AND ${IS_ASSIGNED_TO_ME} AND ${IS_UNREAD}), false) AS "hasUnreadAssignedToMe"
${fromClause}
AND thread."channelId" = ANY(:channelThreadsChannelIds::uuid[])
GROUP BY thread."channelId"`,
@@ -154,7 +165,12 @@ export class AgentChatChannelThreadsService {
return channels.map(({ id }) => ({
channelId: id,
openCount: countByChannelId.get(id)?.openCount ?? 0,
+ assignedToMeCount: countByChannelId.get(id)?.assignedToMeCount ?? 0,
+ snoozedCount: countByChannelId.get(id)?.snoozedCount ?? 0,
+ doneCount: countByChannelId.get(id)?.doneCount ?? 0,
hasUnreadOpen: countByChannelId.get(id)?.hasUnreadOpen ?? false,
+ hasUnreadAssignedToMe:
+ countByChannelId.get(id)?.hasUnreadAssignedToMe ?? false,
}));
}
diff --git a/packages/twenty-server/test/integration/graphql/suites/chat-channel.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/chat-channel.integration-spec.ts
index 5e650867590..3611d6b567d 100644
--- a/packages/twenty-server/test/integration/graphql/suites/chat-channel.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/chat-channel.integration-spec.ts
@@ -21,6 +21,7 @@ import { waitForAllJobsToFinish } from 'test/integration/utils/wait-for-all-jobs
import { type PostgresAdvisoryLockService } from 'src/database/typeorm/postgres-advisory-lock.service';
import { type AgentChatChannelMetadataService } from 'src/engine/metadata-modules/agent-chat-channel/services/agent-chat-channel-metadata.service';
+import { type AgentChatChannelSummaryDTO } from 'src/engine/metadata-modules/ai/ai-chat/dtos/agent-chat-channel-summary.dto';
import { type UpdateAgentChatChannelInput } from 'src/engine/metadata-modules/ai/ai-chat/dtos/update-agent-chat-channel.input';
import { type AgentChatChannelAccessService } from 'src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-access.service';
import { type AgentChatChannelGrantService } from 'src/engine/metadata-modules/ai/ai-chat/services/agent-chat-channel-grant.service';
@@ -105,7 +106,7 @@ const CHANNEL_THREAD_IDS = parse(
);
const CHANNEL_SUMMARIES = parse(
- `query Summaries { agentChatChannelSummaries { channelId openCount hasUnreadOpen } }`,
+ `query Summaries { agentChatChannelSummaries { channelId openCount assignedToMeCount snoozedCount doneCount hasUnreadOpen hasUnreadAssignedToMe } }`,
);
const OPEN_THREADS_SUMMARY = parse(
@@ -165,9 +166,7 @@ const findChannelThreadIds = async (
const getChannelSummaries = async (
token: string = APPLE_JANE_ADMIN_ACCESS_TOKEN,
-): Promise<
- { channelId: string; openCount: number; hasUnreadOpen: boolean }[]
-> => {
+): Promise<AgentChatChannelSummaryDTO[]> => {
const response = await makeMetadataApiRequest(
{ query: CHANNEL_SUMMARIES },
token,
@@ -768,7 +767,15 @@ describe('Chat channels through the authenticated API', () => {
(await getChannelSummaries(APPLE_JONY_MEMBER_ACCESS_TOKEN)).find(
(summary) => summary.channelId === channelId,
),
- ).toEqual({ channelId, openCount: 1, hasUnreadOpen: true });
+ ).toEqual({
+ channelId,
+ openCount: 1,
+ assignedToMeCount: 0,
+ snoozedCount: 0,
+ doneCount: 0,
+ hasUnreadOpen: true,
+ hasUnreadAssignedToMe: false,
+ });
assertGraphQLSuccessfulResponse(
await updateChannel(channelId, { roleIds: [adminRoleId] }),
@@ -1787,7 +1794,15 @@ describe('Chat channels through the authenticated API', () => {
(await getChannelSummaries(token)).find(
(summary) => summary.channelId === channelId,
),
- ).toEqual({ channelId, openCount: 1, hasUnreadOpen: true });
+ ).toEqual({
+ channelId,
+ openCount: 1,
+ assignedToMeCount: 0,
+ snoozedCount: 0,
+ doneCount: 1,
+ hasUnreadOpen: true,
+ hasUnreadAssignedToMe: false,
+ });
}
// Jane follows both chats she started, so filing one for the channel
@@ -1798,6 +1813,96 @@ describe('Chat channels through the authenticated API', () => {
);
});
+ it('counts each channel status and unread open chats assigned to the requesting member', async () => {
+ const channelId = await createChannel();
+
+ expect(
+ (await getChannelSummaries()).find(
+ (summary) => summary.channelId === channelId,
+ ),
+ ).toEqual({
+ channelId,
+ openCount: 0,
+ assignedToMeCount: 0,
+ snoozedCount: 0,
+ doneCount: 0,
+ hasUnreadOpen: false,
+ hasUnreadAssignedToMe: false,
+ });
+
+ const threadId = await createThreadInChannel(channelId);
+
+ assertGraphQLSuccessfulResponse(
+ await makeMetadataApiRequest({
+ query: ASSIGN,
+ variables: { threadId, assigneeWorkspaceMemberId: JONY },
+ }),
+ );
+ await simulateNewMessageActivity(threadId);
+
+ expect(
+ (await getChannelSummaries()).find(
+ (summary) => summary.channelId === channelId,
+ ),
+ ).toMatchObject({
+ openCount: 1,
+ assignedToMeCount: 0,
+ hasUnreadAssignedToMe: false,
+ });
+ expect(
+ (await getChannelSummaries(APPLE_JONY_MEMBER_ACCESS_TOKEN)).find(
+ (summary) => summary.channelId === channelId,
+ ),
+ ).toEqual({
+ channelId,
+ openCount: 1,
+ assignedToMeCount: 1,
+ snoozedCount: 0,
+ doneCount: 0,
+ hasUnreadOpen: true,
+ hasUnreadAssignedToMe: true,
+ });
+
+ assertGraphQLSuccessfulResponse(
+ await makeMetadataApiRequest({
+ query: SNOOZE_IN_CHANNEL,
+ variables: { threadId, snoozedUntil: buildFutureSnoozedUntil() },
+ }),
+ );
+
+ expect(
+ (await getChannelSummaries(APPLE_JONY_MEMBER_ACCESS_TOKEN)).find(
+ (summary) => summary.channelId === channelId,
+ ),
+ ).toEqual({
+ channelId,
+ openCount: 0,
+ assignedToMeCount: 0,
+ snoozedCount: 1,
+ doneCount: 0,
+ hasUnreadOpen: false,
+ hasUnreadAssignedToMe: false,
+ });
+
+ assertGraphQLSuccessfulResponse(
+ await runThreadMutation('markAgentChatThreadAsDoneInChannel', threadId),
+ );
+
+ expect(
+ (await getChannelSummaries(APPLE_JONY_MEMBER_ACCESS_TOKEN)).find(
+ (summary) => summary.channelId === channelId,
+ ),
+ ).toEqual({
+ channelId,
+ openCount: 0,
+ assignedToMeCount: 0,
+ snoozedCount: 0,
+ doneCount: 1,
+ hasUnreadOpen: false,
+ hasUnreadAssignedToMe: false,
+ });
+ });
+
it('keeps the channel chats of a removed member in their channel', async () => {
const channelId = await createChannel();
const channelThreadId = await createThreadInChannel(
diff --git a/packages/twenty-server/test/integration/upgrade/suites/2-42-workspace-command-1789914239896-migrate-agent-history-to-workspace.integration-spec.ts b/packages/twenty-server/test/integration/upgrade/suites/2-42-workspace-command-1789914239896-migrate-agent-history-to-workspace.integration-spec.ts
index a6cb33a180c..f65aad6b4bc 100644
--- a/packages/twenty-server/test/integration/upgrade/suites/2-42-workspace-command-1789914239896-migrate-agent-history-to-workspace.integration-spec.ts
+++ b/packages/twenty-server/test/integration/upgrade/suites/2-42-workspace-command-1789914239896-migrate-agent-history-to-workspace.integration-spec.ts
@@ -250,8 +250,6 @@ describe('versioned agent history upgrade (integration)', () => {
objectNames: seededHistoryObjectNames,
});
- // Recreate the pre-2.47 state this upgrade rolls back from: the core
- // tables, and the route 2.42 recorded on every workspace it moved
const runner = dataSource.createQueryRunner();
try {
await new DropCoreAgentHistoryTablesFastInstanceCommand().down(runner);
diff --git a/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1790942019632-backfill-agent-chat-thread-inbox-state.integration-spec.ts b/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1790942019632-backfill-agent-chat-thread-inbox-state.integration-spec.ts
index 725888cd77a..46a20600e21 100644
--- a/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1790942019632-backfill-agent-chat-thread-inbox-state.integration-spec.ts
+++ b/packages/twenty-server/test/integration/upgrade/suites/2-46-workspace-command-1790942019632-backfill-agent-chat-thread-inbox-state.integration-spec.ts
@@ -47,6 +47,7 @@ describe('2-46 workspace commands - agent chat thread inbox state (integration)'
let backfillCommand: BackfillAgentChatThreadInboxStateCommand;
let subscriptionsCommand: AddAgentChatThreadSubscriptionsCommand;
let workspaceOrmManager: WorkspaceOrmManager;
+ let seededParticipantColumns: string[];
const sharedThreadId = randomUUID();
const emptyThreadId = randomUUID();
@@ -146,6 +147,18 @@ describe('2-46 workspace commands - agent chat thread inbox state (integration)'
[threadIds],
);
+ const listParticipantColumns = async (): Promise<string[]> => {
+ const columns: { column_name: string }[] =
+ await global.testDataSource.query(
+ `SELECT column_name FROM information_schema.columns
+ WHERE table_schema = $1 AND table_name = 'agentChatThreadParticipant'
+ ORDER BY column_name`,
+ [SCHEMA],
+ );
+
+ return columns.map(({ column_name }) => column_name);
+ };
+
const readOwnerShares = async () => {
const rows: { principalId: string; workspaceMemberId: string }[] =
await global.testDataSource.query(
@@ -175,6 +188,7 @@ describe('2-46 workspace commands - agent chat thread inbox state (integration)'
workspaceOrmManager = getAppProviderByClassName<WorkspaceOrmManager>(
'WorkspaceOrmManager',
);
+ seededParticipantColumns = await listParticipantColumns();
// 2.47 dropped the column the 2.46 commands still read
await global.testDataSource.query(
@@ -292,6 +306,7 @@ describe('2-46 workspace commands - agent chat thread inbox state (integration)'
await global.testDataSource.query(
`ALTER TABLE ${SCHEMA}."agentMessage" DROP COLUMN IF EXISTS "isHidden"`,
);
+ expect(await listParticipantColumns()).toEqual(seededParticipantColumns);
});
it('registers both commands in order for 2.46.0', () => {
diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.json
index 04bb4074eaa..416180f9128 100644
--- a/packages/twenty-ui/docs/public-exports.json
+++ b/packages/twenty-ui/docs/public-exports.json
@@ -306,6 +306,7 @@
"IconChevronsRight": "icon/components/TablerIcons",
"IconChevronUp": "icon/components/TablerIcons",
"IconCircle": "icon/components/TablerIcons",
+ "IconCircleCheck": "icon/components/TablerIcons",
"IconCircleDashed": "icon/components/TablerIcons",
"IconCircleDot": "icon/components/TablerIcons",
"IconCircleOff": "icon/components/TablerIcons",
diff --git a/packages/twenty-ui/generated/icons.docs.json b/packages/twenty-ui/generated/icons.docs.json
index 4efd7608096..e6d6ae510b5 100644
--- a/packages/twenty-ui/generated/icons.docs.json
+++ b/packages/twenty-ui/generated/icons.docs.json
@@ -88,6 +88,7 @@
"IconChevronUp",
"IconChevronsRight",
"IconCircle",
+ "IconCircleCheck",
"IconCircleDashed",
"IconCircleDot",
"IconCircleOff",
diff --git a/packages/twenty-ui/src/icon/components/TablerIcons.ts b/packages/twenty-ui/src/icon/components/TablerIcons.ts
index f30a1a507c3..ddb9891698d 100644
--- a/packages/twenty-ui/src/icon/components/TablerIcons.ts
+++ b/packages/twenty-ui/src/icon/components/TablerIcons.ts
@@ -87,6 +87,7 @@ export {
IconChevronsRight,
IconChevronUp,
IconCircle,
+ IconCircleCheck,
IconCircleDashed,
IconCircleDot,
IconCircleOff,
diff --git a/packages/twenty-ui/src/icon/index.ts b/packages/twenty-ui/src/icon/index.ts
index 079eb764580..6a77d21b1dc 100644
--- a/packages/twenty-ui/src/icon/index.ts
+++ b/packages/twenty-ui/src/icon/index.ts
@@ -143,6 +143,7 @@ export {
IconChevronsRight,
IconChevronUp,
IconCircle,
+ IconCircleCheck,
IconCircleDashed,
IconCircleDot,
IconCircleOff,