How codeaid/woth-toolbox works
Frontend Application Layer (Next.js Client)
• Pages (located in src/app): These include individual pages like Animals, Firearms, Life Cycle, Maps (Nez Perce Valley, Transylvania, Aurora Shores, Tikamoon Plains) showing different aspects of game data.
• Components (located in src/components): A large number of reusable UI components (Animal lists, Weapon selectors, maps, context menus, modals, buttons, toolbars, etc.) which are used to build the user interface.
• Layout and Navigation Components: These include Sidebar, NavLink, SidePanel, and Layout components that provide structure, routing, and interactivity across pages.
State Management and Business Logic
• Context Providers (src/contexts): Include ApplicationProvider, FirebaseContext, SettingsContext, TutorialContext, and custom contexts to manage global application state such as user settings, Firebase integration, and tutorial flows.
• Custom Hooks (src/hooks): Contains logic for handling animal markers, settings, localization, storage, and Firebase operations. These hooks encapsulate business logic and facilitate communication between UI components and data/services.
• Libraries in src/lib: These utility libraries handle tasks such as data filtering, routing, persistence, tracking, and integration with business rules (for example, calculating the recommended hit energy values and ethical ranges).
Data and Configuration Layer
• Localization (src/locales): Provide internationalization support, enabling the application to display content in multiple languages.
• Scripts (src/scripts): Data processing scripts (e.g., for “companion” data) that may be used during development or data preparation.
External Services and Storage
• Firebase Integration: Although the application stores many user-made customizations locally (as noted in the README) via browser local storage, there are Firebase configuration files (e.g., firebase.json, firestore.rules) and a FirebaseContext that could handle aspects of authentication or remote data storage if needed.
• Browser Local Storage: Used for storing marker customizations and other transient application data, ensuring that changes are preserved per browser instance.
Development, CI/CD & Tooling
• GitHub Actions (under .github/workflows): Automated workflows for tasks such as building and testing the Next.js application.
• Code Quality and Formatting Tools: ESLint, Prettier, Husky (for pre-commit hooks), and associated configuration files that ensure code quality and consistency.
• Deployment Configurations: Files like next.config.js and firebase.json indicate that the project’s deployment pipelines are set up to deploy on hosting platforms supporting Next.js and/or Firebase.
• Begin at the highest level by separating the application into the “Frontend UI Layer,” “Business Logic/State Management,” “Data/Configuration Layer” and “External Services.”
– From configuration files and static data (src/config, src/locales) into the context hooks and components.
– From components to state management (contexts and hooks) which in turn interact with Firebase services and local storage.
• Annotations for key interactions:
– The UI layer’s pages (animals, firearms, maps, etc.) communicate with Context providers (e.g., FirebaseContext for Firebase interactions, SettingsContext for user preferences) using custom hooks.
– Utility libraries (src/lib) support both business logic and data presentation, handling tasks like filtering (for weapons and ethical hit energy calculations) and routing.
– Localization and configuration data drive dynamic content; show how the localization files connect to UI components.
• Separation between:
– The UI (Next.js pages and React components) and the business logic (contexts, hooks, libraries),
– And the data layer (configuration files, localization, static and external data sources).
• To explicitly include auxiliary services (Firebase/Firestore) for authentication or remote data if needed in the future.