A comprehensive React application for interactive soccer statistics, player/team comparisons, match ratings, and community discussions.
FIFA Stats is a full-featured web application that combines data visualization, player/team comparisons, match rating systems with trend analysis, and community discussions for soccer fans. The application uses React with modern hooks, context API for state management, and includes a complete mock data system using localStorage (easily replaceable with a backend API).
- User Authentication: Complete registration and login system with protected routes (mock authentication using localStorage)
- Match Rating System: Rate players during matches with interactive 5-star ratings
- Rating Trend Visualization: Beautiful line charts showing player rating trends over time
- Match Comments: Comment system for discussing matches with other users
- Player Comparison: Side-by-side player statistics with radar chart visualization
- Team Comparison: Compare team performance metrics with visual charts
- Data Import: CSV file upload and parsing with preview functionality
- Community Forum: Discussion boards with topic filtering and post creation
- User Profiles: Personal profiles with activity statistics
- Responsive Design: Modern, beautiful UI that works seamlessly across desktop and mobile devices
-
Install dependencies:
npm install
-
Start development server:
npm start
-
Open http://localhost:3000 in your browser
Note: This application uses mock data stored in localStorage. No backend server is required. All data persists in the browser's local storage.
fifa-stats/
├── src/
│ ├── components/ # Reusable components
│ │ ├── auth/ # Login, Register, ProtectedRoute
│ │ ├── common/ # Header, Footer, shared UI
│ │ ├── community/ # Discussion boards
│ │ ├── data/ # Import, Preview, Upload
│ │ ├── rating/ # Rating panels and displays
│ │ └── visualization/ # Charts and stats cards
│ ├── pages/ # Main page components
│ │ ├── Home.jsx
│ │ ├── Dashboard.jsx
│ │ ├── PlayerComparison.jsx
│ │ ├── TeamComparison.jsx
│ │ ├── Matches.jsx # Match ratings with trend visualization
│ │ ├── Community.jsx
│ │ └── Profile.jsx
│ ├── context/ # Global state management
│ │ ├── AuthContext.jsx
│ │ └── DataContext.jsx
│ ├── services/ # Data services (mock implementation)
│ │ ├── api.js # Axios configuration (for future backend)
│ │ ├── auth.service.js # Authentication service (localStorage)
│ │ └── data.service.js # Data, matches, ratings, comments (localStorage)
│ ├── hooks/ # Custom React hooks
│ ├── utils/ # Helper functions
│ └── App.jsx # Main app component
├── public/
├── package.json
├── PROJECT_STRUCTURE.md # Detailed structure guide
├── SETUP_GUIDE.md # Complete setup instructions
└── README.md # This file
The app uses React Context for global state:
- AuthContext: Manages user authentication
- DataContext: Handles data import and comparison state
All data operations are centralized in service files (currently using localStorage):
auth.service.js: Authentication operations (register, login, token verification)data.service.js: Data management, matches, player ratings, comments, and trends
Pages requiring authentication are wrapped with ProtectedRoute component, which automatically redirects unauthenticated users to login.
Components are organized by feature:
- auth/: Authentication components
- data/: Data import and management
- visualization/: Charts and statistics display
- rating/: Rating submission and display
- community/: Social features
Login.jsx: User login formRegister.jsx: User registration with validationProtectedRoute.jsx: Route protection wrapper
DataImport.jsx: CSV file upload interfaceDataPreview.jsx: Preview imported data
RadarChart.jsx: Hexagonal comparison chart for players/teamsStatsCard.jsx: Statistics display card
Matches.jsx: Match listing and detail pagesRatingLineChart.jsx: Line chart showing rating trends over time- Interactive 5-star rating system for players during matches
- Create component in
src/pages/:
// src/pages/NewPage.jsx
import React from 'react';
const NewPage = () => {
return <div>New Page Content</div>;
};
export default NewPage;- Add route in
App.jsx:
<Route
path="/new-page"
element={
<ProtectedRoute>
<NewPage />
</ProtectedRoute>
}
/>- Open appropriate service file
- Add new method:
async newMethod(params) {
try {
const response = await api.get('/endpoint', { params });
return response.data;
} catch (error) {
throw new Error(error.response?.data?.message || 'Operation failed');
}
}Each component has a CSS file. Modify these to change appearance:
/* Component.css */
.component-container {
padding: 2rem;
background-color: #f5f5f5;
}Currently, the application uses localStorage for all data persistence:
- User accounts and authentication
- Match data and player ratings
- Rating trends over time
- Comments on matches
- Imported CSV data
To connect to a real backend API:
- Update
src/services/auth.service.jsto use actual API calls - Update
src/services/data.service.jsto use actual API calls - Configure
src/services/api.jswith your backend URL - Remove localStorage operations and replace with API calls
The service layer is designed to make this transition straightforward - simply replace the localStorage operations with API calls.
- Start development server:
npm start - Make changes to components
- Hot reload automatically updates
- Test changes in browser
- Build for production:
npm run build
- Use double spaces for indentation (tab = 2 spaces)
- Follow React best practices
- Use functional components with hooks
- Keep components focused and reusable
- Write clear, descriptive variable names
PROJECT_STRUCTURE.md: Detailed project architectureSETUP_GUIDE.md: Installation and setup instructionsCOMPONENT_TEMPLATE.jsx: Template for new components
- View all matches with scores and dates
- Rate individual players during matches (1-5 stars)
- See your personal ratings for each player
- View average ratings from all users
- Line chart visualization showing how ratings change over time
- Color-coded trends (green for high ratings, yellow for medium, red for low)
The line chart visualization provides:
- Smooth line connecting all rating data points
- Filled area under the line for visual emphasis
- Grid lines for reference (1-5 stars)
- Interactive hover tooltips showing rating and date
- Automatic color coding based on average rating
- Topic-based discussion forums
- Create and view posts
- Like and comment on posts
- Filter by topics (players, teams, matches, predictions)
- React 18.2.0: Modern React with hooks
- React Router 6.20.0: Client-side routing
- Chart.js 4.4.0: Chart visualization library
- Axios 1.6.2: HTTP client (configured for future backend)
- localStorage: Current data persistence solution
- Connect to a backend API (replace localStorage with API calls)
- Add more visualization types
- Implement real-time notifications
- Add comprehensive testing (Jest, React Testing Library)
- Optimize performance (code splitting, lazy loading)
- Add PWA features (offline support, installable)
- Enhance mobile experience
For questions or issues:
- Check
SETUP_GUIDE.mdfor detailed instructions - Review component documentation
- Examine existing components for examples
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is provided as-is for educational and development purposes.
- Home Page: Beautiful hero section with feature cards
- Dashboard: Quick actions and statistics overview
- Match Ratings: Interactive player rating with trend visualization
- Player Comparison: Side-by-side radar charts
- Community: Topic-based discussion forums
Built with ❤️ using React