This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Back] Split ProductGetList -> ProductGetCount & LexicalEntity - [Fro…
…nt] Carousel -> PhotoList & AdminProduct | AdminProductGet.List -> useList | Export ProductEntity to Get - [Front | SignalR] UpdateCache | GetVersionCache | WithTimeCache -> GetTimeCache | liveSafe | Remove FindCover | PhotoList | LiveState (#92) * Update package version and fix cache method calls * Update SignalR UpdateCache method to handle query expiration * Update version and add new method in AdminNet and SignalR * Update code with new methods and versions * Update version numbers and import statements * Update product data and lexical entity * Update AdminProduct component and AdminNet * Refactor photo list retrieval and cover selection * Refactor gallery and product get methods * Add useState hook and update AdminProductPhoto component * Update data grid components * Update version numbers and function names * Refactor AdminProduct component and add API call for counting product variants, combos, and stock * Fix photo caption fallback and handle error in product retrieval * Update dependencies and fix navigation bug * Update version and refactor code * The most significant changes include the update of the `AdminHub` class in `Post.cs` to use a case-insensitive comparison when checking if a product already exists in the database. This change enhances the product search functionality. The `Add.tsx` file has also been updated to improve the user experience during product creation. The `Create` button is now disabled while loading, and the `setName` function is called after a new product is created. The `AdminNet.ts` and `SignalR.ts` files have been updated to remove several functions related to caching and versioning, and a new function `Index` has been added. This change simplifies the code and improves performance. The `package.json` and `pnpm-lock.yaml` files have been updated to include a new dependency, `dexie-react-hooks` version `1.1.7`. This new dependency provides additional React hooks for the Dexie.js library, which is a minimalistic wrapper for IndexedDB. The `index.tsx` and `Get.ts` files have been updated to use the `useList` function instead of the `List` function. This change makes the code more concise and easier to read. In the `SignalR.ts` file, the `UpdateCache`, `GetVersionCache`, and `GetTimeCache` functions have been updated to use the new `Index` function. This change improves the efficiency of these functions. Changes: 1. `AdminHub` class in `Post.cs` updated for case-insensitive product comparison. 2. `package.json` and `pnpm-lock.yaml` updated to include `dexie-react-hooks` version `1.1.7`. 3. `Add.tsx` updated to improve product creation process. 4. `index.tsx` and `Get.ts` updated to use `useList` function. 5. `AdminNet.ts` and `SignalR.ts` updated to remove caching and versioning functions and add `Index` function. 6. `SignalR.ts` updated to use `Index` function in `UpdateCache`, `GetVersionCache`, and `GetTimeCache` functions. * The most significant changes in the codebase revolve around the refactoring of the `AdminProductData` class to the `AdminNet` class, the replacement of the `useEffect` hook with the `useAsyncEffect` hook, and the addition of new methods to the `Table` class. 1. The `AdminProductData` class was replaced with the `AdminNet` class in several files (`Data.ts`, `Delete.ts`, `Get.ts`, `Post.ts`). This change indicates a shift towards a more generic network handling class. The `AdminProductDelete`, `AdminProductGet`, and `AdminProductPost` classes were also updated to use the `AdminNet` class. 2. The `useEffect` hook from React was replaced with `useAsyncEffect` from `ahooks` in `index.tsx` to better handle asynchronous operations within the effect hook. The `AdminProduct` function was updated to use this new hook, and the logic within the hook was improved for efficiency and clarity. 3. The `Table` class in `Table.ts` saw several updates. The generic `TPre` was replaced with `unknown` to increase flexibility. New methods `useGet` and `useGetOrSet` were added, which use the `useLiveQuery` hook from `dexie-react-hooks` to fetch and update data. The `Set` method was also updated to throw an error if the expiration time is less than the current time to prevent setting data with an expired time. 4. A new method, `useTimeCache`, was added to the `SignalR` class in `SignalR.ts`. This method is used to cache data for a specified amount of time. * The most significant changes include the removal of the `dayjs` library and its replacement with a custom function for time manipulation, the removal of `useTimeCache` method from the `SignalR` class, and the replacement of `useGet` and `useGetOrSet` methods in the `Table` class with `Get` and `GetOrSet` methods. Additionally, the `dexie-react-hooks` library was removed from the `Table.ts` file, and the `await` keyword was replaced with `Promise.resolve` in several places to ensure the code always returns a promise. 1. The `dayjs` library was removed and replaced with a custom function that adds 1 minute to a `dayjs` object, improving the flexibility of time manipulation in the code. 2. The `useTimeCache` method was removed from the `SignalR` class as it was no longer needed for caching data. 3. The `useGet` and `useGetOrSet` methods in the `Table` class were replaced with `Get` and `GetOrSet` methods, eliminating the use of the `useLiveQuery` hook from the `dexie-react-hooks` library. 4. The `dexie-react-hooks` library was removed from the `Table.ts` file as it was no longer needed. 5. The `await` keyword was replaced with `Promise.resolve` in several places to ensure the code always returns a promise. 6. The `FindCover` method in the `AdminOrderGet` and `OrderGet` classes was replaced with destructuring assignment to get the `cover` variable, simplifying the code and improving readability. 7. The `debugger;` statement was removed from the `UpdateCache` method in the `SignalR` class as it's not recommended for production code. 8. The `ProductGet.PhotoList` method was modified to take an additional `log` parameter, improving the method's logging capabilities. * Update AdminProductDelete component version to 0.2.1 and add loading state to delete button
- Loading branch information