Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhance] Refactor Availability Handling & IndexedDB #66

Merged
merged 7 commits into from
Feb 4, 2025
Merged

Conversation

Aloento
Copy link
Member

@Aloento Aloento commented Feb 4, 2025

Summary of the Pull Request:

This PR introduces several key enhancements and refactors to improve code structure and maintainability:

  • Database Refactoring:

    • Extracted IndexedDB-related code into a standalone, generic database class.
    • Implemented methods for initializing, saving, and loading data, boosting data persistence capabilities.
    • Replaced global DB variables with instances of the new DB class for better encapsulation.
    • Removed redundant IndexedDB functions, streamlining data handling processes.
  • Availability Handling Improvements:

    • Introduced a context provider for managing service availability data.
    • Integrated availability handling logic directly into the CategoryGroup component, removing the custom hook and utilizing useMemo for optimized data filtering.
    • Transitioned from status service to availability service for streamlined region management, enhancing code clarity.
    • Wrapped the availability matrix component with a context provider for more effective state management.
  • User Navigation & Form Validation:

    • Stored the current URL before redirecting to the login page, ensuring seamless redirection post-login.
    • Enhanced form validation to require an end date for maintenance events.
  • UI/UX Enhancements:

    • Added a spinner component to improve loading state management during data fetching.

Stores the current URL before redirecting to the login page
Redirects to the stored URL after user login
Improves form validation by ensuring end date is provided for maintenance events
Implements a context provider for service availability data
Fetches and processes availability information from the backend
Enhances loading state management with a spinner component
Implements a generic database class for managing object storage using IndexedDB.

Includes methods for initializing the database, saving, and loading data.

Enhances data persistence capabilities in the application.
Replaces global DB variable with an instance of the DB class for better encapsulation and state management.

Removes redundant IndexedDB functions and simplifies data loading and saving processes.

Updates context provider to reflect changes in state handling.

Improves code readability and maintainability.
Wraps the availability matrix component with a context provider to manage state more effectively.

Removes example code comments from the status service for clarity.
Removes the custom hook for availability and integrates its logic directly into the CategoryGroup component.
Utilizes useMemo for optimized filtering of availability data based on the selected category and region.

Improves code clarity and reduces complexity by eliminating unnecessary dependencies.
Replaces the use of status service with availability service
to streamline region management.

Updates the rendering logic to utilize the new region data
structure, improving code clarity and maintainability.
@Aloento Aloento self-assigned this Feb 4, 2025
@Aloento Aloento added the gate Merge PR label Feb 4, 2025
@otc-zuul otc-zuul bot merged commit 0e2515e into main Feb 4, 2025
6 checks passed
@otc-zuul otc-zuul bot deleted the feat_sync branch February 4, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gate Merge PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants