feat: implement complete Phase 2 frontend foundation with React 18
Major milestone: Frontend implementation complete for Shattered Void MMO FRONTEND IMPLEMENTATION: - React 18 + TypeScript + Vite development environment - Tailwind CSS with custom dark theme for sci-fi aesthetic - Zustand state management with authentication persistence - Socket.io WebSocket client with auto-reconnection - Protected routing with authentication guards - Responsive design with mobile-first approach AUTHENTICATION SYSTEM: - Login/register forms with comprehensive validation - JWT token management with localStorage persistence - Password strength validation and user feedback - Protected routes and authentication guards CORE GAME INTERFACE: - Colony management dashboard with real-time updates - Resource display with live production tracking - WebSocket integration for real-time game events - Navigation with connection status indicator - Toast notifications for user feedback BACKEND ENHANCEMENTS: - Complete Research System with technology tree (23 technologies) - Fleet Management System with ship designs and movement - Enhanced Authentication with email verification and password reset - Complete game tick integration for all systems - Advanced WebSocket events for real-time updates ARCHITECTURE FEATURES: - Type-safe TypeScript throughout - Component-based architecture with reusable UI elements - API client with request/response interceptors - Error handling and loading states - Performance optimized builds with code splitting Phase 2 Status: Frontend foundation complete (Week 1-2 objectives met) Ready for: Colony management, fleet operations, research interface Next: Enhanced gameplay features and admin interface 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8d9ef427be
commit
d41d1e8125
130 changed files with 33588 additions and 14817 deletions
|
|
@ -64,4 +64,4 @@ router.post('/reset-password', asyncHandler(async (req, res) => {
|
|||
});
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -7,42 +7,42 @@ const express = require('express');
|
|||
const router = express.Router();
|
||||
|
||||
const {
|
||||
createColony,
|
||||
getPlayerColonies,
|
||||
getColonyDetails,
|
||||
constructBuilding,
|
||||
getBuildingTypes,
|
||||
getPlanetTypes,
|
||||
getGalaxySectors
|
||||
createColony,
|
||||
getPlayerColonies,
|
||||
getColonyDetails,
|
||||
constructBuilding,
|
||||
getBuildingTypes,
|
||||
getPlanetTypes,
|
||||
getGalaxySectors,
|
||||
} = require('../../controllers/player/colony.controller');
|
||||
|
||||
const { validateRequest } = require('../../middleware/validation.middleware');
|
||||
const {
|
||||
createColonySchema,
|
||||
constructBuildingSchema,
|
||||
colonyIdParamSchema
|
||||
createColonySchema,
|
||||
constructBuildingSchema,
|
||||
colonyIdParamSchema,
|
||||
} = require('../../validators/colony.validators');
|
||||
|
||||
// Colony CRUD operations
|
||||
router.post('/',
|
||||
validateRequest(createColonySchema),
|
||||
createColony
|
||||
router.post('/',
|
||||
validateRequest(createColonySchema),
|
||||
createColony,
|
||||
);
|
||||
|
||||
router.get('/',
|
||||
getPlayerColonies
|
||||
router.get('/',
|
||||
getPlayerColonies,
|
||||
);
|
||||
|
||||
router.get('/:colonyId',
|
||||
validateRequest(colonyIdParamSchema, 'params'),
|
||||
getColonyDetails
|
||||
router.get('/:colonyId',
|
||||
validateRequest(colonyIdParamSchema, 'params'),
|
||||
getColonyDetails,
|
||||
);
|
||||
|
||||
// Building operations
|
||||
router.post('/:colonyId/buildings',
|
||||
validateRequest(colonyIdParamSchema, 'params'),
|
||||
validateRequest(constructBuildingSchema),
|
||||
constructBuilding
|
||||
router.post('/:colonyId/buildings',
|
||||
validateRequest(colonyIdParamSchema, 'params'),
|
||||
validateRequest(constructBuildingSchema),
|
||||
constructBuilding,
|
||||
);
|
||||
|
||||
// Reference data endpoints
|
||||
|
|
@ -50,4 +50,4 @@ router.get('/ref/building-types', getBuildingTypes);
|
|||
router.get('/ref/planet-types', getPlanetTypes);
|
||||
router.get('/ref/galaxy-sectors', getGalaxySectors);
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Player Events Routes
|
||||
* Handles player event history and notifications
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// TODO: Implement events routes
|
||||
router.get('/', (req, res) => {
|
||||
res.json({
|
||||
message: 'Events routes not yet implemented',
|
||||
available_endpoints: {
|
||||
'/history': 'Get event history',
|
||||
'/recent': 'Get recent events',
|
||||
'/unread': 'Get unread events'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/history', (req, res) => {
|
||||
res.json({ message: 'Event history endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/recent', (req, res) => {
|
||||
res.json({ message: 'Recent events endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/unread', (req, res) => {
|
||||
res.json({ message: 'Unread events endpoint not implemented' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Player Fleet Routes
|
||||
* Handles fleet management and operations
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const fleetController = require('../../controllers/api/fleet.controller');
|
||||
|
||||
// Fleet management routes
|
||||
router.get('/', fleetController.getPlayerFleets);
|
||||
router.post('/', fleetController.createFleet);
|
||||
router.get('/:fleetId', fleetController.getFleetDetails);
|
||||
router.delete('/:fleetId', fleetController.disbandFleet);
|
||||
|
||||
// Fleet operations
|
||||
router.post('/:fleetId/move', fleetController.moveFleet);
|
||||
|
||||
// TODO: Combat operations (will be implemented when combat system is enhanced)
|
||||
router.post('/:fleetId/attack', (req, res) => {
|
||||
res.status(501).json({
|
||||
success: false,
|
||||
error: 'Not implemented',
|
||||
message: 'Fleet combat operations will be available in a future update'
|
||||
});
|
||||
});
|
||||
|
||||
// Ship design routes
|
||||
router.get('/ship-designs/classes', fleetController.getShipClassesInfo);
|
||||
router.get('/ship-designs/:designId', fleetController.getShipDesignDetails);
|
||||
router.get('/ship-designs', fleetController.getAvailableShipDesigns);
|
||||
|
||||
// Ship construction validation
|
||||
router.post('/validate-construction', fleetController.validateShipConstruction);
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Player Galaxy Routes
|
||||
* Handles galaxy exploration and sector viewing
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// TODO: Implement galaxy routes
|
||||
router.get('/', (req, res) => {
|
||||
res.json({
|
||||
message: 'Galaxy routes not yet implemented',
|
||||
available_endpoints: {
|
||||
'/sectors': 'List galaxy sectors',
|
||||
'/explore': 'Explore new areas',
|
||||
'/map': 'View galaxy map'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/sectors', (req, res) => {
|
||||
res.json({ message: 'Galaxy sectors endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/explore', (req, res) => {
|
||||
res.json({ message: 'Galaxy exploration endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/map', (req, res) => {
|
||||
res.json({ message: 'Galaxy map endpoint not implemented' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -47,4 +47,4 @@ router.get('/status', authenticateToken('player'), asyncHandler(async (req, res)
|
|||
});
|
||||
}));
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Player Notifications Routes
|
||||
* Handles player notifications and messages
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// TODO: Implement notifications routes
|
||||
router.get('/', (req, res) => {
|
||||
res.json({
|
||||
message: 'Notifications routes not yet implemented',
|
||||
available_endpoints: {
|
||||
'/unread': 'Get unread notifications',
|
||||
'/all': 'Get all notifications',
|
||||
'/mark-read': 'Mark notifications as read'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/unread', (req, res) => {
|
||||
res.json({ message: 'Unread notifications endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/all', (req, res) => {
|
||||
res.json({ message: 'All notifications endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.post('/mark-read', (req, res) => {
|
||||
res.json({ message: 'Mark notifications read endpoint not implemented' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Player Profile Routes
|
||||
* Handles player profile management
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// TODO: Implement profile routes
|
||||
router.get('/', (req, res) => {
|
||||
res.json({
|
||||
message: 'Profile routes not yet implemented',
|
||||
available_endpoints: {
|
||||
'/': 'Get player profile',
|
||||
'/update': 'Update player profile',
|
||||
'/settings': 'Get/update player settings'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
router.put('/', (req, res) => {
|
||||
res.json({ message: 'Profile update endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.get('/settings', (req, res) => {
|
||||
res.json({ message: 'Profile settings endpoint not implemented' });
|
||||
});
|
||||
|
||||
router.put('/settings', (req, res) => {
|
||||
res.json({ message: 'Profile settings update endpoint not implemented' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* Player Research Routes
|
||||
* Handles research and technology management
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// Import controllers and middleware
|
||||
const researchController = require('../../controllers/api/research.controller');
|
||||
const {
|
||||
validateStartResearch,
|
||||
validateTechnologyTreeFilter,
|
||||
validateResearchStats
|
||||
} = require('../../validators/research.validators');
|
||||
|
||||
/**
|
||||
* Get current research status for the authenticated player
|
||||
* GET /player/research/
|
||||
*/
|
||||
router.get('/', researchController.getResearchStatus);
|
||||
|
||||
/**
|
||||
* Get available technologies for research
|
||||
* GET /player/research/available
|
||||
*/
|
||||
router.get('/available', researchController.getAvailableTechnologies);
|
||||
|
||||
/**
|
||||
* Get completed technologies
|
||||
* GET /player/research/completed
|
||||
*/
|
||||
router.get('/completed', researchController.getCompletedTechnologies);
|
||||
|
||||
/**
|
||||
* Get full technology tree with player progress
|
||||
* GET /player/research/technology-tree
|
||||
* Query params: category, tier, status, include_unavailable, sort_by, sort_order
|
||||
*/
|
||||
router.get('/technology-tree',
|
||||
validateTechnologyTreeFilter,
|
||||
researchController.getTechnologyTree
|
||||
);
|
||||
|
||||
/**
|
||||
* Get research queue (current and queued research)
|
||||
* GET /player/research/queue
|
||||
*/
|
||||
router.get('/queue', researchController.getResearchQueue);
|
||||
|
||||
/**
|
||||
* Start research on a technology
|
||||
* POST /player/research/start
|
||||
* Body: { technology_id: number }
|
||||
*/
|
||||
router.post('/start',
|
||||
validateStartResearch,
|
||||
researchController.startResearch
|
||||
);
|
||||
|
||||
/**
|
||||
* Cancel current research
|
||||
* POST /player/research/cancel
|
||||
*/
|
||||
router.post('/cancel', researchController.cancelResearch);
|
||||
|
||||
module.exports = router;
|
||||
|
|
@ -7,48 +7,48 @@ const express = require('express');
|
|||
const router = express.Router();
|
||||
|
||||
const {
|
||||
getPlayerResources,
|
||||
getPlayerResourceSummary,
|
||||
getResourceProduction,
|
||||
addResources,
|
||||
transferResources,
|
||||
getResourceTypes
|
||||
getPlayerResources,
|
||||
getPlayerResourceSummary,
|
||||
getResourceProduction,
|
||||
addResources,
|
||||
transferResources,
|
||||
getResourceTypes,
|
||||
} = require('../../controllers/player/resource.controller');
|
||||
|
||||
const { validateRequest } = require('../../middleware/validation.middleware');
|
||||
const {
|
||||
transferResourcesSchema,
|
||||
addResourcesSchema,
|
||||
resourceQuerySchema
|
||||
transferResourcesSchema,
|
||||
addResourcesSchema,
|
||||
resourceQuerySchema,
|
||||
} = require('../../validators/resource.validators');
|
||||
|
||||
// Resource information endpoints
|
||||
router.get('/',
|
||||
validateRequest(resourceQuerySchema, 'query'),
|
||||
getPlayerResources
|
||||
router.get('/',
|
||||
validateRequest(resourceQuerySchema, 'query'),
|
||||
getPlayerResources,
|
||||
);
|
||||
|
||||
router.get('/summary',
|
||||
getPlayerResourceSummary
|
||||
router.get('/summary',
|
||||
getPlayerResourceSummary,
|
||||
);
|
||||
|
||||
router.get('/production',
|
||||
getResourceProduction
|
||||
router.get('/production',
|
||||
getResourceProduction,
|
||||
);
|
||||
|
||||
// Resource manipulation endpoints
|
||||
router.post('/transfer',
|
||||
validateRequest(transferResourcesSchema),
|
||||
transferResources
|
||||
router.post('/transfer',
|
||||
validateRequest(transferResourcesSchema),
|
||||
transferResources,
|
||||
);
|
||||
|
||||
// Development/testing endpoints
|
||||
router.post('/add',
|
||||
validateRequest(addResourcesSchema),
|
||||
addResources
|
||||
router.post('/add',
|
||||
validateRequest(addResourcesSchema),
|
||||
addResources,
|
||||
);
|
||||
|
||||
// Reference data endpoints
|
||||
router.get('/types', getResourceTypes);
|
||||
|
||||
module.exports = router;
|
||||
module.exports = router;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue