mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-02-20 07:37:26 -05:00
5.1 KiB
5.1 KiB
Proposed Interface Structure
Goals
- Clear separation between routes, components, and windows
- Related files colocated
- Intuitive naming and hierarchy
- No confusion about where files belong
Proposed Structure
src/
├── Shell.tsx # App entry point
├── ShellLayout.tsx # Layout chrome
├── router.tsx # Route configuration
├── index.tsx # Public exports
├── styles.css # Global styles
│
├── contexts/ # React contexts
│ ├── SpacedriveContext.tsx # Main client context (rename from context.tsx)
│ ├── ServerContext.tsx
│ └── PlatformContext.tsx # (rename from platform.tsx)
│
├── routes/ # Route components (what renders in <Outlet />)
│ ├── overview/
│ │ ├── index.tsx
│ │ ├── OverviewTopBar.tsx
│ │ └── ...
│ ├── explorer/ # Move from components/Explorer/
│ │ ├── ExplorerView.tsx # Main view
│ │ ├── context.tsx # Explorer state
│ │ ├── views/ # Grid, List, Column, etc.
│ │ ├── components/ # ExplorerView-specific
│ │ └── hooks/
│ ├── tag/
│ ├── file-kinds/
│ ├── settings/ # Move from Settings/
│ └── daemon/ # Rename DaemonManager
│
├── components/ # Reusable feature components
│ ├── DndProvider.tsx
│ ├── ErrorBoundary.tsx # Move from root
│ │
│ ├── Inspector/ # Consolidate all inspector code
│ │ ├── Inspector.tsx # Main container (move from root)
│ │ ├── variants/ # Inspector implementations
│ │ │ ├── FileInspector.tsx
│ │ │ ├── LocationInspector.tsx
│ │ │ ├── MultiFileInspector.tsx
│ │ │ └── KnowledgeInspector.tsx
│ │ └── primitives/ # UI components (current Inspector/ folder)
│ │ ├── Tabs.tsx
│ │ ├── Section.tsx
│ │ ├── InfoRow.tsx
│ │ └── ...
│ │
│ ├── SpacesSidebar/
│ ├── QuickPreview/
│ ├── JobManager/
│ ├── SyncMonitor/
│ ├── TabManager/
│ ├── Tags/
│ │
│ ├── modals/ # Consolidate modals
│ │ ├── CreateLibraryModal.tsx
│ │ ├── PairingModal.tsx
│ │ ├── SyncSetupModal.tsx
│ │ └── FileOperationModal.tsx
│ │
│ └── overlays/ # Overlays
│ ├── DaemonDisconnectedOverlay.tsx
│ └── DaemonStartupOverlay.tsx
│
├── windows/ # Special purpose windows
│ ├── FloatingControls.tsx
│ ├── DemoWindow.tsx
│ └── Spacedrop.tsx
│
├── demo/ # Demo/testing components
│ ├── LocationCacheDemo.tsx
│ └── SpacedropDemo.tsx
│
├── hooks/ # Global hooks
│ ├── useKeybind.ts
│ ├── useContextMenu.ts
│ ├── useClipboard.ts
│ └── ...
│
├── util/ # Utilities
│ └── keybinds/
│
└── TopBar/ # TopBar portal system
├── TopBar.tsx
├── Context.tsx
└── Portal.tsx
Migration Priority
Phase 1: Quick Wins (Low Risk)
- ✅ Move
ErrorBoundary.tsxtocomponents/ - ✅ Create
windows/and move demo/special windows - ✅ Create
demo/and move demo components - ✅ Create
components/modals/and move modals - ✅ Create
components/overlays/and move overlays
Phase 2: Consolidations (Medium Risk)
- ✅ Consolidate Inspector structure
- ✅ Rename context files and move to
contexts/ - ✅ Move Settings to routes
Phase 3: Major Restructure (Higher Risk - needs testing)
- ✅ Move ExplorerView to routes
- ✅ Update all imports
Completion Status
All phases complete! The refactor has been fully implemented:
- All files moved to their target locations
- All imports updated across the codebase
- TypeScript validation passing (no interface-related errors)
- Public exports updated in
index.tsxandcomponents/index.ts
Benefits Achieved
- Clarity: Clear where each type of file belongs
- Scalability: Easy to add new routes, components, windows
- Maintainability: Related code colocated
- Onboarding: New developers can understand structure quickly
- IDE Navigation: Better autocomplete and file search
Resolved Decisions
- ✅
ExplorerViewmoved toroutes/explorer/(primary location is routes, can be re-exported from components if needed) - ✅
platform.tsx→contexts/PlatformContext.tsx - ✅ Modals and overlays use dedicated subfolders (
components/modals/,components/overlays/)