Refactor/abstraction - #17
Merged
Merged
Conversation
…Page into hooks and modular components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR decomposes the large monolithic route components (
ProjectListPage.tsxandProjectEditorPage.tsx) as well asApp.tsxinto decoupled custom hooks and specialized presentation components.Overall, this reduces the line count of the main route views by 80% (from 1,356 down to 268 lines), strictly separating business logic and side effects from UI presentation while preserving 100% of existing behavior, styling, and internationalization.
Overview of Line Reductions
Key Changes
1. App Shell Decomposition (
App.tsx)Header,ThemeToggle, andUnsavedChangesDialog.Headernow communicates navigation requests via anonBackcallback prop, whileUnsavedChangesDialogproperly executesonCloseandonConfirm, decoupling them from root navigation state.2. Project List Modularization (
ProjectListPage.tsx)useProjectList: Encapsulates project queries, search filtering, project duplication (with ID remapping), deletion, workspace importing, and group mutations.useProjectShortcuts: Isolates numbered shortcut calculation (⌘1–⌘9 / Ctrl+1..9) and registers global keydown listeners.src/components/projects/):ProjectListHeader: Top actions bar with search input and creation/import buttons.ProjectTable: Reusable data table with project selection, status badges, and action dropdowns.ProjectGroupSection: Collapsible group and ungrouped project containers.BatchActionBar: Fixed bottom toolbar for bulk actions (Launch selected, Group selected).DeleteProjectDialog: Standalone project deletion confirmation modal.EmptyProjectsState: Dedicated views for empty project lists and zero search results.3. Project Editor Modularization (
ProjectEditorPage.tsx)useProjectEditor: Manages project loading with fallback sanitization, dirty state tracking against initial payload, ⌘S shortcut listener, folder operations (with terminal ID healing), and split terminal management.src/components/editor/):ProjectBasicInfoSection: Name, Group, and target IDE selection with macOS Terminal permissions notice.ProjectFoldersSection: Folder list with auto-detect trigger and directory deletion.WorkspacePreviewSection: Expandable workspace script / JSON preview block.EditorBottomBar: Fixed action footer for saving and launching.Verification & Testing
npx tsc --noEmitpassed with 0 errors.npm run buildcompleted successfully.cargo test --workspacepassed cleanly.