Skip to content

Conversation

@bryanlundberg
Copy link
Owner

What does this PR do?
Adds feature sliced design architecture

By submitting this PR, I confirm that:

  • I have reviewed my code and believe it is ready for merging.
  • I understand that this PR may be subject to review and changes.
  • I agree to abide by the code of conduct and contributing guidelines of this project.

Added `@hookform/resolvers` to the project's dependencies in `package.json`. This ensures the module is available for form validations and related functionality.
Implemented the `createCubeCollection` function to create and store new cube entities in the IndexedDB. This feature includes validation to prevent duplicate cube names and initializes default cube properties.
Added `CUBE_CATEGORIES` constant and `CubeCategory` type definition to centralize cube category management. Included a helper function `isValidCategory` to validate category strings against the predefined list.
Implemented the `CubeCard` component to display cube details, including category, creation date, and solve statistics. Added interactive actions for edit, delete, and utilize operations, improving the user interface for cube management.
Created the `CubesList` component to render a grid of cubes using the `CubeCard` component. This improves the manage-cubes UI by providing a structured overview of all cubes.
Renamed and refactored `DialogDeleteCollection` to `DeleteCollectionForm` for better clarity and structure. Introduced `zod` schema validation and updated store interactions to align with the new overlay state management approach. Simplified form handling by removing unnecessary hooks and dependencies.
Introduced the `deleteCubeCollection` function to mark cubes as deleted in the IndexedDB by updating their `isDeleted` status and timestamp. This enhances the cube management API with a soft delete mechanism.
Renamed `DialogEditCollection` to `EditCollectionForm` for improved clarity and consistency in naming conventions. Updated references to align with the new component structure and enhance code readability.
Introduced the `editCubeCollection` function to handle updates to existing cubes in the IndexedDB. This function ensures cubes are updated with new data and an updated timestamp, enhancing the cube management API.
Introduced the `EmptyCubes` component to display an engaging and interactive empty state for the cubes management interface. Includes animations, dynamic text, and action buttons for creating new collections or restoring/importing data. This enhances the user experience and supports better navigation in the absence of cube data.
Introduced `cubesDB` to centralize cube operations with IndexedDB, including methods for retrieving, adding, updating, and fetching cubes by ID. This simplifies data handling and improves the scalability of the cube management API.
Integrated the `Overlay` component into the main layout, wrapping it within the `AlertProvider`. This addition improves UI flexibility by allowing overlays to be rendered consistently across the app.
Implemented the `Overlay` component to handle dynamic UI overlays using the `Dialog` component and state from `useOverlayStore`. This centralizes overlay management and provides a consistent rendering mechanism for modals and dialogs.
Refactored the cubes page to use the new `CubesList` component instead of `CubesCards`. Removed unused imports and dialog-related logic for a cleaner and more streamlined implementation. This enhances code maintainability and aligns with the updated cube management UI components.
Introduced `createCubeFormSchema` and `editCubeFormSchema` using Zod for validating cube-related form data. These schemas enforce input rules for cube creation and editing, ensuring consistent and reliable form validation. Added corresponding TypeScript types for improved type safety.
Introduced `deleteCollectionSchema` using Zod to validate the deletion confirmation form. Added a corresponding TypeScript type `DeleteCollectionFormData` for improved type safety and form data handling. This ensures input validation and consistency when deleting cube collections.
Introduced `Cube`, `CreateCubeDTO`, `UpdateCubeDTO`, and `DeleteCubeDTO` types to define the structure of cube entities and their data transfer objects. These additions improve type safety and clarity in cube entity management and related operations.
Implemented `useCubeActions` hook to centralize cube-related operations, including navigation, edit, and delete actions. This enhances code reusability and simplifies the integration of cube management functionalities in the UI.
Implemented `useOverlayStore` using Zustand to manage overlay state, including opening and closing overlays with associated metadata. This centralizes overlay logic, providing a reusable and consistent state management solution for dynamic UI overlays.
Replaced `useDialogCubesOptions` with `useOverlayStore` for consistent overlay state management. Integrated `zodResolver` with `updateCollectionSchema` for improved form validation. Simplified cube editing logic by utilizing `cubesDB` and streamlined associated state updates.
Created `updateCollectionSchema` using Zod to validate collection updates with name and category fields. Introduced `UpdateCollectionFormData` type for improved type safety and data handling. Added support for `CUBE_CATEGORIES` in validation to ensure consistency with predefined categories.
Updated `CubeCard` to invoke the `handleFavorite` action for managing cube favorites. Adjusted the favorite button's `onClick` handler to support the new functionality, enhancing user interaction for favoriting cubes.
Modified `UpdateCubeDTO` type to include optional `name`, `category`, `isDeleted`, `favorite`, and `solves` properties. This enhances flexibility and supports additional cube metadata in update operations.
Added `handleFavorite` action to the `useCubeActions` hook for toggling favorite status of cubes. Integrated API, indexedDB updates, and user notifications to provide a seamless user experience when managing cube favorites.
Refactored `ButtonCreateCollection` to replace drawer-based logic with `handleCreate` from `useCubeActions`. This simplifies the component by removing unnecessary state and dependencies while maintaining the same functionality.
Replaced `DrawerCreateCollection` with `CreateCollectionForm`, using `useOverlayStore` for overlay management and `zodResolver` for form validation. Improved code structure by integrating `createCubeFormSchema` and consolidating logic for cube collection creation. Enhanced user experience with updated components and streamlined interactions.
Deleted an unnecessary blank line in the `handleDeleteCube` function for cleaner code. This small change improves code readability without modifying functionality.
Updated the error message to clarify when a cube collection name is already in use. This enhances user feedback and ensures better understanding during form validation.
Removed the custom error map from the `category` field in `createCubeFormSchema`. This simplifies the schema definition while preserving the existing validation logic. Enhances maintainability by reducing unnecessary customization.
Introduced `handleCreate` action within the `useCubeActions` hook to support cube creation. Integrated the `CreateCollectionForm` component for form rendering and overlay management, streamlining cube creation workflows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants