Skip to content

Commit

Permalink
[Front] v1.2.5 (#67)
Browse files Browse the repository at this point in the history
* Update Footer component logo

* The code changes involve updates to several files, including .cs, .tsx, and .ts files. The changes mainly involve updates to the code logic, addition of new functions, and updates to the version of the software packages used. The `useStyle` function has been renamed to `useStyles` across multiple files. The `DelegateDataGrid` import path has been updated in multiple files. The `Lexical` function has been exported as default in `index.tsx`. The `useStyle` function has been renamed to `useStyles` in `Nav.tsx`. The `DelegateDataGrid` component's `Items` prop no longer defaults to an empty array when `Items` is undefined in `List.tsx` and `index.tsx`. The `AdminProductAddButton` component's version has been updated to `0.3.3` in `Add.tsx`. The `run` function from `AdminHub.Product.Post.useCreate` now also returns `loading` in `Add.tsx`. The `setName` function is called with an empty string after a successful product creation in `Add.tsx`. The `Create` button in `Add.tsx` is now disabled when `loading` is true. The `AdminProductDelete` component's version has been updated to `0.2.1` in `Delete.tsx`. The `run` function from `AdminHub.Product.Delete.useProduct` now also returns `loading` in `Delete.tsx`. The `location.reload` function call has been removed from `AdminProductDelete` in `Delete.tsx`. The `AdminProductDelete` component now uses a `Popover` for confirmation before deleting a product in `Delete.tsx`. The `AdminProductComboDetail` and `AdminProductNewCombo` components now pass an array to `DelegateDataGrid`'s `Items` prop without defaulting to an empty array when the array is undefined in `Detail.tsx` and `New.tsx`. The `AdminProductCombo` component now passes an array to `DelegateDataGrid`'s `Items` prop without defaulting to an empty array when the array is undefined in `index.tsx`. The `AdminProductDelete` component's version has been updated to `0.1.1` in `Delete.tsx`. The `AdminProductDelete` component now uses a `Popover` for confirmation before deleting a product in `Delete.tsx`. The `AdminProductDetail` component's version has been updated to `0.2.2` in `Detail.tsx`. The `AdminProductDetail` component now uses `setFalse` instead of `toggle` to close the drawer in `Detail.tsx`. The `AdminProductDetail` component now includes the `AdminProductLexical` component in `Detail.tsx`. The `AdminProductPhotoEdit` component's version has been updated to `0.3.3` in `Edit.tsx`. The `AdminProductPhotoEdit` component now uses the `GuidImage` component instead of the `Image` component in `Edit.tsx`. The `AdminProductPhoto` component now passes an array to `DelegateDataGrid`'s `Items` prop without defaulting to an empty array when the array is undefined in `index.tsx`. The `AdminProductVariant` component now passes an array to `DelegateDataGrid`'s `Items` prop without defaulting to an empty array when the array is undefined in `index.tsx`. A new `AdminProductRow` component has been added in `Row.tsx`. The `AdminProductVariantEdit` component's version has been updated to `0.2.1` in `index.tsx`. The `AdminProductVariant` component now passes an array to `DelegateDataGrid`'s `Items` prop without defaulting to an empty array when the array is undefined in `index.tsx`. Several imports have been updated, with some being removed and others added. This includes changes to the import of various components from "@fluentui/react-components" and other libraries. The version numbers in the author comments have been updated, indicating that changes have been made to the code since the last version. The `IProductItem` interface has been extended to include `IProductCount`, and a new `IProductCount` interface has been added. The `useRequest` function has been replaced with `AdminHub.Product.Get.useList(log)` in the `AdminProduct` function. The `DelegateDataGrid` component has been replaced with a `DataGrid` component in the `AdminProduct` function. The `renderHeaderCell` and `renderCell` functions in the `createTableColumn` calls have been simplified. The `useStyle` function has been renamed to `useStyles` in several places. The `WithVersionCache` function has been replaced with `GetVersionCache` in several places. The `WithTimeCache` function has been replaced with `GetTimeCache` in several places. The `ProductEntity` class has been replaced with `ProductData` in several places. The `AdminProductRow` component has been added to the `DataGridBody` in the `AdminProduct` function. The `ProductLexicalRender` component has been added to the `Product` function. The `AdminUserDelete` and `AdminUserGrant` components have been updated to use `DataGridCell` and `DataGridHeaderCell`. The `Admin` function has been updated to check if `data` is defined instead of `loading`. The `ProductCarousel` function has been updated to use `Hub.Product.Get.PhotoList` instead of `Hub.Product.Get.Carousel`. The `ProductQuantity` and `ProductRadioList` components have been moved into a new `div` with the `style.detail` class in the `Product` function. The `ProductRadioGroup` function has been updated to use the `useRadioGroup` function. The `AdminOrderGet` class has been updated to use the `GetTimeCache` function instead of the `WithTimeCache` function. The `AdminProductDelete` class has been updated to use the `UpdateCache` function. The `dayjs` import was removed from several files and replaced with the `useConst` and `useLiveQuery` hooks from `@fluentui/react-hooks` and `dexie-react-hooks` respectively. This suggests a shift from using the `dayjs` library for date manipulation to using React hooks for state management and live querying of data. The `ProductEntity` import was removed from several files and replaced with `ProductData` and `ProductGet`. This suggests a refactoring of the code to separate concerns between fetching product data and getting product details. The `WithTimeCache` method was replaced with `GetTimeCache` in several places. This suggests a change in the method used for caching data. The `WithVersionCache` method was replaced with `GetVersionCache` in several places. This suggests a change in the method used for version caching. The `List` method in `AdminProductGet` was refactored to use the `useLiveQuery` hook and the `GetTimeCache` method. This suggests a shift towards using live queries and time-based caching for data fetching. The `useCreate` method in `AdminProductPost` was refactored to use the `Invoke` method and update the cache after creating a product. This suggests a change in the product creation process to include cache updates. A new `useLexical` method was added to `AdminProductPost`, which uses the `CurrentEditor` to get the editor state and invoke the `ProductPostDescription` method. This suggests a new feature for handling lexical data in product posts. The `ProductGet` class was refactored to extend `ProductData` instead of `ShopNet`. This suggests a change in the class hierarchy to make `ProductGet` a subclass of `ProductData`. The `PhotoList` method in `ProductGet` was refactored to use the `GetTimeCache` method and handle errors. This suggests a change in the method used for fetching photo lists and improved error handling. A new `ProductData` class was added, which includes methods for fetching product, lexical, photo, type, and variant data. This suggests a new class for handling product-related data fetching. The `demo.json` file was completely removed. This file contained a large amount of text data structured in a specific format. In `SignalR.ts`, the import statement for `ShopNet` was changed to import the type only. Two new methods `Index` and `UpdateCache` were added to the `SignalR` class. The `WithVersionCache` method was renamed to `GetVersionCache` and its implementation was updated. The `WithTimeCache` method was renamed to `GetTimeCache` and its implementation was updated. The `FindCover` method was removed from the `SignalR` class. In `Table.ts`, the `Table` class was updated to remove the generic `TPre` and replace it with `unknown`. The `Get`, `GetOrSet`, and `Set` methods were updated to remove the `TPre` generic and replace it with `unknown`. In `Get.tsx`, the `useMe` method was updated to remove the `options` and `suppress` parameters and to use the `useLiveQuery` hook instead of the `useRequest` hook. The `useMe` method now returns `IUserGetMe | void` instead of `IuseMe | void`. In `Post.ts`, the `useUpdate` method was updated to call the `EnsureTrue` method and the `UpdateCache` method after invoking the `UserPostUpdate` method. In `vite.config.ts`, the `splitVendorChunkPlugin` was added to the list of plugins in the Vite configuration.

* [Front] 1.2.5
  • Loading branch information
Aloento authored Jan 16, 2024
1 parent 0fefad1 commit 86aad94
Show file tree
Hide file tree
Showing 92 changed files with 1,789 additions and 1,717 deletions.
18 changes: 15 additions & 3 deletions TSystems.LoveOTC/AdminHub/Product/Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,30 @@ internal partial class AdminHub {
* <remarks>
* @author Aloento
* @since 0.1.0
* @version 2.0.0
* </remarks>
*/
public Task<uint[]> ProductGetList() =>
this.Db.Products
.Select(x => x.ProductId)
.ToArrayAsync();

/**
* <remarks>
* @author Aloento
* @since 1.2.0
* @version 1.0.0
* </remarks>
*/
public async Task<dynamic[]> ProductGetList() =>
public async Task<dynamic?> ProductGetCount(uint prodId) =>
await this.Db.Products
.Where(x => x.ProductId == prodId)
.Select(x => new {
x.ProductId,
Variant = x.Variants.Count,
Combo = x.Combos.Count,
Stock = x.Combos.Sum(s => s.Stock)
})
.ToArrayAsync();
.SingleOrDefaultAsync();

/**
* <remarks>
Expand Down
30 changes: 24 additions & 6 deletions TSystems.LoveOTC/AdminHub/Product/Post.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task<uint> ProductPostCreate(string name) {
if (!valid.IsValid(name))
throw new HubException(valid.FormatErrorMessage("Name"));

if (await this.Db.Products.AnyAsync(x => EF.Functions.Like(x.Name, name)))
if (await this.Db.Products.AnyAsync(x => EF.Functions.ILike(x.Name, name)))
throw new HubException($"Product {name} already exist");

var temp = await this.Db.Products.AddAsync(new() {
Expand Down Expand Up @@ -184,11 +184,11 @@ public async Task<uint> ProductPostType(uint variantId, string name) {
*/
public async Task<uint> ProductPostCombo(uint prodId, Dictionary<string, string> combo, ushort stock) {
var variTypesDb = (await this.Db.Products
.Include(x => x.Variants)
.ThenInclude(x => x.Types)
.Where(x => x.ProductId == prodId)
.SelectMany(x => x.Variants)
.ToDictionaryAsync(k => k.Name, v => v.Types.ToImmutableArray()))
.Include(x => x.Variants)
.ThenInclude(x => x.Types)
.Where(x => x.ProductId == prodId)
.SelectMany(x => x.Variants)
.ToDictionaryAsync(k => k.Name, v => v.Types.ToImmutableArray()))
.ToImmutableSortedDictionary();

var reqCombo = combo.ToImmutableSortedDictionary();
Expand Down Expand Up @@ -230,4 +230,22 @@ public async Task<uint> ProductPostCombo(uint prodId, Dictionary<string, string>
await this.Db.SaveChangesAsync();
return temp.Entity.ComboId;
}

/**
* <remarks>
* @author Aloento
* @since 1.2.0
* @version 0.1.0
* </remarks>
*/
public async Task<bool> ProductPostDescription(uint prodId, string? desc) {
desc = desc?.Normalize().Trim();

var row = await this.Db.Products
.Where(x => x.ProductId == prodId)
.ExecuteUpdateAsync(x =>
x.SetProperty(p => p.Description, desc));

return row > 0;
}
}
25 changes: 24 additions & 1 deletion TSystems.LoveOTC/Hub/Product/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal partial class ShopHub {
* <remarks>
* @author Aloento
* @since 0.5.0
* @version 0.1.0
* @version 0.2.0
* </remarks>
*/
public async Task<dynamic?> ProductEntity(uint key, uint? version) {
Expand All @@ -23,6 +23,29 @@ internal partial class ShopHub {
.Select(x => new {
x.Name,
Category = x.Category!.Name,
x.Version
})
.SingleOrDefaultAsync();
}

/**
* <remarks>
* @author Aloento
* @since 1.2.0
* @version 1.0.0
* </remarks>
*/
public async Task<dynamic?> LexicalEntity(uint key, uint? version) {
if (version is not null) {
var noChange = await this.Db.Products
.AnyAsync(x => x.ProductId == key && x.Version == version);

if (noChange) return true;
}

return await this.Db.Products
.Where(x => x.ProductId == key)
.Select(x => new {
x.Description,
x.Version
})
Expand Down
14 changes: 7 additions & 7 deletions TSystems.LoveOTC/TSystems.LoveOTC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
43 changes: 22 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "loveotc",
"private": true,
"version": "1.2.0",
"version": "1.3.0",
"type": "module",
"author": {
"name": "Aloento",
Expand All @@ -15,30 +15,31 @@
"update": "npx npm-check-updates -u"
},
"dependencies": {
"@fluentui/react-components": "^9.44.0",
"@fluentui/react-hooks": "^8.6.34",
"@fluentui/react-icons": "^2.0.224",
"@griffel/react": "^1.5.19",
"@lexical/clipboard": "^0.12.5",
"@lexical/code": "^0.12.5",
"@lexical/file": "^0.12.5",
"@lexical/html": "^0.12.5",
"@lexical/link": "^0.12.5",
"@lexical/list": "^0.12.5",
"@lexical/mark": "^0.12.5",
"@lexical/markdown": "^0.12.5",
"@lexical/overflow": "^0.12.5",
"@lexical/react": "^0.12.5",
"@lexical/rich-text": "^0.12.5",
"@lexical/selection": "^0.12.5",
"@lexical/table": "^0.12.5",
"@lexical/utils": "^0.12.5",
"@fluentui/react-components": "^9.44.4",
"@fluentui/react-hooks": "^8.6.35",
"@fluentui/react-icons": "^2.0.225",
"@griffel/react": "^1.5.20",
"@lexical/clipboard": "0.10.0",
"@lexical/code": "0.10.0",
"@lexical/file": "0.10.0",
"@lexical/html": "0.10.0",
"@lexical/link": "0.10.0",
"@lexical/list": "0.10.0",
"@lexical/mark": "0.10.0",
"@lexical/markdown": "0.10.0",
"@lexical/overflow": "0.10.0",
"@lexical/react": "0.10.0",
"@lexical/rich-text": "0.10.0",
"@lexical/selection": "0.10.0",
"@lexical/table": "0.10.0",
"@lexical/utils": "0.10.0",
"@microsoft/signalr": "^8.0.0",
"@microsoft/signalr-protocol-msgpack": "^8.0.0",
"ahooks": "^3.7.8",
"dayjs": "^1.11.10",
"dexie": "^3.2.4",
"lexical": "^0.12.5",
"dexie-react-hooks": "^1.1.7",
"lexical": "0.10.0",
"lodash-es": "^4.17.21",
"oidc-client-ts": "^2.4.0",
"react": "^18.2.0",
Expand All @@ -50,7 +51,7 @@
},
"devDependencies": {
"@types/lodash-es": "^4.17.12",
"@types/react": "^18.2.47",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.3.3",
Expand Down
Loading

0 comments on commit 86aad94

Please sign in to comment.