7 Commits

Author SHA1 Message Date
Reece Browne
9b14609236 feat: Introduce new file context management with hooks and lifecycle management
- Added new contexts for file state and actions to improve performance.
- Implemented unified file actions with a single `addFiles` helper for various file types.
- Created performant hooks for accessing file state and actions, including selection and management.
- Developed file selectors for efficient state access.
- Introduced a lifecycle manager for resource cleanup and memory management.
- Updated HomePage and tool components to utilize new navigation actions.
- Refactored file context types to streamline state management and remove legacy compatibility.
2025-08-18 21:00:19 +01:00
Reece Browne
25a721e71e Fix post merge issues 2025-08-15 00:59:55 +01:00
Reece Browne
eb2444142f Merge remote-tracking branch 'origin/V2' into feature/v2/file-handling-improvements 2025-08-15 00:52:36 +01:00
Reece Browne
ffecaa9e1c Refactor integration tests for Convert Tool, enhancing error handling and API call verification
- Updated integration tests in ConvertIntegration.test.tsx to include additional parameters for conversion options.
- Improved error handling for API responses and network errors.
- Enhanced mock implementations for axios calls to ensure accurate testing of conversion operations.
- Added tests for smart detection functionality in ConvertSmartDetectionIntegration.test.tsx, covering various file types and conversion scenarios.
- Refined mantineTheme.ts by removing unused font weights and ensuring type safety in component customizations.
- Updated fileContext.ts and pageEditor.ts to improve type definitions and ensure consistency across the application.
- Enhanced fileUtils.ts with additional methods for file handling and improved error logging.
- Refactored thumbnailUtils.ts to optimize thumbnail generation logic and improve memory management.
- Made minor adjustments to toolOperationTracker.ts for better type handling.
2025-08-11 16:40:38 +01:00
James Brunton
af5a9d1ae1
Enforce type checking in CI (#4126)
# Description of Changes
Currently, the `tsconfig.json` file enforces strict type checking, but
nothing in CI checks that the code is actually correctly typed. [Vite
only transpiles TypeScript
code](https://vite.dev/guide/features.html#transpile-only) so doesn't
ensure that the TS code we're running is correct.

This PR adds running of the type checker to CI and fixes the type errors
that have already crept into the codebase.

Note that many of the changes I've made to 'fix the types' are just
using `any` to disable the type checker because the code is under too
much churn to fix anything properly at the moment. I still think
enabling the type checker now is the best course of action though
because otherwise we'll never be able to fix all of them, and it should
at least help us not break things when adding new code.

Co-authored-by: James <james@crosscourtanalytics.com>
2025-08-11 09:16:16 +01:00
Reece Browne
02f4f7abaf Refactor file management context and remove FileSelectionContext- Updated FileManagerContext to use useMemo for context value optimization.- Removed FileSelectionContext and integrated its functionality into FileContext.- Updated hooks and components to use new file context structure.- Refactored file handling logic to utilize stable file IDs for deduplication.- Adjusted UI state management for improved performance and clarity.- Updated theme variables for consistency in hover and selection states.- Ensured backward compatibility with legacy properties in FileContext. 2025-08-10 21:08:32 +01:00
ConnorYoh
b45d3a43d4
V2 Restructure homepage (#4138)
Component Extraction & Context Refactor - Summary

  🔧 What We Did

- Extracted HomePage's 286-line monolithic component into focused parts
  - Created ToolPanel (105 lines) for tool selection UI
  - Created Workbench (203 lines) for view management
  - Created ToolWorkflowContext (220 lines) for centralized state
  - Reduced HomePage to 60 lines of provider setup
  - Eliminated all prop drilling - components use contexts directly

  🏆 Why This is Good

- Maintainability: Each component has single purpose, easy
debugging/development
- Architecture: Clean separation of concerns, future features easier to
add
- Code Quality: 105% more lines but organized/purposeful vs tangled
spaghetti code

---------

Co-authored-by: Connor Yoh <connor@stirlingpdf.com>
Co-authored-by: James Brunton <jbrunton96@gmail.com>
2025-08-08 15:56:20 +01:00