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 { useHotkeys } from 'react-hotkeys-hook';
|
||||
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 { useStartChatFromAsset } from '@/context/BusterAssets/useStartChatFromAsset';
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import {
|
|||
import { Dots, History, PenSparkle, ShareRight, Star } from '@/components/ui/icons';
|
||||
import { Star as StarFilled } from '@/components/ui/icons/NucleoIconFilled';
|
||||
import {
|
||||
ArrowUpRight,
|
||||
Download4,
|
||||
DuplicatePlus,
|
||||
Redo,
|
||||
|
@ -50,6 +51,8 @@ export const ReportThreeDotMenu = React.memo(
|
|||
reportVersionNumber: number | undefined;
|
||||
isViewingOldVersion: boolean;
|
||||
}) => {
|
||||
const chatId = useGetChatId();
|
||||
const openReport = useOpenReport({ reportId });
|
||||
const editWithAI = useEditWithAI({ reportId });
|
||||
const shareMenu = useShareMenuSelectMenu({ reportId });
|
||||
const saveToLibrary = useSaveToLibrary({ reportId });
|
||||
|
@ -72,6 +75,7 @@ export const ReportThreeDotMenu = React.memo(
|
|||
|
||||
const items: IDropdownItems = useMemo(() => {
|
||||
return [
|
||||
chatId && openReport,
|
||||
editWithAI,
|
||||
{ type: 'divider' },
|
||||
isEffectiveOwner && !isViewingOldVersion && shareMenu,
|
||||
|
@ -86,8 +90,10 @@ export const ReportThreeDotMenu = React.memo(
|
|||
isEditor && refreshReportItem,
|
||||
duplicateReport,
|
||||
downloadPdfItem,
|
||||
];
|
||||
].filter(Boolean) as IDropdownItems;
|
||||
}, [
|
||||
chatId,
|
||||
openReport,
|
||||
reportId,
|
||||
reportVersionNumber,
|
||||
editWithAI,
|
||||
|
@ -437,3 +443,22 @@ const useDuplicateReportSelectMenu = ({ reportId }: { reportId: string }): IDrop
|
|||
[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