🎨 Refactor components to use shared utilities, simplify state management, and improve modal implementation
This commit is contained in:
@@ -119,12 +119,42 @@ npm test -- useAsyncState
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
### Step 8: Component Refactoring (Partial)
|
||||||
|
|
||||||
|
**GamemasterManager.vue Refactoring:**
|
||||||
|
- Replaced manual `loading`, `error`, `saving` ref states with `useAsyncState` composable
|
||||||
|
- Converted `loadServerStatus()` to use api-client via useAsyncState
|
||||||
|
- Converted `fetchGamemaster()` to use api-client via useAsyncState
|
||||||
|
- Converted `saveToServer()` to use api-client via useAsyncState
|
||||||
|
- Simplified state management from 5+ refs to 3 useAsyncState instances
|
||||||
|
- Result: 679 lines (unchanged length but much cleaner state logic)
|
||||||
|
|
||||||
|
**ApiKeyManager.vue Refactoring:**
|
||||||
|
- Replaced custom modal HTML with `<BaseModal>` component
|
||||||
|
- Removed modal-overlay and modal CSS styling (now using BaseModal styles)
|
||||||
|
- Converted modal to use modelValue binding instead of manual v-if
|
||||||
|
- Added proper footer slot for modal buttons
|
||||||
|
- Imported BaseModal from shared/index.js
|
||||||
|
|
||||||
|
**Shared Components Infrastructure:**
|
||||||
|
- Created `src/components/shared/index.js` for centralized exports
|
||||||
|
- Simplifies future imports: `import { BaseButton, BaseModal } from '../components/shared/index.js'`
|
||||||
|
- Pattern ready for additional shared components
|
||||||
|
|
||||||
|
**Testing:**
|
||||||
|
- All 79 existing tests continue to pass
|
||||||
|
- Build verification successful (no syntax errors)
|
||||||
|
- Ready for next phases
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
1. Complete Step 3: Split package.json dependencies
|
1. Complete Step 9: JWT Authentication system
|
||||||
2. Create BaseButton component with tests
|
2. Proceed to Step 10-15: Feature flags with secure flag system
|
||||||
3. Create BaseModal component with tests
|
3. Begin Steps 16-24: Major component refactoring (GamemasterExplorer, ChallongeTest)
|
||||||
4. Begin refactoring existing components to use new utilities
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user