The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add a record page layout to the inbox and fit it to phones (#27431)
Félix Malfaitfb5e4eb0b8a0
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsxnew file mode 100644index 00000000000..b3f42b7e91f--- /dev/null+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxBreadcrumb.tsx@@ -0,0 +1,41 @@+import { styled } from '@linaria/react';+import { useLingui } from '@lingui/react/macro';+import { AppPath } from 'twenty-shared/types';+import { getAppPath } from 'twenty-shared/utils';+import { themeCssVariables, useTheme } from 'twenty-ui/theme';++import { AGENT_CHAT_THREAD_FILTER_STATUS_ICONS } from '@/ai/constants/AgentChatThreadFilterStatusIcons';+import { AGENT_CHAT_THREAD_FILTER_STATUS_LABELS } from '@/ai/constants/AgentChatThreadFilterStatusLabels';+import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';+import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink/UndecoratedLink';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';++const StyledBreadcrumb = styled.span`+ align-items: center;+ color: ${themeCssVariables.font.color.tertiary};+ display: flex;+ flex-shrink: 0;+ font-weight: ${themeCssVariables.font.weight.medium};+ gap: ${themeCssVariables.spacing[1]};+ white-space: nowrap;+`;++export const AiChatInboxBreadcrumb = () => {+ const { t } = useLingui();+ const theme = useTheme();+ const agentChatThreadFilterStatus = useAtomStateValue(+ agentChatThreadFilterStatusState,+ );+ const FilterStatusIcon =+ AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[agentChatThreadFilterStatus];++ return (+ <UndecoratedLink to={getAppPath(AppPath.AiChatInbox, { threadId: null })}>+ <StyledBreadcrumb>+ <FilterStatusIcon size={theme.icon.size.md} />+ {t(AGENT_CHAT_THREAD_FILTER_STATUS_LABELS[agentChatThreadFilterStatus])}+ <span aria-hidden>/</span>+ </StyledBreadcrumb>+ </UndecoratedLink>+ );+};diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxLayoutDropdown.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxLayoutDropdown.tsxnew file mode 100644index 00000000000..bd838834175--- /dev/null+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxLayoutDropdown.tsx@@ -0,0 +1,70 @@+import { useLingui } from '@lingui/react/macro';+import { AppPath } from 'twenty-shared/types';+import { IconButton } from 'twenty-ui/components/input';+import { Dropdown } from 'twenty-ui/components/navigation';++import { AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';+import { AI_CHAT_INBOX_LAYOUT_DROPDOWN_ID } from '@/ai/constants/AiChatInboxLayoutDropdownId';+import { AI_CHAT_INBOX_LAYOUT_OPTIONS } from '@/ai/constants/AiChatInboxLayoutOptions';+import { aiChatInboxLayoutState } from '@/ai/states/aiChatInboxLayoutState';+import { type AiChatInboxLayout } from '@/ai/types/AiChatInboxLayout';+import { SelectOptionIcon } from '@/ui/input/components/SelectOptionIcon';+import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';+import { DropdownRoot } from '@/ui/layout/dropdown/components/DropdownRoot';+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';+import { useNavigateApp } from '~/hooks/useNavigateApp';++export const AiChatInboxLayoutDropdown = () => {+ const { t } = useLingui();+ const [aiChatInboxLayout, setAiChatInboxLayout] = useAtomState(+ aiChatInboxLayoutState,+ );+ const navigate = useNavigateApp();+ const LayoutIcon = AI_CHAT_INBOX_LAYOUT_OPTIONS[aiChatInboxLayout].Icon;++ const handleLayoutSelect = (layout: AiChatInboxLayout) => {+ setAiChatInboxLayout(layout);++ // The menu sits on the list, so the list stays on screen instead of the+ // chat open beside it+ if (layout === AI_CHAT_INBOX_LAYOUT.RECORD_PAGE) {+ // oxlint-disable-next-line twenty/no-navigate-prefer-link+ navigate(AppPath.AiChatInbox, { threadId: null });+ }+ };++ return (+ <DropdownRoot dropdownId={AI_CHAT_INBOX_LAYOUT_DROPDOWN_ID} type="menu">+ <Dropdown.Trigger+ render={+ <IconButton+ size="sm"+ variant="outline"+ color="neutral"+ aria-label={t`Open chats in`}+ >+ <LayoutIcon />+ </IconButton>+ }+ />+ <DropdownContent align="end" aria-label={t`Open chats in`}>+ <Dropdown.Section label={t`Open chats in`}>+ {Object.values(AI_CHAT_INBOX_LAYOUT).map((layout) => (+ <Dropdown.OptionItem+ key={layout}+ startIcon={+ <SelectOptionIcon+ Icon={AI_CHAT_INBOX_LAYOUT_OPTIONS[layout].Icon}+ />+ }+ selected={layout === aiChatInboxLayout}+ onSelect={() => handleLayoutSelect(layout)}+ >+ {t(AI_CHAT_INBOX_LAYOUT_OPTIONS[layout].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.tsxindex 79792ffc775..4d8c4998ade 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxListHeader.tsx@@ -2,10 +2,13 @@ import { useLingui } from '@lingui/react/macro';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 { AiChatInboxLayoutDropdown } from '@/ai/components/AiChatInboxLayoutDropdown';import { AiChatInboxTriageCommandMenuItems } from '@/ai/components/AiChatInboxTriageCommandMenuItems';import { AGENT_CHAT_THREAD_FILTER_STATUS_ICONS } from '@/ai/constants/AgentChatThreadFilterStatusIcons';import { AGENT_CHAT_THREAD_FILTER_STATUS_LABELS } from '@/ai/constants/AgentChatThreadFilterStatusLabels';+import { useIsAiChatInboxSplitView } from '@/ai/hooks/useIsAiChatInboxSplitView';import { useSwitchToNewAiChat } from '@/ai/hooks/useSwitchToNewAiChat';import { agentChatThreadFilterStatusState } from '@/ai/states/agentChatThreadFilterStatusState';import { CommandMenuContextProvider } from '@/command-menu-item/contexts/CommandMenuContextProvider';@@ -30,6 +33,8 @@ export const AiChatInboxListHeader = ({);const FilterStatusIcon =AGENT_CHAT_THREAD_FILTER_STATUS_ICONS[agentChatThreadFilterStatus];+ const isMobile = useIsMobile();+ const isSplitView = useIsAiChatInboxSplitView();const { switchToNewChat } = useSwitchToNewAiChat({shouldOpenInFullPage: true,});@@ -59,15 +64,20 @@ export const AiChatInboxListHeader = ({<SidePanelToggleButton /></>) : (- <Button- size="sm"- variant="solid"- color="accent"- startIcon={<IconPlus />}- onClick={switchToNewChat}- >- {t`New chat`}- </Button>+ <>+ {!isMobile && <AiChatInboxLayoutDropdown />}+ <Button+ size="sm"+ variant="solid"+ color="accent"+ startIcon={<IconPlus />}+ onClick={switchToNewChat}+ >+ {t`New chat`}+ </Button>+ {/* In split view the chat beside the list has the command menu */}+ {!isSplitView && <SidePanelToggleButton />}+ </>)}/>diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionEffect.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionEffect.tsxindex bdd26f9f0cc..c90a61a9913 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionEffect.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionEffect.tsx@@ -8,6 +8,8 @@ import { useNavigateApp } from '~/hooks/useNavigateApp';type AiChatInboxSelectionEffectProps = {selectedThreadId: string | undefined;threads: Pick<AgentChatThreadRecord, 'id'>[];+ // Split view always has a chat beside the list; otherwise the list stands alone+ shouldSelectFirstThread: boolean;};// A chat leaves the list when it is done, snoozed or deleted; the one that@@ -15,6 +17,7 @@ type AiChatInboxSelectionEffectProps = {export const AiChatInboxSelectionEffect = ({selectedThreadId,threads,+ shouldSelectFirstThread,}: AiChatInboxSelectionEffectProps) => {const navigate = useNavigateApp();const [lastListedSelection, setLastListedSelection] = useState<{@@ -30,7 +33,7 @@ export const AiChatInboxSelectionEffect = ({});if (!isDefined(selectedThreadId)) {- if (threads.length > 0) {+ if (shouldSelectFirstThread && threads.length > 0) {selectThread(threads[0].id);}@@ -59,7 +62,13 @@ export const AiChatInboxSelectionEffect = ({threads[Math.min(lastListedSelection.index, threads.length - 1)];selectThread(nextThread?.id ?? null);- }, [lastListedSelection, navigate, selectedThreadId, threads]);+ }, [+ lastListedSelection,+ navigate,+ selectedThreadId,+ shouldSelectFirstThread,+ threads,+ ]);return null;};diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionPane.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionPane.tsxindex adba587e3ee..b25cdc792bd 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionPane.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxSelectionPane.tsx@@ -6,9 +6,7 @@ import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme';import { AiChatInboxSelectionPile } from '@/ai/components/AiChatInboxSelectionPile';-import { AiChatInboxSelectionToContextStoreEffect } from '@/ai/components/AiChatInboxSelectionToContextStoreEffect';import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';-import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';import { useResetRecordSelection } from '@/object-record/record-selection/hooks/useResetRecordSelection';import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { EmptyState } from '@/ui/feedback/empty-state/components/EmptyState';@@ -58,11 +56,6 @@ export const AiChatInboxSelectionPane = ({/>}>- {/* The selection takes the place of the chat on screen, so the command- menu acts on it */}- <AiChatInboxSelectionToContextStoreEffect- contextStoreInstanceId={MAIN_CONTEXT_STORE_INSTANCE_ID}- /><StyledSelection><AiChatInboxSelectionPile threads={selectedThreads} /><EmptyState.Content>diff --git a/packages/twenty-front/src/modules/ai/components/AiChatInboxThreadPagination.tsx b/packages/twenty-front/src/modules/ai/components/AiChatInboxThreadPagination.tsxnew file mode 100644index 00000000000..4d5cbef1d29--- /dev/null+++ b/packages/twenty-front/src/modules/ai/components/AiChatInboxThreadPagination.tsx@@ -0,0 +1,79 @@+import { useLingui } from '@lingui/react/macro';+import { isDefined } from 'twenty-shared/utils';+import { IconButton } from 'twenty-ui/components/input';+import { IconChevronDown, IconChevronUp } from 'twenty-ui/icon';++import { useRefreshAgentChatThreads } from '@/ai/hooks/useRefreshAgentChatThreads';+import { agentChatThreadListState } from '@/ai/states/agentChatThreadListState';+import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';++type AiChatInboxThreadPaginationProps = {+ threads: Pick<AgentChatThreadRecord, 'id'>[];+ threadId: string;+ onThreadSelect: (threadId: string) => void;+};++export const AiChatInboxThreadPagination = ({+ threads,+ threadId,+ onThreadSelect,+}: AiChatInboxThreadPaginationProps) => {+ const { t } = useLingui();+ const agentChatThreadList = useAtomStateValue(agentChatThreadListState);+ const { fetchMoreAgentChatThreads } = useRefreshAgentChatThreads();+ const index = threads.findIndex(({ id }) => id === threadId);++ // A chat opened from a link without being listed has no neighbours+ if (index === -1) {+ return null;+ }++ const hasMoreThreads =+ isDefined(agentChatThreadList) && agentChatThreadList.hasNextPage;+ const previousThreadId = index > 0 ? threads[index - 1].id : undefined;+ const nextThreadId =+ index < threads.length - 1 ? threads[index + 1].id : undefined;++ // The list loads more chats as it scrolls, but it is not on screen beside+ // a chat page, so the next button loads them instead+ const handleNextClick = () => {+ if (!isDefined(nextThreadId)) {+ void fetchMoreAgentChatThreads();+ return;+ }++ onThreadSelect(nextThreadId);++ if (index + 1 === threads.length - 1 && hasMoreThreads) {+ void fetchMoreAgentChatThreads();+ }+ };++ return (+ <>+ <IconButton+ size="sm"+ variant="outline"+ color="neutral"+ aria-label={t`Previous chat`}+ disabled={!isDefined(previousThreadId)}+ onClick={() =>+ isDefined(previousThreadId) && onThreadSelect(previousThreadId)+ }+ >+ <IconChevronUp />+ </IconButton>+ <IconButton+ size="sm"+ variant="outline"+ color="neutral"+ aria-label={t`Next chat`}+ disabled={!isDefined(nextThreadId) && !hasMoreThreads}+ onClick={handleNextClick}+ >+ <IconChevronDown />+ </IconButton>+ </>+ );+};diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadListItem.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadListItem.tsxindex 678c23df782..c58748f74ca 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadListItem.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadListItem.tsx@@ -53,14 +53,19 @@ const StyledLeading = styled.div``;// The checkbox takes the avatar's place while the chat is checked, or while-// the row is hovered or focused, so a click on it starts a selection+// the row is hovered or focused; without hover, a tap on the avatar checks itconst StyledCheckboxContainer = styled.div<{ $isChecked: boolean }>`display: ${({ $isChecked }) => ($isChecked ? 'flex' : 'none')};- ${StyledThreadItem}:hover &,${StyledThreadItem}:focus-within & {display: flex;}++ @media (hover: hover) {+ ${StyledThreadItem}:hover & {+ display: flex;+ }+ }`;const StyledAvatarContainer = styled.div<{@@ -69,11 +74,17 @@ const StyledAvatarContainer = styled.div<{}>`display: ${({ $isChecked }) => ($isChecked ? 'none' : 'flex')};- ${StyledThreadItem}:hover &,${StyledThreadItem}:focus-within & {display: ${({ $isCheckable, $isChecked }) =>$isCheckable || $isChecked ? 'none' : 'flex'};}++ @media (hover: hover) {+ ${StyledThreadItem}:hover & {+ display: ${({ $isCheckable, $isChecked }) =>+ $isCheckable || $isChecked ? 'none' : 'flex'};+ }+ }`;const StyledThreadContent = styled.div`@@ -183,16 +194,19 @@ export const AiChatThreadListItem = ({}}}>- <StyledLeading>+ <StyledLeading+ data-select-disable={isDefined(onCheckboxClick) || undefined}+ onClick={+ isDefined(onCheckboxClick)+ ? (event) => {+ event.stopPropagation();+ onCheckboxClick(thread, event);+ }+ : undefined+ }+ >{isDefined(onCheckboxClick) && (- <StyledCheckboxContainer- $isChecked={isChecked}- data-select-disable- onClick={(event) => {- event.stopPropagation();- onCheckboxClick(thread, event);- }}- >+ <StyledCheckboxContainer $isChecked={isChecked}><Checkbox checked={isChecked} aria-label={t`Select chat`} /></StyledCheckboxContainer>)}diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxSelectionEffect.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxSelectionEffect.test.tsxindex 496c4f27804..c493174c898 100644--- a/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxSelectionEffect.test.tsx+++ b/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxSelectionEffect.test.tsx@@ -30,6 +30,7 @@ describe('AiChatInboxSelectionEffect', () => {render(<AiChatInboxSelectionEffectselectedThreadId={undefined}+ shouldSelectFirstThreadthreads={buildThreads(['thread-1', 'thread-2'])}/>,);@@ -41,6 +42,7 @@ describe('AiChatInboxSelectionEffect', () => {const { rerender } = render(<AiChatInboxSelectionEffectselectedThreadId="thread-2"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1', 'thread-2', 'thread-3'])}/>,);@@ -50,6 +52,7 @@ describe('AiChatInboxSelectionEffect', () => {rerender(<AiChatInboxSelectionEffectselectedThreadId="thread-2"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1', 'thread-3'])}/>,);@@ -61,6 +64,7 @@ describe('AiChatInboxSelectionEffect', () => {const { rerender } = render(<AiChatInboxSelectionEffectselectedThreadId="thread-2"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1', 'thread-2'])}/>,);@@ -68,6 +72,7 @@ describe('AiChatInboxSelectionEffect', () => {rerender(<AiChatInboxSelectionEffectselectedThreadId="thread-2"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1'])}/>,);@@ -79,12 +84,17 @@ describe('AiChatInboxSelectionEffect', () => {const { rerender } = render(<AiChatInboxSelectionEffectselectedThreadId="thread-1"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1'])}/>,);rerender(- <AiChatInboxSelectionEffect selectedThreadId="thread-1" threads={[]} />,+ <AiChatInboxSelectionEffect+ selectedThreadId="thread-1"+ shouldSelectFirstThread+ threads={[]}+ />,);expectSelected(null);@@ -94,10 +104,23 @@ describe('AiChatInboxSelectionEffect', () => {render(<AiChatInboxSelectionEffectselectedThreadId="thread-9"+ shouldSelectFirstThreadthreads={buildThreads(['thread-1'])}/>,);expect(navigate).not.toHaveBeenCalled();});++ it('leaves the list alone when no chat is beside it', () => {+ render(+ <AiChatInboxSelectionEffect+ selectedThreadId={undefined}+ shouldSelectFirstThread={false}+ threads={buildThreads(['thread-1', 'thread-2'])}+ />,+ );++ expect(navigate).not.toHaveBeenCalled();+ });});diff --git a/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxThreadPagination.test.tsx b/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxThreadPagination.test.tsxnew file mode 100644index 00000000000..502651f437d--- /dev/null+++ b/packages/twenty-front/src/modules/ai/components/__tests__/AiChatInboxThreadPagination.test.tsx@@ -0,0 +1,123 @@+import { i18n } from '@lingui/core';+import { I18nProvider } from '@lingui/react';+import { fireEvent, render, screen } from '@testing-library/react';+import { Provider as JotaiProvider } from 'jotai';+import { SOURCE_LOCALE } from 'twenty-shared/translations';++import { AiChatInboxThreadPagination } from '@/ai/components/AiChatInboxThreadPagination';+import { agentChatThreadListState } from '@/ai/states/agentChatThreadListState';+import {+ jotaiStore,+ resetJotaiStore,+} from '@/ui/utilities/state/jotai/jotaiStore';+import { messages } from '~/locales/generated/en';++i18n.load({ [SOURCE_LOCALE]: messages });+i18n.activate(SOURCE_LOCALE);++const fetchMoreAgentChatThreads = jest.fn();++jest.mock('@/ai/hooks/useRefreshAgentChatThreads', () => ({+ useRefreshAgentChatThreads: () => ({ fetchMoreAgentChatThreads }),+}));++const THREADS = [{ id: 'thread-1' }, { id: 'thread-2' }, { id: 'thread-3' }];++const renderPagination = ({+ threadId,+ hasNextPage,+ onThreadSelect = jest.fn(),+}: {+ threadId: string;+ hasNextPage: boolean;+ onThreadSelect?: (threadId: string) => void;+}) => {+ jotaiStore.set(agentChatThreadListState.atom, {+ threadIds: THREADS.map(({ id }) => id),+ hasNextPage,+ endCursor: null,+ });++ return render(+ <JotaiProvider store={jotaiStore}>+ <I18nProvider i18n={i18n}>+ <AiChatInboxThreadPagination+ threads={THREADS}+ threadId={threadId}+ onThreadSelect={onThreadSelect}+ />+ </I18nProvider>+ </JotaiProvider>,+ );+};++describe('AiChatInboxThreadPagination', () => {+ beforeEach(() => {+ resetJotaiStore();+ fetchMoreAgentChatThreads.mockClear();+ });++ it('moves to the previous and next chats', () => {+ const onThreadSelect = jest.fn();++ renderPagination({+ threadId: 'thread-2',+ hasNextPage: false,+ onThreadSelect,+ });++ fireEvent.click(screen.getByRole('button', { name: 'Previous chat' }));+ fireEvent.click(screen.getByRole('button', { name: 'Next chat' }));++ expect(onThreadSelect).toHaveBeenCalledTimes(2);+ expect(onThreadSelect).toHaveBeenNthCalledWith(1, 'thread-1');+ expect(onThreadSelect).toHaveBeenNthCalledWith(2, 'thread-3');+ expect(fetchMoreAgentChatThreads).not.toHaveBeenCalled();+ });++ it('stops at the last chat once every chat is loaded', () => {+ renderPagination({ threadId: 'thread-3', hasNextPage: false });++ expect(screen.getByRole('button', { name: 'Next chat' })).toBeDisabled();+ });++ it('loads more chats when moving onto the last loaded one', () => {+ const onThreadSelect = jest.fn();++ renderPagination({+ threadId: 'thread-2',+ hasNextPage: true,+ onThreadSelect,+ });++ fireEvent.click(screen.getByRole('button', { name: 'Next chat' }));++ expect(onThreadSelect).toHaveBeenCalledTimes(1);+ expect(onThreadSelect).toHaveBeenCalledWith('thread-3');+ expect(fetchMoreAgentChatThreads).toHaveBeenCalledTimes(1);+ });++ it('loads more chats from the last loaded one while more exist', () => {+ const onThreadSelect = jest.fn();++ renderPagination({+ threadId: 'thread-3',+ hasNextPage: true,+ onThreadSelect,+ });++ fireEvent.click(screen.getByRole('button', { name: 'Next chat' }));++ expect(onThreadSelect).not.toHaveBeenCalled();+ expect(fetchMoreAgentChatThreads).toHaveBeenCalledTimes(1);+ });++ it('shows nothing for a chat that is not listed', () => {+ const { container } = renderPagination({+ threadId: 'thread-4',+ hasNextPage: false,+ });++ expect(container).toBeEmptyDOMElement();+ });+});diff --git a/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayout.ts b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayout.tsnew file mode 100644index 00000000000..4d82846eca7--- /dev/null+++ b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayout.ts@@ -0,0 +1,4 @@+export const AI_CHAT_INBOX_LAYOUT = {+ SPLIT_VIEW: 'split-view',+ RECORD_PAGE: 'record-page',+} as const;diff --git a/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutDropdownId.ts b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutDropdownId.tsnew file mode 100644index 00000000000..40633174215--- /dev/null+++ b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutDropdownId.ts@@ -0,0 +1 @@+export const AI_CHAT_INBOX_LAYOUT_DROPDOWN_ID = 'ai-chat-inbox-layout-dropdown';diff --git a/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutOptions.ts b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutOptions.tsnew file mode 100644index 00000000000..5083f12e3dc--- /dev/null+++ b/packages/twenty-front/src/modules/ai/constants/AiChatInboxLayoutOptions.ts@@ -0,0 +1,24 @@+import { type MessageDescriptor } from '@lingui/core';+import { msg } from '@lingui/core/macro';+import {+ IconAddressBook,+ type IconComponent,+ IconLayoutSidebarRight,+} from 'twenty-ui/icon';++import { AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';+import { type AiChatInboxLayout } from '@/ai/types/AiChatInboxLayout';++export const AI_CHAT_INBOX_LAYOUT_OPTIONS: Record<+ AiChatInboxLayout,+ { Icon: IconComponent; label: MessageDescriptor }+> = {+ [AI_CHAT_INBOX_LAYOUT.SPLIT_VIEW]: {+ Icon: IconLayoutSidebarRight,+ label: msg`Split view`,+ },+ [AI_CHAT_INBOX_LAYOUT.RECORD_PAGE]: {+ Icon: IconAddressBook,+ label: msg`Record page`,+ },+};diff --git a/packages/twenty-front/src/modules/ai/hooks/useIsAiChatInboxSplitView.ts b/packages/twenty-front/src/modules/ai/hooks/useIsAiChatInboxSplitView.tsnew file mode 100644index 00000000000..ece91b49f0b--- /dev/null+++ b/packages/twenty-front/src/modules/ai/hooks/useIsAiChatInboxSplitView.ts@@ -0,0 +1,13 @@+import { useIsMobile } from 'twenty-ui/utilities';++import { AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';+import { aiChatInboxLayoutState } from '@/ai/states/aiChatInboxLayoutState';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';++// A phone has room for the list or a chat, never both+export const useIsAiChatInboxSplitView = () => {+ const isMobile = useIsMobile();+ const aiChatInboxLayout = useAtomStateValue(aiChatInboxLayoutState);++ return !isMobile && aiChatInboxLayout === AI_CHAT_INBOX_LAYOUT.SPLIT_VIEW;+};diff --git a/packages/twenty-front/src/modules/ai/states/aiChatInboxLayoutState.ts b/packages/twenty-front/src/modules/ai/states/aiChatInboxLayoutState.tsnew file mode 100644index 00000000000..d5ef237fe09--- /dev/null+++ b/packages/twenty-front/src/modules/ai/states/aiChatInboxLayoutState.ts@@ -0,0 +1,12 @@+import { AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';+import { type AiChatInboxLayout } from '@/ai/types/AiChatInboxLayout';+import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState';++export const aiChatInboxLayoutState = createAtomState<AiChatInboxLayout>({+ key: 'aiChatInboxLayoutState',+ defaultValue: AI_CHAT_INBOX_LAYOUT.SPLIT_VIEW,+ useLocalStorage: true,+ localStorageOptions: { getOnInit: true },+ validateInitFn: (layout) =>+ Object.values(AI_CHAT_INBOX_LAYOUT).includes(layout),+});diff --git a/packages/twenty-front/src/modules/ai/types/AiChatInboxLayout.ts b/packages/twenty-front/src/modules/ai/types/AiChatInboxLayout.tsnew file mode 100644index 00000000000..b5d8b16bd34--- /dev/null+++ b/packages/twenty-front/src/modules/ai/types/AiChatInboxLayout.ts@@ -0,0 +1,4 @@+import { type AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';++export type AiChatInboxLayout =+ (typeof AI_CHAT_INBOX_LAYOUT)[keyof typeof AI_CHAT_INBOX_LAYOUT];diff --git a/packages/twenty-front/src/modules/context-store/components/RouteContextStoreProvider.tsx b/packages/twenty-front/src/modules/context-store/components/RouteContextStoreProvider.tsxindex 6688d67f00c..ec989692473 100644--- a/packages/twenty-front/src/modules/context-store/components/RouteContextStoreProvider.tsx+++ b/packages/twenty-front/src/modules/context-store/components/RouteContextStoreProvider.tsx@@ -64,11 +64,11 @@ export const RouteContextStoreProvider = () => {AppPath.WorkflowCoreShowPage,);const routeParams = matchRoutes(routeObjects, location)?.at(-1)?.params;- // A chat on screen, full page or in the inbox, is the record page of the chat+ // The chat page and the whole inbox act on chats: the chat on screen, or+ // the chats selected in the inbox listconst isAiChatPage =isMatchingLocation(location, AppPath.AiChat) ||- (isMatchingLocation(location, AppPath.AiChatInbox) &&- isDefined(routeParams?.threadId));+ isMatchingLocation(location, AppPath.AiChatInbox);const isRecordShowPage =isCoreWorkflowShowPage ||isAiChatPage ||diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowPageShell.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowPageShell.tsxindex 28375b0e6a5..68740dbf3da 100644--- a/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowPageShell.tsx+++ b/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowPageShell.tsx@@ -29,6 +29,7 @@ type RecordShowPageShellProps = {loading: boolean;error?: ErrorLike;headerActions?: ReactNode;+ headerTitlePrefix?: ReactNode;headerTitleAccessory?: ReactNode;headerTitleMode?: RecordShowPageHeaderTitleMode;isRecordIdentifierBarHidden?: boolean;@@ -41,6 +42,7 @@ export const RecordShowPageShell = ({loading,error,headerActions,+ headerTitlePrefix,headerTitleAccessory,headerTitleMode,isRecordIdentifierBarHidden = false,@@ -90,15 +92,16 @@ export const RecordShowPageShell = ({objectNameSingular={objectNameSingular}objectRecordId={objectRecordId}titleMode={headerTitleMode}+ titlePrefix={headerTitlePrefix}titleAccessory={headerTitleAccessory}>{!isInSidePanel && (<><RecordShowCommandMenu />+ {headerActions}{!isLayoutCustomizationModeEnabled && (<SidePanelToggleButton />)}- {headerActions}</>)}</RecordShowPageHeader>diff --git a/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx b/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsxindex ab16a103844..17042b22038 100644--- a/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx+++ b/packages/twenty-front/src/pages/ai-chat/AiChatInboxPage.tsx@@ -10,14 +10,19 @@ import { useIsMobile } from 'twenty-ui/utilities';import { SkeletonLoader } from '@/activities/components/SkeletonLoader';import { AgentChatThreadsFetchMoreTrigger } from '@/ai/components/AgentChatThreadsFetchMoreTrigger';-import { AiChatInboxSelectionEffect } from '@/ai/components/AiChatInboxSelectionEffect';+import { AiChatInboxBreadcrumb } from '@/ai/components/AiChatInboxBreadcrumb';import { AiChatInboxCommandMenuScope } from '@/ai/components/AiChatInboxCommandMenuScope';import { AiChatInboxListHeader } from '@/ai/components/AiChatInboxListHeader';+import { AiChatInboxSelectionEffect } from '@/ai/components/AiChatInboxSelectionEffect';import { AiChatInboxSelectionPane } from '@/ai/components/AiChatInboxSelectionPane';+import { AiChatInboxSelectionToContextStoreEffect } from '@/ai/components/AiChatInboxSelectionToContextStoreEffect';import { AiChatInboxThreadList } from '@/ai/components/AiChatInboxThreadList';+import { AiChatInboxThreadPagination } from '@/ai/components/AiChatInboxThreadPagination';import { useChatThreads } from '@/ai/hooks/useChatThreads';+import { useIsAiChatInboxSplitView } from '@/ai/hooks/useIsAiChatInboxSplitView';import { agentChatVisibleThreadsSelector } from '@/ai/states/selectors/agentChatVisibleThreadsSelector';import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';+import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';import { RecordSelectionDragSelect } from '@/object-record/record-selection/components/RecordSelectionDragSelect';import { RecordSelectionRecordIdsEffect } from '@/object-record/record-selection/components/RecordSelectionRecordIdsEffect';import { useResetRecordSelection } from '@/object-record/record-selection/hooks/useResetRecordSelection';@@ -64,6 +69,7 @@ const StyledThreadList = styled.div`const AiChatInboxPageContent = () => {const { t } = useLingui();const isMobile = useIsMobile();+ const isSplitView = useIsAiChatInboxSplitView();const navigate = useNavigateApp();const { threadId } = useParams();const selectedThreadId =@@ -86,7 +92,13 @@ const AiChatInboxPageContent = () => {{ id }: AgentChatThreadRecord,event: MouseEvent<HTMLDivElement>,) => {- // A phone shows the list or a chat, with no room for the selection pane+ // A phone has no modifier keys, so once a selection is started a tap+ // adds to it+ if (isMobile && selectedRecordIds.length > 0) {+ toggleRecordSelection({ recordId: id });+ return;+ }+if (isMobile || (!event.metaKey && !event.ctrlKey && !event.shiftKey)) {resetRecordSelection();selectThread(id);@@ -113,27 +125,38 @@ const AiChatInboxPageContent = () => {toggleRecordSelection({ recordId: id, shouldSelectRange: event.shiftKey });const isSelectionShown = selectedRecordIds.length > 0;++ // Split view shows the list beside the chat or the selection; otherwise+ // the list and a chat each take the whole page+ const isListShown = isSplitView || !isDefined(selectedThreadId);+ const isSelectionPaneShown = isSplitView && isSelectionShown;+ const isThreadShown = isDefined(selectedThreadId) && !isSelectionPaneShown;+ const isEmptyPaneShown =+ isSplitView && !isDefined(selectedThreadId) && !isSelectionShown;+const openThreadIds =isDefined(selectedThreadId) && !isSelectionShown ? [selectedThreadId] : [];- // A phone has room for the list or the chat, not both- const isListShown = !isMobile || !isDefined(selectedThreadId);- const isThreadShown = !isMobile || isDefined(selectedThreadId);-return (<StyledInbox><RecordSelectionRecordIdsEffect records={threads} />- {!isMobile && (- <AiChatInboxSelectionEffect- selectedThreadId={selectedThreadId}- threads={threads}+ <AiChatInboxSelectionEffect+ selectedThreadId={selectedThreadId}+ threads={threads}+ shouldSelectFirstThread={isSplitView}+ />+ {/* The selection takes the place of the chat on screen, so the command+ menu acts on it */}+ {isSelectionShown && !isThreadShown && (+ <AiChatInboxSelectionToContextStoreEffect+ contextStoreInstanceId={MAIN_CONTEXT_STORE_INSTANCE_ID}/>)}<AiChatInboxCommandMenuScope>{isListShown && (- <StyledListPane $isFullWidth={isMobile}>+ <StyledListPane $isFullWidth={!isSplitView}><PageCardLayout- showInformationBanner={isMobile}+ showInformationBanner={!isSplitView}header={<AiChatInboxListHeaderselectedThreadCount={selectedRecordIds.length}@@ -160,9 +183,7 @@ const AiChatInboxPageContent = () => {selectedThreadIds={openThreadIds}checkedThreadIds={selectedRecordIds}onThreadClick={handleThreadClick}- onThreadCheckboxClick={- isMobile ? undefined : handleThreadCheckboxClick- }+ onThreadCheckboxClick={handleThreadCheckboxClick}/>)}<AgentChatThreadsFetchMoreTrigger />@@ -176,7 +197,7 @@ const AiChatInboxPageContent = () => {</PageCardLayout></StyledListPane>)}- {isThreadShown && isSelectionShown && (+ {isSelectionPaneShown && (<AiChatInboxSelectionPaneselectedThreads={threads.filter(({ id }) =>selectedRecordIds.includes(id),@@ -184,36 +205,44 @@ const AiChatInboxPageContent = () => {/>)}</AiChatInboxCommandMenuScope>- {isThreadShown &&- !isSelectionShown &&- (isDefined(selectedThreadId) ? (- <>- <AiChatPageEffects />- <AiChatThreadPageContent- threadId={selectedThreadId}- headerActions={- isMobile && (- <IconButton- size="sm"- variant="outline"- onClick={() => selectThread(null)}- aria-label={t`Back to inbox`}- >- <IconChevronLeft />- </IconButton>- )- }- />- </>- ) : (- <PageCardLayout header={<PageCardHeader />}>- <EmptyState.Root>- <EmptyState.Content>- <EmptyState.Title>{t`No conversation selected`}</EmptyState.Title>- </EmptyState.Content>- </EmptyState.Root>- </PageCardLayout>- ))}+ {isThreadShown && (+ <>+ <AiChatPageEffects />+ <AiChatThreadPageContent+ threadId={selectedThreadId}+ headerTitlePrefix={+ !isSplitView && !isMobile && <AiChatInboxBreadcrumb />+ }+ headerActions={+ isMobile ? (+ <IconButton+ size="sm"+ variant="outline"+ onClick={() => selectThread(null)}+ aria-label={t`Back to inbox`}+ >+ <IconChevronLeft />+ </IconButton>+ ) : (+ <AiChatInboxThreadPagination+ threads={threads}+ threadId={selectedThreadId}+ onThreadSelect={selectThread}+ />+ )+ }+ />+ </>+ )}+ {isEmptyPaneShown && (+ <PageCardLayout header={<PageCardHeader />}>+ <EmptyState.Root>+ <EmptyState.Content>+ <EmptyState.Title>{t`No conversation selected`}</EmptyState.Title>+ </EmptyState.Content>+ </EmptyState.Root>+ </PageCardLayout>+ )}</StyledInbox>);};diff --git a/packages/twenty-front/src/pages/ai-chat/AiChatThreadPageContent.tsx b/packages/twenty-front/src/pages/ai-chat/AiChatThreadPageContent.tsxindex 74c931ed112..a0f977cc454 100644--- a/packages/twenty-front/src/pages/ai-chat/AiChatThreadPageContent.tsx+++ b/packages/twenty-front/src/pages/ai-chat/AiChatThreadPageContent.tsx@@ -7,12 +7,14 @@ import { RecordShowPageContent } from '~/pages/object-record/RecordShowPageContetype AiChatThreadPageContentProps = {threadId: string;headerActions?: ReactNode;+ headerTitlePrefix?: ReactNode;};// A chat is its record page, full page, in the inbox or in the side panelexport const AiChatThreadPageContent = ({threadId,headerActions,+ headerTitlePrefix,}: AiChatThreadPageContentProps) => (<RecordShowPageContentparameters={{@@ -20,6 +22,7 @@ export const AiChatThreadPageContent = ({objectRecordId: threadId,}}headerActions={headerActions}+ headerTitlePrefix={headerTitlePrefix}headerTitleAccessory={<AiChatThreadDetailsDropdown threadId={threadId} />}headerTitleMode="record-title"isRecordIdentifierBarHiddendiff --git a/packages/twenty-front/src/pages/ai-chat/__tests__/AiChatInboxPage.test.tsx b/packages/twenty-front/src/pages/ai-chat/__tests__/AiChatInboxPage.test.tsxindex d4f7097eca4..d12073389e6 100644--- a/packages/twenty-front/src/pages/ai-chat/__tests__/AiChatInboxPage.test.tsx+++ b/packages/twenty-front/src/pages/ai-chat/__tests__/AiChatInboxPage.test.tsx@@ -1,6 +1,7 @@import { i18n } from '@lingui/core';import { I18nProvider } from '@lingui/react';import { fireEvent, render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';import { atom, Provider as JotaiProvider } from 'jotai';import { type ReactNode } from 'react';import { MemoryRouter, Route, Routes } from 'react-router-dom';@@ -13,6 +14,8 @@ import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainCoimport { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState';import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';import { AI_CHAT_INBOX_INSTANCE_ID } from '@/ai/constants/AiChatInboxInstanceId';+import { AI_CHAT_INBOX_LAYOUT } from '@/ai/constants/AiChatInboxLayout';+import { aiChatInboxLayoutState } from '@/ai/states/aiChatInboxLayoutState';import { type AgentChatThreadRecord } from '@/ai/types/AgentChatThreadRecord';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';@@ -106,6 +109,10 @@ jest.mock('@/ai/components/AgentChatThreadsFetchMoreTrigger', () => ({AgentChatThreadsFetchMoreTrigger: () => null,}));+jest.mock('@/ai/hooks/useRefreshAgentChatThreads', () => ({+ useRefreshAgentChatThreads: () => ({ fetchMoreAgentChatThreads: jest.fn() }),+}));+jest.mock('@/ai/hooks/useSwitchToNewAiChat', () => ({useSwitchToNewAiChat: () => ({ switchToNewChat: jest.fn() }),}));@@ -115,11 +122,30 @@ jest.mock('~/pages/ai-chat/AiChatPageEffects', () => ({}));jest.mock('~/pages/ai-chat/AiChatThreadPageContent', () => ({- AiChatThreadPageContent: ({ threadId }: { threadId: string }) => (- <div>Chat page {threadId}</div>+ AiChatThreadPageContent: ({+ threadId,+ headerTitlePrefix,+ headerActions,+ }: {+ threadId: string;+ headerTitlePrefix?: ReactNode;+ headerActions?: ReactNode;+ }) => (+ <div>+ {headerTitlePrefix}+ Chat page {threadId}+ {headerActions}+ </div>),}));+let isMobile = false;++jest.mock('twenty-ui/utilities', () => ({+ ...jest.requireActual('twenty-ui/utilities'),+ useIsMobile: () => isMobile,+}));+jest.mock('@/information-banner/components/InformationBannerWrapper', () => ({InformationBannerWrapper: () => null,}));@@ -143,11 +169,11 @@ jest.mock(const [firstThread, secondThread, thirdThread] = THREADS;-const renderInbox = () =>+const renderInbox = (path = `/inbox/${firstThread.id}`) =>render(<JotaiProvider store={jotaiStore}><I18nProvider i18n={i18n}>- <MemoryRouter initialEntries={[`/inbox/${firstThread.id}`]}>+ <MemoryRouter initialEntries={[path]}><Routes><Route path={AppPath.AiChatInbox} element={<AiChatInboxPage />} /></Routes>@@ -173,6 +199,7 @@ const getTargetedThreadIds = (contextStoreInstanceId: string) =>describe('AiChatInboxPage', () => {beforeEach(() => {resetJotaiStore();+ isMobile = false;});it('opens the clicked chat', () => {@@ -326,4 +353,114 @@ describe('AiChatInboxPage', () => {expect(screen.getByText(`Chat page ${firstThread.id}`)).toBeInTheDocument();expect(getRowCheckbox('Second chat')).not.toBeChecked();});++ it('switches to the record page layout from the list header', async () => {+ renderInbox();++ await userEvent.click(+ screen.getByRole('button', { name: 'Open chats in' }),+ );+ await userEvent.click(await screen.findByText('Record page'));++ expect(jotaiStore.get(aiChatInboxLayoutState.atom)).toBe(+ AI_CHAT_INBOX_LAYOUT.RECORD_PAGE,+ );+ expect(screen.queryByText(/Chat page/)).not.toBeInTheDocument();+ expect(+ screen.getByRole('button', { name: 'First chat' }),+ ).toBeInTheDocument();+ });++ describe('in record page layout', () => {+ beforeEach(() => {+ jotaiStore.set(+ aiChatInboxLayoutState.atom,+ AI_CHAT_INBOX_LAYOUT.RECORD_PAGE,+ );+ });++ it('shows the list alone, then the clicked chat alone', () => {+ renderInbox('/inbox');++ expect(screen.queryByText(/Chat page/)).not.toBeInTheDocument();+ expect(+ screen.queryByText('No conversation selected'),+ ).not.toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Second chat' }));++ expect(+ screen.getByText(`Chat page ${secondThread.id}`),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole('button', { name: 'First chat' }),+ ).not.toBeInTheDocument();+ });++ it('moves between chats and back to the list from the chat', () => {+ renderInbox(`/inbox/${secondThread.id}`);++ fireEvent.click(screen.getByRole('button', { name: 'Next chat' }));++ expect(+ screen.getByText(`Chat page ${thirdThread.id}`),+ ).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'Next chat' })).toBeDisabled();++ fireEvent.click(screen.getByRole('link', { name: /Open/ }));++ expect(screen.queryByText(/Chat page/)).not.toBeInTheDocument();+ expect(+ screen.getByRole('button', { name: 'Third chat' }),+ ).toBeInTheDocument();+ });++ it('selects chats in the list, with the command menu acting on them', () => {+ renderInbox('/inbox');++ fireEvent.click(screen.getByRole('button', { name: 'Second chat' }), {+ metaKey: true,+ });++ expect(screen.getByText('1 selected')).toBeInTheDocument();+ expect(screen.queryByText('1 chat selected')).not.toBeInTheDocument();+ expect(getTargetedThreadIds(MAIN_CONTEXT_STORE_INSTANCE_ID)).toEqual({+ mode: 'selection',+ selectedRecordIds: [secondThread.id],+ });+ });+ });++ describe('on a phone', () => {+ beforeEach(() => {+ isMobile = true;+ });++ it('opens the tapped chat in place of the list', () => {+ renderInbox('/inbox');++ fireEvent.click(screen.getByRole('button', { name: 'First chat' }));++ expect(+ screen.getByText(`Chat page ${firstThread.id}`),+ ).toBeInTheDocument();+ expect(+ screen.queryByRole('button', { name: 'Second chat' }),+ ).not.toBeInTheDocument();+ });++ it('adds tapped chats to a selection started from a checkbox', () => {+ renderInbox('/inbox');++ fireEvent.click(+ screen.getByRole('checkbox', { name: 'Select First chat' }),+ );+ fireEvent.click(screen.getByRole('button', { name: 'Third chat' }));++ expect(screen.getByText('2 selected')).toBeInTheDocument();+ expect(getRowCheckbox('First chat')).toBeChecked();+ expect(getRowCheckbox('Third chat')).toBeChecked();+ expect(screen.queryByText(/Chat page/)).not.toBeInTheDocument();+ });+ });});diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPageContent.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPageContent.tsxindex 90c7bf08e4f..1c751ad4a89 100644--- a/packages/twenty-front/src/pages/object-record/RecordShowPageContent.tsx+++ b/packages/twenty-front/src/pages/object-record/RecordShowPageContent.tsx@@ -13,12 +13,14 @@ export type RecordShowPageParameters = {export const RecordShowPageContent = ({parameters,headerActions,+ headerTitlePrefix,headerTitleAccessory,headerTitleMode,isRecordIdentifierBarHidden,}: {parameters: RecordShowPageParameters;headerActions?: ReactNode;+ headerTitlePrefix?: ReactNode;headerTitleAccessory?: ReactNode;headerTitleMode?: RecordShowPageHeaderTitleMode;isRecordIdentifierBarHidden?: boolean;@@ -41,6 +43,7 @@ export const RecordShowPageContent = ({loading={loading}error={error}headerActions={headerActions}+ headerTitlePrefix={headerTitlePrefix}headerTitleAccessory={headerTitleAccessory}headerTitleMode={headerTitleMode}isRecordIdentifierBarHidden={isRecordIdentifierBarHidden}diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsxindex 2c633918f60..cec4c76c08f 100644--- a/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx+++ b/packages/twenty-front/src/pages/object-record/RecordShowPageHeader.tsx@@ -11,6 +11,7 @@ type RecordShowPageHeaderProps = {objectNameSingular: string;objectRecordId: string;titleMode?: RecordShowPageHeaderTitleMode;+ titlePrefix?: React.ReactNode;titleAccessory?: React.ReactNode;children?: React.ReactNode;};@@ -18,13 +19,14 @@ type RecordShowPageHeaderProps = {type RecordShowPageMainHeaderProps = RecordShowPageHeaderProps;type RecordShowPagePanelHeaderProps = Omit<RecordShowPageHeaderProps,- 'children' | 'titleMode'+ 'children' | 'titleMode' | 'titlePrefix'>;const RecordShowPageMainHeader = ({objectNameSingular,objectRecordId,titleMode = 'breadcrumb',+ titlePrefix,titleAccessory,children,}: RecordShowPageMainHeaderProps) => {@@ -41,6 +43,7 @@ const RecordShowPageMainHeader = ({<PageCardHeadertitle={<>+ {titlePrefix}<RecordShowPageHeaderRecordTitleobjectNameSingular={objectNameSingular}objectRecordId={objectRecordId}@@ -92,6 +95,7 @@ export const RecordShowPageHeader = ({objectNameSingular,objectRecordId,titleMode,+ titlePrefix,titleAccessory,children,}: RecordShowPageHeaderProps) => {@@ -108,6 +112,7 @@ export const RecordShowPageHeader = ({objectNameSingular={objectNameSingular}objectRecordId={objectRecordId}titleMode={titleMode}+ titlePrefix={titlePrefix}titleAccessory={titleAccessory}>{children}