mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-25 04:26:29 +00:00
refactor(frontend): move report module from lib/ to features/report/
The PDF generator (~658 lines, lazy-loaded) and its public-API wrapper report.ts are functionally one module. They now live together in features/report/ instead of being scattered in lib/, which was a poor home for a 658-line React-pdf component anyway. The lazy-import path inside report.ts stays relative (./report-pdf), and the four consumers (flow.tsx, flow-files.tsx, flow-report.tsx, resources.tsx) just swap '@/lib/report' for '@/features/report'. Note: copyToClipboard and downloadTextFile come along for the ride — they're generic helpers used in non-report contexts too. Splitting them out cleanly into lib/ would be worth a follow-up if you want stricter domain boundaries.
This commit is contained in:
@@ -21,9 +21,9 @@ import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/
|
||||
import { Form, FormControl, FormField, FormItem } from '@/components/ui/form';
|
||||
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from '@/components/ui/input-group';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { copyToClipboard } from '@/features/report';
|
||||
import { StatusType } from '@/graphql/types';
|
||||
import { useFilesDragAndDrop } from '@/hooks/use-files-drag-and-drop';
|
||||
import { copyToClipboard } from '@/lib/report';
|
||||
import { useFlow } from '@/providers/flow-provider';
|
||||
|
||||
import { FlowFilesAttachResourcesDialog } from './flow-files-attach-resources-dialog';
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export {
|
||||
copyToClipboard,
|
||||
downloadTextFile,
|
||||
generateFileName,
|
||||
generatePDFBlob,
|
||||
generatePDFFromMarkdown,
|
||||
generateReport,
|
||||
} from './report';
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Document, Font, Page, pdf, StyleSheet, Text, View } from '@react-pdf/renderer';
|
||||
import { marked } from 'marked';
|
||||
|
||||
import { Log } from './log';
|
||||
import { Log } from '@/lib/log';
|
||||
|
||||
// Register Noto Sans (covers Latin + Cyrillic + Greek + many other scripts)
|
||||
Font.register({
|
||||
@@ -3,8 +3,7 @@ import GithubSlugger from 'github-slugger';
|
||||
import type { FlowFragmentFragment, TaskFragmentFragment } from '@/graphql/types';
|
||||
|
||||
import { StatusType } from '@/graphql/types';
|
||||
|
||||
import { Log } from './log';
|
||||
import { Log } from '@/lib/log';
|
||||
|
||||
// Helper function to get emoji for status
|
||||
const getStatusEmoji = (status: StatusType): string => {
|
||||
@@ -3,9 +3,9 @@ import { useParams, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import Logo from '@/components/icons/logo';
|
||||
import Markdown from '@/components/shared/markdown';
|
||||
import { generateFileName, generatePDFFromMarkdown, generateReport } from '@/features/report';
|
||||
import { useFlowReportQuery } from '@/graphql/types';
|
||||
import { Log } from '@/lib/log';
|
||||
import { generateFileName, generatePDFFromMarkdown, generateReport } from '@/lib/report';
|
||||
|
||||
type PdfPhase = 'done' | 'error' | 'idle';
|
||||
type ReportState = 'content' | 'error' | 'generating' | 'loading';
|
||||
|
||||
@@ -40,11 +40,11 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
|
||||
import FlowCentralTabs from '@/features/flows/flow-central-tabs';
|
||||
import FlowTabs from '@/features/flows/flow-tabs';
|
||||
import { useFlowDetailNavigation } from '@/features/flows/use-flow-detail-navigation';
|
||||
import { copyToClipboard, downloadTextFile, generateFileName, generateReport } from '@/features/report';
|
||||
import { ResultType, StatusType, useRenameFlowMutation } from '@/graphql/types';
|
||||
import { useBreakpoint } from '@/hooks/use-breakpoint';
|
||||
import { useFlowTabDetection } from '@/hooks/use-flow-tab-detection';
|
||||
import { Log } from '@/lib/log';
|
||||
import { copyToClipboard, downloadTextFile, generateFileName, generateReport } from '@/lib/report';
|
||||
import { formatName } from '@/lib/utils/format';
|
||||
import { useFavorites } from '@/providers/favorites-provider';
|
||||
import { useFlow } from '@/providers/flow-provider';
|
||||
|
||||
@@ -39,6 +39,7 @@ import { FileDropZone } from '@/components/ui/file-drop-zone';
|
||||
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from '@/components/ui/input-group';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { SidebarTrigger } from '@/components/ui/sidebar';
|
||||
import { copyToClipboard } from '@/features/report';
|
||||
import { ResourcesCopyDialog } from '@/features/resources/resources-copy-dialog';
|
||||
import { ResourcesMkdirDialog } from '@/features/resources/resources-mkdir-dialog';
|
||||
import { ResourcesMoveDialog } from '@/features/resources/resources-move-dialog';
|
||||
@@ -50,7 +51,6 @@ import { useResourcesUpload } from '@/features/resources/use-resources-upload';
|
||||
import { useEffectAfterMount } from '@/hooks/use-effect-after-mount';
|
||||
import { useFilesDragAndDrop } from '@/hooks/use-files-drag-and-drop';
|
||||
import { usePageStorageKeys } from '@/hooks/use-page-storage-keys';
|
||||
import { copyToClipboard } from '@/lib/report';
|
||||
import { migrateLegacyViewOptions, saveViewOptions } from '@/lib/view-options-storage';
|
||||
import { useResources } from '@/providers/resources-provider';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user