feat: integrate report panel into chat interface

- Added a new ReportPanel component to display report details inline within the chat interface.
- Updated NewChatPage and PublicChatView to include the ReportPanel, enhancing user experience by allowing report viewing alongside chat interactions.
- Introduced report panel state management with Jotai atoms to control visibility and data handling.
- Refactored existing components to accommodate the new report panel layout and functionality.
This commit is contained in:
Anish Sarkar 2026-02-11 18:50:57 +05:30
parent acad8c6d2b
commit e4244829ae
6 changed files with 592 additions and 212 deletions

View file

@ -0,0 +1,48 @@
import { atom } from "jotai";
interface ReportPanelState {
isOpen: boolean;
reportId: number | null;
title: string | null;
wordCount: number | null;
}
const initialState: ReportPanelState = {
isOpen: false,
reportId: null,
title: null,
wordCount: null,
};
/** Core atom holding the report panel state */
export const reportPanelAtom = atom<ReportPanelState>(initialState);
/** Derived read-only atom for checking if panel is open */
export const reportPanelOpenAtom = atom((get) => get(reportPanelAtom).isOpen);
/** Action atom to open the report panel with a specific report */
export const openReportPanelAtom = atom(
null,
(
_get,
set,
{
reportId,
title,
wordCount,
}: { reportId: number; title: string; wordCount?: number }
) => {
set(reportPanelAtom, {
isOpen: true,
reportId,
title,
wordCount: wordCount ?? null,
});
}
);
/** Action atom to close the report panel */
export const closeReportPanelAtom = atom(null, (_, set) => {
set(reportPanelAtom, initialState);
});