Skip to content

Commit db8100b

Browse files
Copilothotlong
andcommitted
feat: integrate RecordChatterPanel into drawer overlay and default navigation to page mode
- Add RecordChatterPanel below DetailView in NavigationOverlay drawer content (collapsible, defaultCollapsed for space efficiency in overlay mode) - Change default navigation mode from 'drawer' to 'page' for full-page detail with discussion support - Add tests for default page navigation and ChatterPanel in drawer Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 52c3e43 commit db8100b

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

apps/console/src/__tests__/ObjectView.test.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,4 +766,39 @@ describe('ObjectView Component', () => {
766766
expect(screen.getByTestId('schema-navigation-mode')).toHaveTextContent('modal');
767767
});
768768
});
769+
770+
it('defaults to page navigation mode when no navigation config is specified', () => {
771+
mockUseParams.mockReturnValue({ objectName: 'opportunity' });
772+
773+
render(<ObjectView dataSource={mockDataSource} objects={mockObjects} onEdit={vi.fn()} />);
774+
775+
// With default 'page' mode, NavigationOverlay renders nothing (non-overlay mode)
776+
// and the grid still renders fine
777+
expect(screen.getByTestId('object-grid')).toBeInTheDocument();
778+
});
779+
780+
it('renders RecordChatterPanel inside drawer overlay when navigation mode is drawer', async () => {
781+
mockAuthUser = { id: 'u1', name: 'Admin', role: 'admin' };
782+
// Provide recordId in URL to trigger overlay open
783+
mockSearchParams = new URLSearchParams('recordId=rec-1');
784+
const objectsWithDrawer = [
785+
{
786+
...mockObjects[0],
787+
navigation: { mode: 'drawer' as const },
788+
}
789+
];
790+
mockUseParams.mockReturnValue({ objectName: 'opportunity' });
791+
792+
const dataSourceWithFindOne = {
793+
...mockDataSource,
794+
findOne: vi.fn().mockResolvedValue({ _id: 'rec-1', id: 'rec-1', name: 'Test' }),
795+
};
796+
797+
render(<ObjectView dataSource={dataSourceWithFindOne} objects={objectsWithDrawer} onEdit={vi.fn()} />);
798+
799+
// The drawer should render a "Show Discussion" button (ChatterPanel is defaultCollapsed)
800+
await vi.waitFor(() => {
801+
expect(screen.getByLabelText('Show discussion')).toBeInTheDocument();
802+
});
803+
});
769804
});

apps/console/src/components/ObjectView.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useMemo, useState, useCallback, useEffect, type ComponentType } from 'r
1313
import { useParams, useSearchParams, useNavigate } from 'react-router-dom';
1414
import { ObjectChart } from '@object-ui/plugin-charts';
1515
import { ListView } from '@object-ui/plugin-list';
16-
import { DetailView } from '@object-ui/plugin-detail';
16+
import { DetailView, RecordChatterPanel } from '@object-ui/plugin-detail';
1717
import { ObjectView as PluginObjectView, ViewTabBar } from '@object-ui/plugin-view';
1818
import type { ViewTabItem, AvailableViewType } from '@object-ui/plugin-view';
1919
// Import plugins for side-effects (registration)
@@ -230,8 +230,8 @@ export function ObjectView({ dataSource, objects, onEdit, onRowClick }: any) {
230230
}, [dataSource, objectDef.name, refreshKey]);
231231

232232
// Navigation overlay for record detail (supports drawer/modal/split/popover via config)
233-
// Priority: activeView.navigation > objectDef.navigation > default drawer
234-
const detailNavigation: ViewNavigationConfig = activeView?.navigation ?? objectDef.navigation ?? { mode: 'drawer' };
233+
// Priority: activeView.navigation > objectDef.navigation > default page
234+
const detailNavigation: ViewNavigationConfig = activeView?.navigation ?? objectDef.navigation ?? { mode: 'page' };
235235
const drawerRecordId = searchParams.get('recordId');
236236
const navOverlay = useNavigationOverlay({
237237
navigation: detailNavigation,
@@ -658,6 +658,22 @@ export function ObjectView({ dataSource, objects, onEdit, onRowClick }: any) {
658658
dataSource={dataSource}
659659
onEdit={() => onEdit({ _id: recordId, id: recordId })}
660660
/>
661+
{/* Discussion panel — collapsible in drawer/overlay mode */}
662+
<div className="mt-6 border-t pt-6">
663+
<RecordChatterPanel
664+
config={{
665+
position: 'bottom',
666+
collapsible: true,
667+
defaultCollapsed: true,
668+
feed: {
669+
enableReactions: true,
670+
enableThreading: true,
671+
showCommentInput: true,
672+
},
673+
}}
674+
items={[]}
675+
/>
676+
</div>
661677
</div>
662678
);
663679
}}

0 commit comments

Comments
 (0)