All checks were successful
Build / build (push) Successful in 1m20s
## Major Reorganization
Reorganized all 57 TypeScript files from flat src/ directory into logical subdirectories for improved maintainability and discoverability.
## New Directory Structure
```
src/
├── core/ (4 files)
│ └── Foundation modules: defaultScene, gameConfig, debug, router
│
├── ship/ (10 files)
│ ├── Ship coordination and subsystems
│ └── input/ - VR controller and keyboard input
│
├── levels/ (10 files)
│ ├── config/ - Level schema, serialization, deserialization
│ ├── generation/ - Level generator and editor
│ └── ui/ - Level selector
│
├── environment/ (11 files)
│ ├── asteroids/ - Rock factory and explosions
│ ├── celestial/ - Suns, planets, textures
│ ├── stations/ - Star base loading
│ └── background/ - Stars, mirror, radar
│
├── ui/ (9 files)
│ ├── hud/ - Scoreboard and status screen
│ ├── screens/ - Login, settings, preloader
│ └── widgets/ - Discord integration
│
├── replay/ (7 files)
│ ├── Replay system components
│ └── recording/ - Physics recording and storage
│
├── game/ (3 files)
│ └── Game systems: stats, progression, demo
│
├── services/ (2 files)
│ └── External integrations: auth, social
│
└── utils/ (5 files)
└── Shared utilities and helpers
```
## Changes Made
### File Moves (57 files)
- Core modules: 4 files → core/
- Ship system: 10 files → ship/ + ship/input/
- Level system: 10 files → levels/ (+ 3 subdirs)
- Environment: 11 files → environment/ (+ 4 subdirs)
- UI components: 9 files → ui/ (+ 3 subdirs)
- Replay system: 7 files → replay/ + replay/recording/
- Game systems: 3 files → game/
- Services: 2 files → services/
- Utilities: 5 files → utils/
### Import Path Updates
- Updated ~200 import statements across all files
- Fixed relative paths based on new directory structure
- Fixed case-sensitive import issues (physicsRecorder, physicsStorage)
- Ensured consistent lowercase filenames for imports
## Benefits
1. **Easy Navigation** - Related code grouped together
2. **Clear Boundaries** - Logical separation of concerns
3. **Scalability** - Easy pattern for adding new features
4. **Discoverability** - Find ship code in /ship, levels in /levels, etc.
5. **Maintainability** - Isolated modules easier to update
6. **No Circular Dependencies** - Clean dependency graph maintained
## Testing
- All TypeScript compilation errors resolved
- Build succeeds with new structure
- Import paths verified and corrected
- Case-sensitivity issues fixed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
92 lines
3.0 KiB
TypeScript
92 lines
3.0 KiB
TypeScript
import { AuthService } from '../../services/authService';
|
|
|
|
/**
|
|
* Creates and displays the login screen UI
|
|
* Shown when user is not authenticated
|
|
*/
|
|
export function showLoginScreen(): void {
|
|
const container = document.querySelector('#levelSelect');
|
|
if (!container) {
|
|
console.error('Level select container not found');
|
|
return;
|
|
}
|
|
|
|
container.innerHTML = `
|
|
<div class="login-screen" style="position: relative; z-index: 1;">
|
|
<div class="login-container">
|
|
<h1 class="login-title">Space Combat VR</h1>
|
|
|
|
<p class="login-subtitle">
|
|
Welcome, pilot! Authentication required to access your mission data and track your progress across the galaxy.
|
|
</p>
|
|
|
|
<button id="loginBtn" class="login-button">
|
|
Log In / Sign Up
|
|
</button>
|
|
|
|
<p class="login-skip" style="color: #666; font-size: 0.9em; margin-top: 30px;">
|
|
Secured by Auth0
|
|
</p>
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
// Attach login handler
|
|
const loginBtn = document.getElementById('loginBtn');
|
|
if (loginBtn) {
|
|
loginBtn.addEventListener('click', async () => {
|
|
loginBtn.textContent = 'Redirecting...';
|
|
loginBtn.setAttribute('disabled', 'true');
|
|
const authService = AuthService.getInstance();
|
|
await authService.login();
|
|
});
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Updates the user profile display in the header
|
|
* Shows username and logout button when authenticated, or login button when not
|
|
* @param username - The username to display, or null to show login button
|
|
*/
|
|
export function updateUserProfile(username: string | null): void {
|
|
const profileContainer = document.getElementById('userProfile');
|
|
if (!profileContainer) return;
|
|
|
|
if (username) {
|
|
// User is authenticated - show profile and logout
|
|
profileContainer.className = 'user-profile';
|
|
profileContainer.innerHTML = `
|
|
<span class="user-profile-name">
|
|
Welcome, ${username}
|
|
</span>
|
|
<button id="logoutBtn" class="user-profile-button">
|
|
Log Out
|
|
</button>
|
|
`;
|
|
|
|
const logoutBtn = document.getElementById('logoutBtn');
|
|
if (logoutBtn) {
|
|
logoutBtn.addEventListener('click', async () => {
|
|
const authService = AuthService.getInstance();
|
|
await authService.logout();
|
|
});
|
|
}
|
|
} else {
|
|
// User not authenticated - show login/signup button
|
|
profileContainer.className = '';
|
|
profileContainer.innerHTML = `
|
|
<button id="loginBtn" class="user-profile-button">
|
|
Sign Up / Log In
|
|
</button>
|
|
`;
|
|
|
|
const loginBtn = document.getElementById('loginBtn');
|
|
if (loginBtn) {
|
|
loginBtn.addEventListener('click', async () => {
|
|
const authService = AuthService.getInstance();
|
|
await authService.login();
|
|
});
|
|
}
|
|
}
|
|
}
|