feat(ai): add ai chat to dashboard
This commit is contained in:
@@ -18,7 +18,7 @@ import { ModalContent, ModalHeader } from './Modal/Container';
|
||||
|
||||
type SaveReportProps = {
|
||||
report: IChartProps;
|
||||
reportId?: string;
|
||||
disableRedirect?: boolean;
|
||||
};
|
||||
|
||||
const validator = z.object({
|
||||
@@ -28,7 +28,10 @@ const validator = z.object({
|
||||
|
||||
type IForm = z.infer<typeof validator>;
|
||||
|
||||
export default function SaveReport({ report }: SaveReportProps) {
|
||||
export default function SaveReport({
|
||||
report,
|
||||
disableRedirect,
|
||||
}: SaveReportProps) {
|
||||
const router = useRouter();
|
||||
const { organizationId, projectId } = useAppParams();
|
||||
const searchParams = useSearchParams();
|
||||
@@ -37,15 +40,27 @@ export default function SaveReport({ report }: SaveReportProps) {
|
||||
const save = api.report.create.useMutation({
|
||||
onError: handleError,
|
||||
onSuccess(res) {
|
||||
toast('Success', {
|
||||
description: 'Report saved.',
|
||||
const goToReport = () => {
|
||||
router.push(
|
||||
`/${organizationId}/${projectId}/reports/${
|
||||
res.id
|
||||
}?${searchParams?.toString()}`,
|
||||
);
|
||||
};
|
||||
|
||||
toast('Report created', {
|
||||
description: <div>Hello world</div>,
|
||||
action: {
|
||||
label: 'View report',
|
||||
onClick: () => goToReport(),
|
||||
},
|
||||
});
|
||||
|
||||
if (!disableRedirect) {
|
||||
goToReport();
|
||||
}
|
||||
|
||||
popModal();
|
||||
router.push(
|
||||
`/${organizationId}/${projectId}/reports/${
|
||||
res.id
|
||||
}?${searchParams?.toString()}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user