-
Clone the repository:
git clone https://github.com/dneimke/simple-coding.git cd coding-tool -
Install dependencies:
npm install
You can run the application using any of these methods:
-
VS Code Live Server (Recommended):
- Install the Live Server extension for VS Code
- Right-click on
src/index.htmland select "Open with Live Server" - The application will open in your default browser
-
Any HTTP Server:
-
If you have Python installed:
# Python 3.x python -m http.server --directory src 8080 -
Then open
http://localhost:8080in your browser
-
-
NPM http-server package:
npm install -g http-server http-server src
The application runs entirely in the browser with no backend dependencies.
The project uses Jest for testing:
# Run tests once
npm test
# Run tests with coverage report
npm test:coverage
# Run tests in watch mode during development
npm run test:watchAfter running tests with coverage, open coverage/lcov-report/index.html in a browser to view the detailed coverage report.
-
src/- Application source codeindex.html- Main HTML entry pointmain.js- Main JavaScript entry pointcomponents/- UI components and reusable elementsservices/- Business logic services (state management, storage, etc.)utils/- Helper functions and utilitiesassets/- Static assets like icons, sample data, etc.
-
tests/- Jest test files mirroring the structure ofsrc/ -
docs/- Project documentation -
coverage/- Test coverage reports (generated when running tests with coverage)
The application follows a modular ES6 architecture with:
- Component-Based Structure: UI elements are organized into reusable components
- Service Layer: Handles business logic, data management, state, and storage
- Utility Modules: Provide helper functions for common operations
- Event-Based Communication: Components communicate through the notification service
-
Creating New Components:
- Create a new file in the appropriate directory under
src/components/ - Export your component using ES6 modules
- Import and use the component where needed
- Create a new file in the appropriate directory under
-
Adding New Features:
- Create or modify relevant components, services, or utilities
- Update the main application logic in
main.jsif necessary - Add tests for new functionality
-
Writing Tests:
- All tests are located in the
tests/directory - Tests should mirror the structure of the
src/directory - Each module should have a corresponding
.test.jsfile
- All tests are located in the
-
Test Coverage:
- Aim for at least 30% code coverage (minimum threshold set in Jest config)
- Focus on testing core functionality and business logic
- The project uses modern ES6+ JavaScript features
- No external frameworks are used (Vanilla JS only with Tailwind CSS for styling)
- Code should be clean, modular, and well-documented
- The application uses
localStoragefor persisting games and configuration - The storage key structure follows a versioned approach (e.g.,
fieldHockeyGames_v1)
- Direct DOM manipulation is performed using the standard Web APIs
- Helper functions in
utils/domUtils.jsprovide common DOM operations
- Jest with jsdom for frontend testing
- Babel for transpilation during tests
- Coverage thresholds are set to 30% for statements, branches, functions, and lines
- Update the configuration schema in
components/config.js - Add any necessary helper functions in relevant utils
- Update tests to cover the new event type
- Locate the relevant component in
src/components/ - Update the markup and associated JavaScript
- Use Tailwind CSS classes for styling
- Test the changes both visually and with unit tests
The application implements a custom router that handles navigation between views using hash-based routing:
-
Router Configuration:
- The
Routerclass is initialized inmain.jswith view and tab mappings - View mappings connect DOM elements to internal view names
- Tab mappings handle sub-navigation within specific views (like the Log view)
- The
-
Adding a New View:
- Create a new view container element in
index.html - Add a navigation link with the appropriate hash fragment
- Update the router initialization in
main.jsto include the new view - Add the view name and hash to
viewToHashMapandhashToViewMapincomponents/router.js
- Create a new view container element in
-
Navigation Concepts:
- Hash-based navigation: URL fragments like
#event-capturecontrol which view is shown - Route guards: Checks like ensuring an active game exists before showing the Log view
- Deep linking: Direct navigation to specific views from external pages
- Hash-based navigation: URL fragments like
-
Example: Adding a "Help" View:
// 1. Add the view to index.html <div id="help-view" class="hidden"> <h1>Help Documentation</h1> <!-- Content here --> </div> // 2. Add a navigation link <a href="#help" id="navHelp" class="text-gray-400 hover:text-white-300 font-medium">Help</a> // 3. Update router initialization in main.js const router = new Router( { // ...existing views Help: { view: document.getElementById('help-view'), button: document.getElementById('navHelp') } }, // ...tabs config ); // 4. Update the hash maps in router.js this.viewToHashMap = { // ...existing mappings 'Help': 'help' };
For more detailed information about the navigation system, see Navigation.
- Check the
README.mdfor an overview of the application - See
docs/user-workflow.mdfor understanding the user experience flow - Explore
docs/match-review.mdanddocs/saved-games.mdfor feature-specific documentation