Skip to content

Conversation

@gges5110
Copy link
Owner

@gges5110 gges5110 commented Nov 1, 2025

No description provided.

gges5110 and others added 6 commits October 30, 2025 22:00
Eliminated the SectionCollapse component from CardsSection, GemsSection, and NoblesSection, replacing it with direct Box layout. Also deleted the SectionCollapse component file, simplifying the UI and reducing unnecessary collapsible wrappers.
This commit implements a comprehensive project reorganization using Option 4
(Hybrid Approach) to improve code findability, clarify dependencies, and
establish clear architectural boundaries.

## Major Changes

### New Directory Structure
- `app/` - Application core (entry point, routing, layout, TitleBar)
- `features/` - Feature modules (game-board, lobby, history)
- `shared/` - Reusable code (components, hooks, types, utils)
- `data/` - Game constants (cards, nobles)
- `state/` - Global state management (atoms)
- `services/` - External integrations (repository, firebase, theme)
- `config/` - Application configuration
- `engine/` - Game logic (unchanged)

### Key Improvements

1. **Consistent Naming Conventions**
   - All hooks renamed to camelCase (e.g., UseLocalMatchInfo → useLocalMatchInfo)
   - Changed .tsx to .ts for files without JSX
   - Proper file naming throughout

2. **Clear Separation of Concerns**
   - Moved misplaced hooks from components to appropriate directories
   - Split large files (constants.tsx → cards.ts + nobles.ts)
   - Separated types from implementation
   - Created dedicated directories for different concerns

3. **Improved Dependency Direction**
   - Utils no longer import from components
   - One-way dependencies: features → shared → data/types
   - Clear module boundaries

4. **Reduced Nesting**
   - Flattened single-file folders (ActionButton, ResetButton)
   - Organized components by feature instead of deep nesting
   - Maximum 3-4 levels of nesting

5. **Better Code Organization**
   - Feature-based structure for related functionality
   - Centralized shared code
   - Added barrel exports (index.ts) for cleaner imports

### Files Moved/Reorganized
- 93 files moved/renamed
- Old directories removed (components, pages, interfaces, styles, etc.)
- All imports updated throughout codebase

### Validation
- ✓ All 38 tests passing (9 test files)
- ✓ Build successful
- ✓ No runtime errors

This reorganization addresses the main pain points:
- Finding files is now easier with clear feature boundaries
- Understanding dependencies is clearer with proper directory structure
- Overall project structure is more maintainable and scalable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused playerName import and variable in Lobby.tsx
- Resolves ESLint no-unused-vars warning
- 8 remaining warnings are TypeScript any type warnings in engine files

✓ All tests passing (38/38)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Standardize quotes (single -> double) across barrel exports
- Format JSON files with proper indentation
- Apply consistent code formatting project-wide

✓ All tests passing (38/38)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Moved AI logic from AI.tsx to a new ai/ directory with separate modules for gem picking, scoring, and utilities. Updated enumerateAIMoves to select only the best move with controlled randomness and improved gem picking prioritization (always picks 3 gems if possible, otherwise 2 of same color). Updated tests to match new AI behavior and fixed imports. Removed unnecessary console log from remote.ts.
@gges5110 gges5110 merged commit d8c3af1 into main Nov 1, 2025
1 check failed
@gges5110 gges5110 deleted the cleanup branch November 1, 2025 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants