Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 86aad94

Browse files
authored
[Front] v1.2.5 (#67)
* 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
1 parent 0fefad1 commit 86aad94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1789
-1717
lines changed

TSystems.LoveOTC/AdminHub/Product/Get.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,30 @@ internal partial class AdminHub {
77
* <remarks>
88
* @author Aloento
99
* @since 0.1.0
10+
* @version 2.0.0
11+
* </remarks>
12+
*/
13+
public Task<uint[]> ProductGetList() =>
14+
this.Db.Products
15+
.Select(x => x.ProductId)
16+
.ToArrayAsync();
17+
18+
/**
19+
* <remarks>
20+
* @author Aloento
21+
* @since 1.2.0
1022
* @version 1.0.0
1123
* </remarks>
1224
*/
13-
public async Task<dynamic[]> ProductGetList() =>
25+
public async Task<dynamic?> ProductGetCount(uint prodId) =>
1426
await this.Db.Products
27+
.Where(x => x.ProductId == prodId)
1528
.Select(x => new {
16-
x.ProductId,
1729
Variant = x.Variants.Count,
1830
Combo = x.Combos.Count,
1931
Stock = x.Combos.Sum(s => s.Stock)
2032
})
21-
.ToArrayAsync();
33+
.SingleOrDefaultAsync();
2234

2335
/**
2436
* <remarks>

TSystems.LoveOTC/AdminHub/Product/Post.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task<uint> ProductPostCreate(string name) {
2323
if (!valid.IsValid(name))
2424
throw new HubException(valid.FormatErrorMessage("Name"));
2525

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

2929
var temp = await this.Db.Products.AddAsync(new() {
@@ -184,11 +184,11 @@ public async Task<uint> ProductPostType(uint variantId, string name) {
184184
*/
185185
public async Task<uint> ProductPostCombo(uint prodId, Dictionary<string, string> combo, ushort stock) {
186186
var variTypesDb = (await this.Db.Products
187-
.Include(x => x.Variants)
188-
.ThenInclude(x => x.Types)
189-
.Where(x => x.ProductId == prodId)
190-
.SelectMany(x => x.Variants)
191-
.ToDictionaryAsync(k => k.Name, v => v.Types.ToImmutableArray()))
187+
.Include(x => x.Variants)
188+
.ThenInclude(x => x.Types)
189+
.Where(x => x.ProductId == prodId)
190+
.SelectMany(x => x.Variants)
191+
.ToDictionaryAsync(k => k.Name, v => v.Types.ToImmutableArray()))
192192
.ToImmutableSortedDictionary();
193193

194194
var reqCombo = combo.ToImmutableSortedDictionary();
@@ -230,4 +230,22 @@ public async Task<uint> ProductPostCombo(uint prodId, Dictionary<string, string>
230230
await this.Db.SaveChangesAsync();
231231
return temp.Entity.ComboId;
232232
}
233+
234+
/**
235+
* <remarks>
236+
* @author Aloento
237+
* @since 1.2.0
238+
* @version 0.1.0
239+
* </remarks>
240+
*/
241+
public async Task<bool> ProductPostDescription(uint prodId, string? desc) {
242+
desc = desc?.Normalize().Trim();
243+
244+
var row = await this.Db.Products
245+
.Where(x => x.ProductId == prodId)
246+
.ExecuteUpdateAsync(x =>
247+
x.SetProperty(p => p.Description, desc));
248+
249+
return row > 0;
250+
}
233251
}

TSystems.LoveOTC/Hub/Product/Entity.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ internal partial class ShopHub {
77
* <remarks>
88
* @author Aloento
99
* @since 0.5.0
10-
* @version 0.1.0
10+
* @version 0.2.0
1111
* </remarks>
1212
*/
1313
public async Task<dynamic?> ProductEntity(uint key, uint? version) {
@@ -23,6 +23,29 @@ internal partial class ShopHub {
2323
.Select(x => new {
2424
x.Name,
2525
Category = x.Category!.Name,
26+
x.Version
27+
})
28+
.SingleOrDefaultAsync();
29+
}
30+
31+
/**
32+
* <remarks>
33+
* @author Aloento
34+
* @since 1.2.0
35+
* @version 1.0.0
36+
* </remarks>
37+
*/
38+
public async Task<dynamic?> LexicalEntity(uint key, uint? version) {
39+
if (version is not null) {
40+
var noChange = await this.Db.Products
41+
.AnyAsync(x => x.ProductId == key && x.Version == version);
42+
43+
if (noChange) return true;
44+
}
45+
46+
return await this.Db.Products
47+
.Where(x => x.ProductId == key)
48+
.Select(x => new {
2649
x.Description,
2750
x.Version
2851
})

TSystems.LoveOTC/TSystems.LoveOTC.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626

2727
<ItemGroup>
2828
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
29-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
30-
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" />
31-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.0" />
32-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.0" />
33-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
29+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
30+
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.1" />
31+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.1" />
32+
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.1" />
33+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
3434
<PrivateAssets>all</PrivateAssets>
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
</PackageReference>
37-
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.0" />
38-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
37+
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.1" />
38+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
3939
<PrivateAssets>all</PrivateAssets>
4040
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4141
</PackageReference>

package.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "loveotc",
33
"private": true,
4-
"version": "1.2.0",
4+
"version": "1.3.0",
55
"type": "module",
66
"author": {
77
"name": "Aloento",
@@ -15,30 +15,31 @@
1515
"update": "npx npm-check-updates -u"
1616
},
1717
"dependencies": {
18-
"@fluentui/react-components": "^9.44.0",
19-
"@fluentui/react-hooks": "^8.6.34",
20-
"@fluentui/react-icons": "^2.0.224",
21-
"@griffel/react": "^1.5.19",
22-
"@lexical/clipboard": "^0.12.5",
23-
"@lexical/code": "^0.12.5",
24-
"@lexical/file": "^0.12.5",
25-
"@lexical/html": "^0.12.5",
26-
"@lexical/link": "^0.12.5",
27-
"@lexical/list": "^0.12.5",
28-
"@lexical/mark": "^0.12.5",
29-
"@lexical/markdown": "^0.12.5",
30-
"@lexical/overflow": "^0.12.5",
31-
"@lexical/react": "^0.12.5",
32-
"@lexical/rich-text": "^0.12.5",
33-
"@lexical/selection": "^0.12.5",
34-
"@lexical/table": "^0.12.5",
35-
"@lexical/utils": "^0.12.5",
18+
"@fluentui/react-components": "^9.44.4",
19+
"@fluentui/react-hooks": "^8.6.35",
20+
"@fluentui/react-icons": "^2.0.225",
21+
"@griffel/react": "^1.5.20",
22+
"@lexical/clipboard": "0.10.0",
23+
"@lexical/code": "0.10.0",
24+
"@lexical/file": "0.10.0",
25+
"@lexical/html": "0.10.0",
26+
"@lexical/link": "0.10.0",
27+
"@lexical/list": "0.10.0",
28+
"@lexical/mark": "0.10.0",
29+
"@lexical/markdown": "0.10.0",
30+
"@lexical/overflow": "0.10.0",
31+
"@lexical/react": "0.10.0",
32+
"@lexical/rich-text": "0.10.0",
33+
"@lexical/selection": "0.10.0",
34+
"@lexical/table": "0.10.0",
35+
"@lexical/utils": "0.10.0",
3636
"@microsoft/signalr": "^8.0.0",
3737
"@microsoft/signalr-protocol-msgpack": "^8.0.0",
3838
"ahooks": "^3.7.8",
3939
"dayjs": "^1.11.10",
4040
"dexie": "^3.2.4",
41-
"lexical": "^0.12.5",
41+
"dexie-react-hooks": "^1.1.7",
42+
"lexical": "0.10.0",
4243
"lodash-es": "^4.17.21",
4344
"oidc-client-ts": "^2.4.0",
4445
"react": "^18.2.0",
@@ -50,7 +51,7 @@
5051
},
5152
"devDependencies": {
5253
"@types/lodash-es": "^4.17.12",
53-
"@types/react": "^18.2.47",
54+
"@types/react": "^18.2.48",
5455
"@types/react-dom": "^18.2.18",
5556
"@vitejs/plugin-react-swc": "^3.5.0",
5657
"typescript": "^5.3.3",

0 commit comments

Comments
 (0)