-
Notifications
You must be signed in to change notification settings - Fork 37
refactor: migrate feature sliced design (FSD) #491
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
Draft
bryanlundberg
wants to merge
159
commits into
main
Choose a base branch
from
feature-slice-design-architectural-methodology
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
refactor: migrate feature sliced design (FSD) #491
bryanlundberg
wants to merge
159
commits into
main
from
feature-slice-design-architectural-methodology
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds feature sliced design architecture
By submitting this PR, I confirm that: