mirror of https://github.com/buster-so/buster.git
report three dot menu update
This commit is contained in:
parent
be6e9b2531
commit
bac3ea490f
|
@ -2,7 +2,7 @@ import type { ChatAssetType } from '@buster/server-shared/chats';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { Button } from '@/components/ui/buttons';
|
import { Button } from '@/components/ui/buttons';
|
||||||
import { PenSparkle, Stars } from '@/components/ui/icons';
|
import { PenSparkle } from '@/components/ui/icons';
|
||||||
import { AppTooltip } from '@/components/ui/tooltip';
|
import { AppTooltip } from '@/components/ui/tooltip';
|
||||||
import { useStartChatFromAsset } from '@/context/BusterAssets/useStartChatFromAsset';
|
import { useStartChatFromAsset } from '@/context/BusterAssets/useStartChatFromAsset';
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import {
|
||||||
import { Dots, History, PenSparkle, ShareRight, Star } from '@/components/ui/icons';
|
import { Dots, History, PenSparkle, ShareRight, Star } from '@/components/ui/icons';
|
||||||
import { Star as StarFilled } from '@/components/ui/icons/NucleoIconFilled';
|
import { Star as StarFilled } from '@/components/ui/icons/NucleoIconFilled';
|
||||||
import {
|
import {
|
||||||
|
ArrowUpRight,
|
||||||
Download4,
|
Download4,
|
||||||
DuplicatePlus,
|
DuplicatePlus,
|
||||||
Redo,
|
Redo,
|
||||||
|
@ -50,6 +51,8 @@ export const ReportThreeDotMenu = React.memo(
|
||||||
reportVersionNumber: number | undefined;
|
reportVersionNumber: number | undefined;
|
||||||
isViewingOldVersion: boolean;
|
isViewingOldVersion: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
|
const chatId = useGetChatId();
|
||||||
|
const openReport = useOpenReport({ reportId });
|
||||||
const editWithAI = useEditWithAI({ reportId });
|
const editWithAI = useEditWithAI({ reportId });
|
||||||
const shareMenu = useShareMenuSelectMenu({ reportId });
|
const shareMenu = useShareMenuSelectMenu({ reportId });
|
||||||
const saveToLibrary = useSaveToLibrary({ reportId });
|
const saveToLibrary = useSaveToLibrary({ reportId });
|
||||||
|
@ -72,6 +75,7 @@ export const ReportThreeDotMenu = React.memo(
|
||||||
|
|
||||||
const items: IDropdownItems = useMemo(() => {
|
const items: IDropdownItems = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
|
chatId && openReport,
|
||||||
editWithAI,
|
editWithAI,
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
isEffectiveOwner && !isViewingOldVersion && shareMenu,
|
isEffectiveOwner && !isViewingOldVersion && shareMenu,
|
||||||
|
@ -86,8 +90,10 @@ export const ReportThreeDotMenu = React.memo(
|
||||||
isEditor && refreshReportItem,
|
isEditor && refreshReportItem,
|
||||||
duplicateReport,
|
duplicateReport,
|
||||||
downloadPdfItem,
|
downloadPdfItem,
|
||||||
];
|
].filter(Boolean) as IDropdownItems;
|
||||||
}, [
|
}, [
|
||||||
|
chatId,
|
||||||
|
openReport,
|
||||||
reportId,
|
reportId,
|
||||||
reportVersionNumber,
|
reportVersionNumber,
|
||||||
editWithAI,
|
editWithAI,
|
||||||
|
@ -437,3 +443,22 @@ const useDuplicateReportSelectMenu = ({ reportId }: { reportId: string }): IDrop
|
||||||
[reportId]
|
[reportId]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const useOpenReport = ({ reportId }: { reportId: string }): IDropdownItem => {
|
||||||
|
return useMemo(
|
||||||
|
() =>
|
||||||
|
createDropdownItem({
|
||||||
|
label: 'Open report',
|
||||||
|
value: 'open-report',
|
||||||
|
icon: <ArrowUpRight />,
|
||||||
|
linkIcon: 'none',
|
||||||
|
link: {
|
||||||
|
to: '/app/reports/$reportId',
|
||||||
|
params: {
|
||||||
|
reportId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[reportId]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue