documentation-hub 5.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +43 -0
- package/.github/workflows/build.yml +64 -0
- package/.github/workflows/ci.yml +39 -0
- package/.vscode/extensions.json +3 -0
- package/Current.md +97 -0
- package/DocHub_Image.png +0 -0
- package/README.md +666 -0
- package/USER_GUIDE.md +1173 -0
- package/Updater.md +311 -0
- package/build/256x256.png +0 -0
- package/build/512x512.png +0 -0
- package/build/app-update.yml +4 -0
- package/build/create-icon.js +208 -0
- package/build/icon.ico +0 -0
- package/build/icon.png +0 -0
- package/build/icon_1024x1024.png +0 -0
- package/dist/assets/Analytics-BpsG9895.js +1 -0
- package/dist/assets/Card-IAZin8kp.js +1 -0
- package/dist/assets/CurrentSession-B-rFkHvf.js +12 -0
- package/dist/assets/Dashboard-C_5gMb0q.js +1 -0
- package/dist/assets/Documents-CqZ25axS.js +1 -0
- package/dist/assets/Input-l89xwXBi.js +1 -0
- package/dist/assets/Reporting-DqdHJY_a.js +1 -0
- package/dist/assets/Search-XNbu5z_3.js +1 -0
- package/dist/assets/SessionManager-lH9hZfzH.js +1 -0
- package/dist/assets/Sessions-ClZOPYNc.js +1 -0
- package/dist/assets/Settings-DUEHGURa.js +11 -0
- package/dist/assets/index-8xUe8ptc.js +24 -0
- package/dist/assets/index-RYyJqF7O.css +1 -0
- package/dist/assets/path-BkOl0AGO.js +1 -0
- package/dist/assets/promises-ID_B9S-h.js +1 -0
- package/dist/assets/urlHelpers-TvgahX0r.js +1 -0
- package/dist/assets/useToast-yRSO1dkm.js +1 -0
- package/dist/assets/vendor-charts-RkGK5ROP.js +36 -0
- package/dist/assets/vendor-db-l0sNRNKZ.js +1 -0
- package/dist/assets/vendor-react-BVZ_anCF.js +4 -0
- package/dist/assets/vendor-search-Dw8P0qyA.js +1 -0
- package/dist/assets/vendor-ui-BU7NfluV.js +53 -0
- package/dist/electron/PowerAutomateApiService-LfW09ZGr.js +147 -0
- package/dist/electron/main-CXkNtyv-.js +19789 -0
- package/dist/electron/main.js +5 -0
- package/dist/electron/preload.js +1 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +27 -0
- package/docs/CODEBASE_ANALYSIS_REPORT.md +309 -0
- package/docs/DEBUG_LOGGING_GUIDE.md +244 -0
- package/docs/README.md +115 -0
- package/docs/TOC_WIRING_GUIDE.md +344 -0
- package/docs/analysis/Bullet_Symbol_Bug_Analysis.md +136 -0
- package/docs/analysis/DOCXMLATER_ANALYSIS_SUMMARY.txt +169 -0
- package/docs/analysis/Document_Processing_Issues_Analysis.md +704 -0
- package/docs/analysis/FIELD_PRESERVATION_ANALYSIS.md +1200 -0
- package/docs/analysis/INDENTATION_PRESERVE_ANALYSIS.md +181 -0
- package/docs/analysis/INDENTATION_PRESERVE_IMPLEMENTATION.md +207 -0
- package/docs/analysis/List_Implementation.md +206 -0
- package/docs/analysis/List_Implementation_Accuracy_Report.md +366 -0
- package/docs/analysis/PROCESSING_OPTIONS_UI_UPDATES.md +220 -0
- package/docs/analysis/RefactorStyles.md +852 -0
- package/docs/analysis/STYLE_PARAMETER_ENHANCEMENT.md +143 -0
- package/docs/analysis/docxmlater-comparison-todo-2025-11-13.md +636 -0
- package/docs/analysis/docxmlater-implementation-analysis-2025-11-13.md +340 -0
- package/docs/analysis/docxmlater-template_ui-integration-analysis.md +263 -0
- package/docs/analysis/github-issues-to-create.md +237 -0
- package/docs/api/API_README.md +538 -0
- package/docs/api/API_REFERENCE.md +751 -0
- package/docs/api/TYPE_DEFINITIONS.md +869 -0
- package/docs/architecture/FONT_EMBEDDING_GUIDE.md +318 -0
- package/docs/architecture/docxmlater-functions-and-structure.md +726 -0
- package/docs/docxmlater-readme.md +1341 -0
- package/docs/fixes/EXECUTION_LOG_TEST_BASE.md +573 -0
- package/docs/fixes/HYPERLINK_TEXT_SANITIZATION.md +253 -0
- package/docs/fixes/README.md +37 -0
- package/docs/github-issues/issue-1-body.md +125 -0
- package/docs/github-issues/issue-10-body.md +850 -0
- package/docs/github-issues/issue-2-body.md +200 -0
- package/docs/github-issues/issue-3-body.md +270 -0
- package/docs/github-issues/issue-4-body.md +169 -0
- package/docs/github-issues/issue-5-body.md +173 -0
- package/docs/github-issues/issue-6-body.md +158 -0
- package/docs/github-issues/issue-7-body.md +171 -0
- package/docs/github-issues/issue-8-body.md +407 -0
- package/docs/github-issues/issue-9-body.md +515 -0
- package/docs/github-issues/issue-tracker.md +274 -0
- package/docs/github-issues/predictive-analysis-2025-10-18.md +2131 -0
- package/docs/implementation/List_Framework_Refactor_Plan.md +336 -0
- package/docs/implementation/PRIMARY_TEXT_COLOR_FEATURE.md +217 -0
- package/docs/implementation/RELEASE_PLAN_v2.1.0.md +362 -0
- package/docs/implementation/RefactorStyles.md +588 -0
- package/docs/implementation/implement-plan.md +489 -0
- package/docs/implementation/missing-helpers-implementation.md +391 -0
- package/docs/implementation/refactor-plan.md +520 -0
- package/docs/implementation/session-implementation-complete.md +233 -0
- package/docs/implementation/session-management-plan.md +250 -0
- package/docs/setup-checklist.md +77 -0
- package/docs/versions/changelog.md +345 -0
- package/electron/customUpdater.ts +656 -0
- package/electron/main.ts +2441 -0
- package/electron/memoryConfig.ts +187 -0
- package/electron/preload.ts +394 -0
- package/electron/proxyConfig.ts +340 -0
- package/electron/services/BackupService.ts +452 -0
- package/electron/services/DictionaryService.ts +402 -0
- package/electron/services/LocalDictionaryLookupService.ts +147 -0
- package/electron/services/PowerAutomateApiService.ts +231 -0
- package/electron/services/SharePointSyncService.ts +474 -0
- package/electron/windowsCertStore.ts +427 -0
- package/electron/zscalerConfig.ts +381 -0
- package/eslint.config.js +92 -0
- package/jest.config.js +52 -0
- package/package.json +214 -0
- package/postcss.config.mjs +6 -0
- package/public/icon.png +0 -0
- package/publish-release.ps1 +5 -0
- package/renovate.json +30 -0
- package/src/App.tsx +216 -0
- package/src/__mocks__/p-limit.js +12 -0
- package/src/__mocks__/styleMock.js +1 -0
- package/src/components/common/BugReportButton.tsx +44 -0
- package/src/components/common/BugReportDialog.tsx +193 -0
- package/src/components/common/Button.tsx +153 -0
- package/src/components/common/Card.tsx +86 -0
- package/src/components/common/ColorPickerDialog.tsx +177 -0
- package/src/components/common/ConfirmDialog.tsx +96 -0
- package/src/components/common/DebugConsole.tsx +275 -0
- package/src/components/common/EmptyState.tsx +183 -0
- package/src/components/common/ErrorBoundary.tsx +98 -0
- package/src/components/common/ErrorDetailsDialog.tsx +153 -0
- package/src/components/common/ErrorFallback.tsx +218 -0
- package/src/components/common/Input.tsx +109 -0
- package/src/components/common/Skeleton.tsx +184 -0
- package/src/components/common/SplashScreen.tsx +81 -0
- package/src/components/common/Toast.tsx +155 -0
- package/src/components/common/Tooltip.tsx +79 -0
- package/src/components/common/UpdateNotification.tsx +320 -0
- package/src/components/comparison/ComparisonWindow.tsx +374 -0
- package/src/components/comparison/SideBySideDiff.tsx +486 -0
- package/src/components/comparison/index.ts +8 -0
- package/src/components/document/DocumentUploader.tsx +288 -0
- package/src/components/document/HyperlinkPreview.tsx +430 -0
- package/src/components/document/HyperlinkService.md +1484 -0
- package/src/components/document/Hyperlink_Technical_Documentation.md +496 -0
- package/src/components/document/InlineChangesView.tsx +707 -0
- package/src/components/document/ProcessingProgress.tsx +303 -0
- package/src/components/document/ProcessingResults.tsx +256 -0
- package/src/components/document/TrackedChangesDetail.tsx +530 -0
- package/src/components/document/TrackedChangesPanel.tsx +546 -0
- package/src/components/document/VirtualDocumentList.tsx +240 -0
- package/src/components/editor/DocumentEditor.tsx +723 -0
- package/src/components/editor/DocumentEditorModal.tsx +640 -0
- package/src/components/editor/EditorQuickActions.tsx +502 -0
- package/src/components/editor/EditorToolbar.tsx +312 -0
- package/src/components/editor/TableEditor.tsx +926 -0
- package/src/components/editor/index.ts +18 -0
- package/src/components/layout/Header.tsx +190 -0
- package/src/components/layout/Sidebar.tsx +313 -0
- package/src/components/layout/TitleBar.tsx +190 -0
- package/src/components/navigation/CommandPalette.tsx +233 -0
- package/src/components/navigation/KeyboardShortcutsModal.tsx +173 -0
- package/src/components/sessions/ChangeItem.tsx +408 -0
- package/src/components/sessions/ChangeViewer.tsx +1155 -0
- package/src/components/sessions/DocumentComparisonModal.tsx +314 -0
- package/src/components/sessions/ProcessingOptions.tsx +297 -0
- package/src/components/sessions/ReplacementsTab.tsx +438 -0
- package/src/components/sessions/RevisionHandlingOptions.tsx +87 -0
- package/src/components/sessions/SessionManager.tsx +188 -0
- package/src/components/sessions/StylesEditor.tsx +1335 -0
- package/src/components/sessions/TabContainer.tsx +151 -0
- package/src/components/sessions/VirtualSessionList.tsx +157 -0
- package/src/components/sessions/sessionToProcessorManager.tsx +420 -0
- package/src/components/settings/CertificateManager.tsx +410 -0
- package/src/components/settings/SegmentedControl.tsx +88 -0
- package/src/components/settings/SettingRow.tsx +52 -0
- package/src/contexts/GlobalStatsContext.tsx +396 -0
- package/src/contexts/SessionContext.tsx +2129 -0
- package/src/contexts/ThemeContext.tsx +428 -0
- package/src/contexts/UserSettingsContext.tsx +290 -0
- package/src/contexts/__tests__/GlobalStatsContext.test.tsx +390 -0
- package/src/global.d.ts +273 -0
- package/src/hooks/useDocumentQueue.tsx +210 -0
- package/src/hooks/useToast.tsx +55 -0
- package/src/main.tsx +10 -0
- package/src/pages/Analytics.tsx +386 -0
- package/src/pages/CurrentSession.tsx +1174 -0
- package/src/pages/Dashboard.tsx +319 -0
- package/src/pages/Documents.tsx +317 -0
- package/src/pages/Projects.tsx +250 -0
- package/src/pages/Reporting.tsx +386 -0
- package/src/pages/Search.tsx +349 -0
- package/src/pages/Sessions.tsx +285 -0
- package/src/pages/Settings.tsx +2662 -0
- package/src/services/HyperlinkService.ts +1085 -0
- package/src/services/document/DocXMLaterProcessor.ts +617 -0
- package/src/services/document/DocumentProcessingComparison.ts +856 -0
- package/src/services/document/DocumentSnapshotService.ts +575 -0
- package/src/services/document/WordDocumentProcessor.ts +10509 -0
- package/src/services/document/__tests__/DocXMLaterProcessor.hyperlinks.test.md +311 -0
- package/src/services/document/__tests__/WordDocumentProcessor.integration.test.ts +515 -0
- package/src/services/document/__tests__/WordDocumentProcessor.test.ts +812 -0
- package/src/services/document/blanklines/BlankLineManager.ts +658 -0
- package/src/services/document/blanklines/__tests__/paragraphChecks.test.ts +281 -0
- package/src/services/document/blanklines/helpers/blankLineInsertion.ts +87 -0
- package/src/services/document/blanklines/helpers/blankLineSnapshot.ts +251 -0
- package/src/services/document/blanklines/helpers/clearCustom.ts +121 -0
- package/src/services/document/blanklines/helpers/contextChecks.ts +117 -0
- package/src/services/document/blanklines/helpers/imageChecks.ts +51 -0
- package/src/services/document/blanklines/helpers/paragraphChecks.ts +236 -0
- package/src/services/document/blanklines/helpers/removeBlanksBetweenListItems.ts +91 -0
- package/src/services/document/blanklines/helpers/removeTrailingBlanks.ts +35 -0
- package/src/services/document/blanklines/helpers/tableGuards.ts +21 -0
- package/src/services/document/blanklines/index.ts +67 -0
- package/src/services/document/blanklines/rules/additionRules.ts +337 -0
- package/src/services/document/blanklines/rules/indentationRules.ts +317 -0
- package/src/services/document/blanklines/rules/removalRules.ts +362 -0
- package/src/services/document/blanklines/rules/ruleTypes.ts +92 -0
- package/src/services/document/blanklines/types.ts +29 -0
- package/src/services/document/helpers/ImageBorderCropper.ts +377 -0
- package/src/services/document/helpers/__tests__/whitespace.test.ts +272 -0
- package/src/services/document/helpers/whitespace.ts +117 -0
- package/src/services/document/list/ListNormalizer.ts +947 -0
- package/src/services/document/list/index.ts +45 -0
- package/src/services/document/list/list-detection.ts +275 -0
- package/src/services/document/list/list-types.ts +162 -0
- package/src/services/document/processors/HyperlinkProcessor.ts +370 -0
- package/src/services/document/processors/ListProcessor.ts +257 -0
- package/src/services/document/processors/StructureProcessor.ts +176 -0
- package/src/services/document/processors/StyleProcessor.ts +389 -0
- package/src/services/document/processors/TableProcessor.ts +2238 -0
- package/src/services/document/processors/__tests__/HyperlinkProcessor.test.ts +314 -0
- package/src/services/document/processors/__tests__/ListProcessor.test.ts +291 -0
- package/src/services/document/processors/__tests__/StructureProcessor.test.ts +257 -0
- package/src/services/document/processors/__tests__/TableProcessor.hlp-tips-bullets.test.ts +459 -0
- package/src/services/document/processors/__tests__/TableProcessor.test.ts +1604 -0
- package/src/services/document/processors/index.ts +28 -0
- package/src/services/document/types/docx-processing.ts +310 -0
- package/src/services/editor/EditorActionHandlers.ts +901 -0
- package/src/services/editor/index.ts +13 -0
- package/src/setupTests.ts +47 -0
- package/src/styles/global.css +782 -0
- package/src/types/backup.ts +132 -0
- package/src/types/dictionary.ts +125 -0
- package/src/types/document-processing.ts +331 -0
- package/src/types/docxmlater-augments.d.ts +142 -0
- package/src/types/editor.ts +280 -0
- package/src/types/electron.ts +340 -0
- package/src/types/globalStats.ts +155 -0
- package/src/types/hyperlink.ts +471 -0
- package/src/types/operations.ts +354 -0
- package/src/types/session.ts +427 -0
- package/src/types/settings.ts +112 -0
- package/src/utils/MemoryMonitor.ts +248 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/colorConvert.ts +306 -0
- package/src/utils/diffUtils.ts +347 -0
- package/src/utils/documentUtils.ts +202 -0
- package/src/utils/electronGuard.ts +62 -0
- package/src/utils/indexedDB.ts +915 -0
- package/src/utils/logger.ts +717 -0
- package/src/utils/pathSecurity.ts +232 -0
- package/src/utils/pathValidator.ts +236 -0
- package/src/utils/processingTimeEstimator.ts +153 -0
- package/src/utils/safeJsonParse.ts +62 -0
- package/src/utils/textSanitizer.ts +162 -0
- package/src/utils/urlHelpers.ts +304 -0
- package/src/utils/urlPatterns.ts +198 -0
- package/src/utils/urlSanitizer.ts +152 -0
- package/src/vite-env.d.ts +11 -0
- package/tsconfig.electron.json +19 -0
- package/tsconfig.json +36 -0
- package/tsconfig.node.json +12 -0
- package/typedoc.json +45 -0
- package/vite.config.ts +152 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback, memo } from 'react';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import {
|
|
4
|
+
LineChart,
|
|
5
|
+
Line,
|
|
6
|
+
BarChart,
|
|
7
|
+
Bar,
|
|
8
|
+
XAxis,
|
|
9
|
+
YAxis,
|
|
10
|
+
CartesianGrid,
|
|
11
|
+
Tooltip,
|
|
12
|
+
Legend,
|
|
13
|
+
ResponsiveContainer,
|
|
14
|
+
} from 'recharts';
|
|
15
|
+
import {
|
|
16
|
+
Card,
|
|
17
|
+
CardContent,
|
|
18
|
+
CardDescription,
|
|
19
|
+
CardHeader,
|
|
20
|
+
CardTitle,
|
|
21
|
+
} from '@/components/common/Card';
|
|
22
|
+
import { Button } from '@/components/common/Button';
|
|
23
|
+
import { useGlobalStats } from '@/contexts/GlobalStatsContext';
|
|
24
|
+
import { cn } from '@/utils/cn';
|
|
25
|
+
import {
|
|
26
|
+
TrendingUp,
|
|
27
|
+
BarChart3,
|
|
28
|
+
Calendar,
|
|
29
|
+
CalendarDays,
|
|
30
|
+
CalendarRange,
|
|
31
|
+
FileCheck,
|
|
32
|
+
Link,
|
|
33
|
+
MessageSquare,
|
|
34
|
+
Clock,
|
|
35
|
+
} from 'lucide-react';
|
|
36
|
+
|
|
37
|
+
type ViewMode = 'daily' | 'weekly' | 'monthly';
|
|
38
|
+
|
|
39
|
+
const containerVariants = {
|
|
40
|
+
hidden: { opacity: 0 },
|
|
41
|
+
visible: {
|
|
42
|
+
opacity: 1,
|
|
43
|
+
transition: {
|
|
44
|
+
staggerChildren: 0.1,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const itemVariants = {
|
|
50
|
+
hidden: { opacity: 0, y: 20 },
|
|
51
|
+
visible: {
|
|
52
|
+
opacity: 1,
|
|
53
|
+
y: 0,
|
|
54
|
+
transition: {
|
|
55
|
+
duration: 0.5,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Type for chart hover data
|
|
61
|
+
interface HoveredChartData {
|
|
62
|
+
date: string;
|
|
63
|
+
Documents?: number;
|
|
64
|
+
Hyperlinks?: number;
|
|
65
|
+
Feedback?: number;
|
|
66
|
+
'Time (min)'?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// PERFORMANCE: Wrap in memo to prevent re-renders when parent state changes
|
|
70
|
+
export const Analytics = memo(function Analytics() {
|
|
71
|
+
const [viewMode, setViewMode] = useState<ViewMode>('daily');
|
|
72
|
+
const [hoveredData, setHoveredData] = useState<HoveredChartData | null>(null);
|
|
73
|
+
|
|
74
|
+
const { stats, getDailyHistory, getWeeklyHistory, getMonthlyHistory } =
|
|
75
|
+
useGlobalStats();
|
|
76
|
+
|
|
77
|
+
// Handle chart hover via mouse events instead of state updates during render
|
|
78
|
+
const handleChartMouseMove = useCallback((state: any) => {
|
|
79
|
+
if (state?.activePayload?.[0]?.payload) {
|
|
80
|
+
setHoveredData(state.activePayload[0].payload);
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
const handleChartMouseLeave = useCallback(() => {
|
|
85
|
+
setHoveredData(null);
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
// Prepare chart data based on view mode
|
|
89
|
+
// PERFORMANCE FIX: Memoize chart data to prevent unnecessary recalculations
|
|
90
|
+
// Recharts will re-render only when data actually changes, not on every parent render
|
|
91
|
+
const chartData = useMemo(() => {
|
|
92
|
+
if (viewMode === 'daily') {
|
|
93
|
+
const history = getDailyHistory(30);
|
|
94
|
+
return [...history].reverse().map((day) => ({
|
|
95
|
+
date: new Date(day.date).toLocaleDateString('en-US', {
|
|
96
|
+
month: 'short',
|
|
97
|
+
day: 'numeric',
|
|
98
|
+
}),
|
|
99
|
+
Documents: day.documentsProcessed,
|
|
100
|
+
Hyperlinks: day.hyperlinksChecked,
|
|
101
|
+
Feedback: day.feedbackImported,
|
|
102
|
+
'Time (min)': day.timeSaved,
|
|
103
|
+
}));
|
|
104
|
+
} else if (viewMode === 'weekly') {
|
|
105
|
+
const history = getWeeklyHistory(12);
|
|
106
|
+
return [...history].reverse().map((week) => ({
|
|
107
|
+
date: `${new Date(week.weekStart).toLocaleDateString('en-US', {
|
|
108
|
+
month: 'short',
|
|
109
|
+
day: 'numeric',
|
|
110
|
+
})} - ${new Date(week.weekEnd).toLocaleDateString('en-US', {
|
|
111
|
+
month: 'short',
|
|
112
|
+
day: 'numeric',
|
|
113
|
+
})}`,
|
|
114
|
+
Documents: week.documentsProcessed,
|
|
115
|
+
Hyperlinks: week.hyperlinksChecked,
|
|
116
|
+
Feedback: week.feedbackImported,
|
|
117
|
+
'Time (min)': week.timeSaved,
|
|
118
|
+
}));
|
|
119
|
+
} else {
|
|
120
|
+
const history = getMonthlyHistory(12);
|
|
121
|
+
return [...history].reverse().map((month) => ({
|
|
122
|
+
date: new Date(month.month + '-01').toLocaleDateString('en-US', {
|
|
123
|
+
month: 'short',
|
|
124
|
+
year: 'numeric',
|
|
125
|
+
}),
|
|
126
|
+
Documents: month.documentsProcessed,
|
|
127
|
+
Hyperlinks: month.hyperlinksChecked,
|
|
128
|
+
Feedback: month.feedbackImported,
|
|
129
|
+
'Time (min)': month.timeSaved,
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
}, [viewMode, getDailyHistory, getWeeklyHistory, getMonthlyHistory]);
|
|
133
|
+
|
|
134
|
+
const viewModes = [
|
|
135
|
+
{
|
|
136
|
+
value: 'daily' as ViewMode,
|
|
137
|
+
label: 'Daily',
|
|
138
|
+
icon: Calendar,
|
|
139
|
+
description: 'Last 30 days',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
value: 'weekly' as ViewMode,
|
|
143
|
+
label: 'Weekly',
|
|
144
|
+
icon: CalendarDays,
|
|
145
|
+
description: 'Last 12 weeks',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
value: 'monthly' as ViewMode,
|
|
149
|
+
label: 'Monthly',
|
|
150
|
+
icon: CalendarRange,
|
|
151
|
+
description: 'Last 12 months',
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const statsSummary = [
|
|
156
|
+
{
|
|
157
|
+
title: 'Documents Processed',
|
|
158
|
+
value: stats.allTime.documentsProcessed,
|
|
159
|
+
icon: FileCheck,
|
|
160
|
+
color: 'text-green-500',
|
|
161
|
+
bgColor: 'bg-green-500/10',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: 'Hyperlinks Checked',
|
|
165
|
+
value: stats.allTime.hyperlinksChecked,
|
|
166
|
+
icon: Link,
|
|
167
|
+
color: 'text-blue-500',
|
|
168
|
+
bgColor: 'bg-blue-500/10',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
title: 'Feedback Imported',
|
|
172
|
+
value: stats.allTime.feedbackImported,
|
|
173
|
+
icon: MessageSquare,
|
|
174
|
+
color: 'text-purple-500',
|
|
175
|
+
bgColor: 'bg-purple-500/10',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
title: 'Time Saved',
|
|
179
|
+
value: `${stats.allTime.timeSaved}m`,
|
|
180
|
+
icon: Clock,
|
|
181
|
+
color: 'text-orange-500',
|
|
182
|
+
bgColor: 'bg-orange-500/10',
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<motion.div
|
|
188
|
+
variants={containerVariants}
|
|
189
|
+
initial="hidden"
|
|
190
|
+
animate="visible"
|
|
191
|
+
className="p-6 space-y-6 max-w-[1400px] mx-auto"
|
|
192
|
+
>
|
|
193
|
+
{/* Sticky Header Section - includes title and stats */}
|
|
194
|
+
<div className="sticky top-0 z-10 bg-background -mx-6 px-6 pb-4 border-b border-border/50">
|
|
195
|
+
{/* Header */}
|
|
196
|
+
<motion.div variants={itemVariants} className="flex items-center justify-between pt-0 pb-4">
|
|
197
|
+
<div className="flex items-center gap-4">
|
|
198
|
+
<div>
|
|
199
|
+
<h1 className="text-3xl font-bold mb-1 flex items-center gap-2">
|
|
200
|
+
<BarChart3 className="w-8 h-8" />
|
|
201
|
+
Analytics
|
|
202
|
+
</h1>
|
|
203
|
+
<p className="text-muted-foreground">Track performance and insights</p>
|
|
204
|
+
</div>
|
|
205
|
+
<div className="h-12 w-px bg-border" />
|
|
206
|
+
{hoveredData ? (
|
|
207
|
+
<div className="text-base font-medium flex items-center gap-4">
|
|
208
|
+
<span className="text-muted-foreground">{hoveredData.date}:</span>
|
|
209
|
+
{hoveredData.Documents !== undefined && (
|
|
210
|
+
<span className="text-green-500">Docs: {hoveredData.Documents}</span>
|
|
211
|
+
)}
|
|
212
|
+
{hoveredData.Hyperlinks !== undefined && (
|
|
213
|
+
<span className="text-blue-500">Links: {hoveredData.Hyperlinks}</span>
|
|
214
|
+
)}
|
|
215
|
+
{hoveredData.Feedback !== undefined && (
|
|
216
|
+
<span className="text-purple-500">Feedback: {hoveredData.Feedback}</span>
|
|
217
|
+
)}
|
|
218
|
+
{hoveredData['Time (min)'] !== undefined && (
|
|
219
|
+
<span className="text-orange-500">Time: {hoveredData['Time (min)']}m</span>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
) : (
|
|
223
|
+
<span className="text-muted-foreground italic text-sm">Hover over charts for details</span>
|
|
224
|
+
)}
|
|
225
|
+
</div>
|
|
226
|
+
</motion.div>
|
|
227
|
+
|
|
228
|
+
{/* Stats Summary */}
|
|
229
|
+
<motion.div
|
|
230
|
+
variants={itemVariants}
|
|
231
|
+
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4"
|
|
232
|
+
>
|
|
233
|
+
{statsSummary.map((stat) => {
|
|
234
|
+
const Icon = stat.icon;
|
|
235
|
+
return (
|
|
236
|
+
<Card key={stat.title} className="border-border/50">
|
|
237
|
+
<CardContent className="pt-6">
|
|
238
|
+
<div className="flex items-center justify-between">
|
|
239
|
+
<div>
|
|
240
|
+
<p className="text-sm text-foreground mb-1">{stat.title}</p>
|
|
241
|
+
<p className="text-2xl font-bold">{stat.value}</p>
|
|
242
|
+
</div>
|
|
243
|
+
<div className={cn('p-3 rounded-lg', stat.bgColor)}>
|
|
244
|
+
<Icon className={cn('w-6 h-6', stat.color)} />
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</CardContent>
|
|
248
|
+
</Card>
|
|
249
|
+
);
|
|
250
|
+
})}
|
|
251
|
+
</motion.div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
{/* View Mode Selector */}
|
|
255
|
+
<motion.div variants={itemVariants} className="flex gap-2">
|
|
256
|
+
{viewModes.map((mode) => {
|
|
257
|
+
const Icon = mode.icon;
|
|
258
|
+
return (
|
|
259
|
+
<Button
|
|
260
|
+
key={mode.value}
|
|
261
|
+
variant={viewMode === mode.value ? 'default' : 'outline'}
|
|
262
|
+
onClick={() => setViewMode(mode.value)}
|
|
263
|
+
className="flex-1 gap-2"
|
|
264
|
+
>
|
|
265
|
+
<Icon className="w-4 h-4" />
|
|
266
|
+
<div className="flex flex-col items-start">
|
|
267
|
+
<span className="font-semibold">{mode.label}</span>
|
|
268
|
+
<span className="text-xs opacity-70">{mode.description}</span>
|
|
269
|
+
</div>
|
|
270
|
+
</Button>
|
|
271
|
+
);
|
|
272
|
+
})}
|
|
273
|
+
</motion.div>
|
|
274
|
+
|
|
275
|
+
{/* Charts */}
|
|
276
|
+
<motion.div variants={itemVariants} className="grid grid-cols-1 gap-6">
|
|
277
|
+
{/* Documents Processed Chart */}
|
|
278
|
+
<Card>
|
|
279
|
+
<CardHeader>
|
|
280
|
+
<CardTitle className="flex items-center gap-2">
|
|
281
|
+
<TrendingUp className="w-5 h-5" />
|
|
282
|
+
Documents Processed Over Time
|
|
283
|
+
</CardTitle>
|
|
284
|
+
<CardDescription>
|
|
285
|
+
Track document processing trends across{' '}
|
|
286
|
+
{viewMode === 'daily' ? 'days' : viewMode === 'weekly' ? 'weeks' : 'months'}
|
|
287
|
+
</CardDescription>
|
|
288
|
+
</CardHeader>
|
|
289
|
+
<CardContent>
|
|
290
|
+
<ResponsiveContainer width="100%" height={300}>
|
|
291
|
+
<LineChart data={chartData} onMouseMove={handleChartMouseMove} onMouseLeave={handleChartMouseLeave}>
|
|
292
|
+
<CartesianGrid strokeDasharray="3 3" className="stroke-border" />
|
|
293
|
+
<XAxis
|
|
294
|
+
dataKey="date"
|
|
295
|
+
tick={{ fontSize: 12, fill: 'var(--color-foreground)' }}
|
|
296
|
+
angle={-45}
|
|
297
|
+
textAnchor="end"
|
|
298
|
+
height={80}
|
|
299
|
+
/>
|
|
300
|
+
<YAxis tick={{ fontSize: 12, fill: 'var(--color-foreground)' }} />
|
|
301
|
+
<Tooltip content={() => null} />
|
|
302
|
+
<Legend />
|
|
303
|
+
<Line
|
|
304
|
+
type="monotone"
|
|
305
|
+
dataKey="Documents"
|
|
306
|
+
stroke="hsl(142, 76%, 36%)"
|
|
307
|
+
strokeWidth={2}
|
|
308
|
+
dot={{ r: 4 }}
|
|
309
|
+
/>
|
|
310
|
+
</LineChart>
|
|
311
|
+
</ResponsiveContainer>
|
|
312
|
+
</CardContent>
|
|
313
|
+
</Card>
|
|
314
|
+
|
|
315
|
+
{/* Hyperlinks Checked Chart */}
|
|
316
|
+
<Card>
|
|
317
|
+
<CardHeader>
|
|
318
|
+
<CardTitle className="flex items-center gap-2">
|
|
319
|
+
<TrendingUp className="w-5 h-5" />
|
|
320
|
+
Hyperlinks Checked Over Time
|
|
321
|
+
</CardTitle>
|
|
322
|
+
<CardDescription>
|
|
323
|
+
Track hyperlink validation trends across{' '}
|
|
324
|
+
{viewMode === 'daily' ? 'days' : viewMode === 'weekly' ? 'weeks' : 'months'}
|
|
325
|
+
</CardDescription>
|
|
326
|
+
</CardHeader>
|
|
327
|
+
<CardContent>
|
|
328
|
+
<ResponsiveContainer width="100%" height={300}>
|
|
329
|
+
<LineChart data={chartData} onMouseMove={handleChartMouseMove} onMouseLeave={handleChartMouseLeave}>
|
|
330
|
+
<CartesianGrid strokeDasharray="3 3" className="stroke-border" />
|
|
331
|
+
<XAxis
|
|
332
|
+
dataKey="date"
|
|
333
|
+
tick={{ fontSize: 12, fill: 'var(--color-foreground)' }}
|
|
334
|
+
angle={-45}
|
|
335
|
+
textAnchor="end"
|
|
336
|
+
height={80}
|
|
337
|
+
/>
|
|
338
|
+
<YAxis tick={{ fontSize: 12, fill: 'var(--color-foreground)' }} />
|
|
339
|
+
<Tooltip content={() => null} />
|
|
340
|
+
<Legend />
|
|
341
|
+
<Line
|
|
342
|
+
type="monotone"
|
|
343
|
+
dataKey="Hyperlinks"
|
|
344
|
+
stroke="hsl(221, 83%, 53%)"
|
|
345
|
+
strokeWidth={2}
|
|
346
|
+
dot={{ r: 4 }}
|
|
347
|
+
/>
|
|
348
|
+
</LineChart>
|
|
349
|
+
</ResponsiveContainer>
|
|
350
|
+
</CardContent>
|
|
351
|
+
</Card>
|
|
352
|
+
|
|
353
|
+
{/* Bar Chart */}
|
|
354
|
+
<Card>
|
|
355
|
+
<CardHeader>
|
|
356
|
+
<CardTitle className="flex items-center gap-2">
|
|
357
|
+
<BarChart3 className="w-5 h-5" />
|
|
358
|
+
Activity Breakdown
|
|
359
|
+
</CardTitle>
|
|
360
|
+
<CardDescription>Compare different metrics side by side</CardDescription>
|
|
361
|
+
</CardHeader>
|
|
362
|
+
<CardContent>
|
|
363
|
+
<ResponsiveContainer width="100%" height={300}>
|
|
364
|
+
<BarChart data={chartData} onMouseMove={handleChartMouseMove} onMouseLeave={handleChartMouseLeave}>
|
|
365
|
+
<CartesianGrid strokeDasharray="3 3" className="stroke-border" />
|
|
366
|
+
<XAxis
|
|
367
|
+
dataKey="date"
|
|
368
|
+
tick={{ fontSize: 12, fill: 'var(--color-foreground)' }}
|
|
369
|
+
angle={-45}
|
|
370
|
+
textAnchor="end"
|
|
371
|
+
height={80}
|
|
372
|
+
/>
|
|
373
|
+
<YAxis tick={{ fontSize: 12, fill: 'var(--color-foreground)' }} />
|
|
374
|
+
<Tooltip content={() => null} />
|
|
375
|
+
<Legend />
|
|
376
|
+
<Bar dataKey="Feedback" fill="hsl(280, 100%, 70%)" />
|
|
377
|
+
<Bar dataKey="Time (min)" fill="hsl(25, 95%, 53%)" />
|
|
378
|
+
</BarChart>
|
|
379
|
+
</ResponsiveContainer>
|
|
380
|
+
</CardContent>
|
|
381
|
+
</Card>
|
|
382
|
+
</motion.div>
|
|
383
|
+
|
|
384
|
+
</motion.div>
|
|
385
|
+
);
|
|
386
|
+
});
|