Restructure app for best practices and simplicity#7
Conversation
High-impact restructuring to reduce complexity and improve maintainability: CONSOLIDATED UTILITIES (24 files → 6 files): - summary.ts: Merged summaryConstants, summaryGrouping, summaryHelpers - filtering.ts: Merged filterUtils, viewFiltering, resultsUtils - githubData.ts: Merged rawDataUtils, prEnrichment - storage.ts: Merged storageUtils, indexedDB, usernameCache BENEFITS: - Fewer files to navigate (easier to find code) - Logical grouping by domain (summary, filtering, data, storage) - Cleaner imports (one import instead of many) - Foundation for fast iterations All imports updated across codebase and test files.
There was a problem hiding this comment.
Pull request overview
This PR consolidates utility files to improve code organization and maintainability by merging 24 utility files into 6 domain-focused modules (summary, filtering, githubData, storage), making the codebase easier to navigate and reducing import complexity.
Key Changes:
- Merged summary-related utilities (summaryConstants, summaryGrouping, summaryHelpers) into
summary.ts - Merged filtering utilities (filterUtils, viewFiltering, resultsUtils) into
filtering.ts - Merged GitHub data utilities (rawDataUtils, prEnrichment) into
githubData.ts - Merged storage utilities (storageUtils, indexedDB, usernameCache) into
storage.ts
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/Summary.tsx | Updated imports to use consolidated filtering and summary modules |
| src/views/IssuesAndPRsList.tsx | Updated imports to use consolidated filtering module |
| src/views/EventView.tsx | Updated imports to use consolidated filtering module |
| src/utils/summary.ts | New consolidated file containing all summary-related constants, grouping logic, and helper functions |
| src/utils/filtering.ts | New consolidated file containing all filtering, search parsing, and sorting utilities |
| src/utils/githubData.ts | New consolidated file containing event transformation, raw data processing, and PR enrichment |
| src/utils/storage.ts | New consolidated file containing localStorage, IndexedDB, and username cache utilities |
| src/utils/viewFiltering.ts | Deleted - functionality moved to filtering.ts |
| src/utils/summaryHelpers.ts | Deleted - functionality moved to summary.ts |
| src/utils/summaryConstants.ts | Deleted - functionality moved to summary.ts |
| src/utils/storageUtils.ts | Deleted - functionality moved to storage.ts |
| src/utils/usernameCache.ts | Deleted - functionality moved to storage.ts |
| src/utils/prEnrichment.ts | Deleted - functionality moved to githubData.ts |
| src/utils/indexedDB.ts | Deleted - functionality moved to storage.ts |
| src/utils/filterUtils.ts | Deleted - functionality moved to filtering.ts |
| Various test files | Updated imports to reference new consolidated modules |
| src/hooks/* | Updated imports to reference new consolidated modules |
| src/components/SettingsDialog.tsx | Updated imports to reference new consolidated modules |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const { needValidation: needsVal } = categorizeUsernames(usernames, validatedCache, invalidCache); | ||
| return needsVal.length > 0; |
There was a problem hiding this comment.
Variable name needsVal is abbreviated and unclear. Rename to needsValidationList or usernamesNeedingValidation for clarity.
| const { needValidation: needsVal } = categorizeUsernames(usernames, validatedCache, invalidCache); | |
| return needsVal.length > 0; | |
| const { needValidation: needsValidationList } = categorizeUsernames(usernames, validatedCache, invalidCache); | |
| return needsValidationList.length > 0; |
| */ | ||
| export const parseUsernames = (username: string): string[] => { | ||
| return username.split(',').map(u => u.trim().toLowerCase()); | ||
| return username.split(',').map((u) => u.trim().toLowerCase()); |
There was a problem hiding this comment.
Parameter name u is too generic. Rename to username or user for better readability.
| return username.split(',').map((u) => u.trim().toLowerCase()); | |
| return username.split(',').map((user) => user.trim().toLowerCase()); |
|
@copilot it seems the build fails now with Error: src/hooks/useLocalStorage.ts(141,59): error TS2307: Cannot find module '../utils/storageUtils' or its corresponding type declarations. |
Co-authored-by: kertal <463851+kertal@users.noreply.github.com>
Fix build errors from incomplete import path updates
High-impact restructuring to reduce complexity and improve maintainability:
CONSOLIDATED UTILITIES (24 files → 6 files):
BENEFITS:
All imports updated across codebase and test files.