@akinon/projectzero 1.42.0-rc.4 → 1.42.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 1.42.0-rc.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fac2e5b: ZERO-2622: Add isMenuOpen state to Category reducer and update CategoryInfo component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @akinon/next@1.42.0-rc.5
|
|
12
|
+
- @akinon/pz-akifast@1.42.0-rc.5
|
|
13
|
+
- @akinon/pz-b2b@1.42.0-rc.5
|
|
14
|
+
- @akinon/pz-basket-gift-pack@1.42.0-rc.5
|
|
15
|
+
- @akinon/pz-bkm@1.42.0-rc.5
|
|
16
|
+
- @akinon/pz-checkout-gift-pack@1.42.0-rc.5
|
|
17
|
+
- @akinon/pz-click-collect@1.42.0-rc.5
|
|
18
|
+
- @akinon/pz-credit-payment@1.42.0-rc.5
|
|
19
|
+
- @akinon/pz-gpay@1.42.0-rc.5
|
|
20
|
+
- @akinon/pz-masterpass@1.42.0-rc.5
|
|
21
|
+
- @akinon/pz-one-click-checkout@1.42.0-rc.5
|
|
22
|
+
- @akinon/pz-otp@1.42.0-rc.5
|
|
23
|
+
- @akinon/pz-pay-on-delivery@1.42.0-rc.5
|
|
24
|
+
|
|
3
25
|
## 1.42.0-rc.4
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.42.0-rc.
|
|
3
|
+
"version": "1.42.0-rc.5",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"prestart": "pz-prestart"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@akinon/next": "1.42.0-rc.
|
|
26
|
-
"@akinon/pz-akifast": "1.42.0-rc.
|
|
27
|
-
"@akinon/pz-b2b": "1.42.0-rc.
|
|
28
|
-
"@akinon/pz-basket-gift-pack": "1.42.0-rc.
|
|
29
|
-
"@akinon/pz-bkm": "1.42.0-rc.
|
|
30
|
-
"@akinon/pz-checkout-gift-pack": "1.42.0-rc.
|
|
31
|
-
"@akinon/pz-click-collect": "1.42.0-rc.
|
|
32
|
-
"@akinon/pz-credit-payment": "1.42.0-rc.
|
|
33
|
-
"@akinon/pz-gpay": "1.42.0-rc.
|
|
34
|
-
"@akinon/pz-masterpass": "1.42.0-rc.
|
|
35
|
-
"@akinon/pz-one-click-checkout": "1.42.0-rc.
|
|
36
|
-
"@akinon/pz-otp": "1.42.0-rc.
|
|
37
|
-
"@akinon/pz-pay-on-delivery": "1.42.0-rc.
|
|
25
|
+
"@akinon/next": "1.42.0-rc.5",
|
|
26
|
+
"@akinon/pz-akifast": "1.42.0-rc.5",
|
|
27
|
+
"@akinon/pz-b2b": "1.42.0-rc.5",
|
|
28
|
+
"@akinon/pz-basket-gift-pack": "1.42.0-rc.5",
|
|
29
|
+
"@akinon/pz-bkm": "1.42.0-rc.5",
|
|
30
|
+
"@akinon/pz-checkout-gift-pack": "1.42.0-rc.5",
|
|
31
|
+
"@akinon/pz-click-collect": "1.42.0-rc.5",
|
|
32
|
+
"@akinon/pz-credit-payment": "1.42.0-rc.5",
|
|
33
|
+
"@akinon/pz-gpay": "1.42.0-rc.5",
|
|
34
|
+
"@akinon/pz-masterpass": "1.42.0-rc.5",
|
|
35
|
+
"@akinon/pz-one-click-checkout": "1.42.0-rc.5",
|
|
36
|
+
"@akinon/pz-otp": "1.42.0-rc.5",
|
|
37
|
+
"@akinon/pz-pay-on-delivery": "1.42.0-rc.5",
|
|
38
38
|
"@hookform/resolvers": "2.9.0",
|
|
39
39
|
"@next/third-parties": "14.1.0",
|
|
40
40
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"yup": "0.32.11"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@akinon/eslint-plugin-projectzero": "1.42.0-rc.
|
|
61
|
+
"@akinon/eslint-plugin-projectzero": "1.42.0-rc.5",
|
|
62
62
|
"@semantic-release/changelog": "6.0.2",
|
|
63
63
|
"@semantic-release/exec": "6.0.3",
|
|
64
64
|
"@semantic-release/git": "10.0.1",
|
|
@@ -7,11 +7,13 @@ import { WIDGET_TYPE } from '@theme/types';
|
|
|
7
7
|
export interface CategoryState {
|
|
8
8
|
facets: Facet[];
|
|
9
9
|
selectedFacets: Facet[];
|
|
10
|
+
isMenuOpen: boolean;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const initialState: CategoryState = {
|
|
13
14
|
facets: [],
|
|
14
|
-
selectedFacets: []
|
|
15
|
+
selectedFacets: [],
|
|
16
|
+
isMenuOpen: false
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
const categorySlice = createSlice({
|
|
@@ -24,6 +26,9 @@ const categorySlice = createSlice({
|
|
|
24
26
|
setSelectedFacets(state, action) {
|
|
25
27
|
state.selectedFacets = action.payload;
|
|
26
28
|
},
|
|
29
|
+
setMenuOpen(state, action) {
|
|
30
|
+
state.isMenuOpen = action.payload;
|
|
31
|
+
},
|
|
27
32
|
toggleFacet(state, action) {
|
|
28
33
|
const facets = JSON.parse(JSON.stringify(state.facets));
|
|
29
34
|
|
|
@@ -81,6 +86,7 @@ const categorySlice = createSlice({
|
|
|
81
86
|
export const {
|
|
82
87
|
setFacets,
|
|
83
88
|
setSelectedFacets,
|
|
89
|
+
setMenuOpen,
|
|
84
90
|
toggleFacet,
|
|
85
91
|
removeCategoryFacet,
|
|
86
92
|
resetSelectedFacets
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useEffect, useMemo
|
|
3
|
+
import { useEffect, useMemo } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useSearchParams } from 'next/navigation';
|
|
6
6
|
import { CategoryHeader } from './category-header';
|
|
@@ -8,13 +8,14 @@ import { Filters } from './filters';
|
|
|
8
8
|
import { Pagination } from '@theme/components';
|
|
9
9
|
import { ProductItem } from '@theme/views/product-item';
|
|
10
10
|
import { GetCategoryResponse } from '@akinon/next/types';
|
|
11
|
-
import { useAppDispatch } from '@akinon/next/redux/hooks';
|
|
12
|
-
import { setFacets } from '@theme/redux/reducers/category';
|
|
11
|
+
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
12
|
+
import { setFacets, setMenuOpen } from '@theme/redux/reducers/category';
|
|
13
13
|
import CategoryActiveFilters from '@theme/views/category/category-active-filters';
|
|
14
14
|
import { useLocalization } from '@akinon/next/hooks';
|
|
15
15
|
import { Link, LoaderSpinner } from '@akinon/next/components';
|
|
16
16
|
import { ROUTES } from '@theme/routes';
|
|
17
17
|
import { useRouter } from '@akinon/next/hooks';
|
|
18
|
+
import { RootState } from '@theme/redux/store';
|
|
18
19
|
|
|
19
20
|
interface ListPageProps {
|
|
20
21
|
data: GetCategoryResponse;
|
|
@@ -22,13 +23,16 @@ interface ListPageProps {
|
|
|
22
23
|
|
|
23
24
|
export default function ListPage(props: ListPageProps) {
|
|
24
25
|
const { data } = props;
|
|
25
|
-
const
|
|
26
|
+
const dispatch = useAppDispatch();
|
|
27
|
+
const isMenuOpen = useAppSelector(
|
|
28
|
+
(state: RootState) => state.category.isMenuOpen
|
|
29
|
+
);
|
|
26
30
|
|
|
27
31
|
const searchParams = useSearchParams();
|
|
28
32
|
const router = useRouter();
|
|
29
33
|
|
|
30
34
|
const layoutSize = useMemo(
|
|
31
|
-
() => searchParams.get('layout') ?? 3,
|
|
35
|
+
() => Number(searchParams.get('layout') ?? 3),
|
|
32
36
|
[searchParams]
|
|
33
37
|
);
|
|
34
38
|
|
|
@@ -37,16 +41,24 @@ export default function ListPage(props: ListPageProps) {
|
|
|
37
41
|
[searchParams]
|
|
38
42
|
);
|
|
39
43
|
|
|
44
|
+
const itemDimensions = useMemo(() => {
|
|
45
|
+
switch (layoutSize) {
|
|
46
|
+
case 2:
|
|
47
|
+
return { width: 510, height: 765 };
|
|
48
|
+
case 3:
|
|
49
|
+
default:
|
|
50
|
+
return { width: 340, height: 510 };
|
|
51
|
+
}
|
|
52
|
+
}, [layoutSize]);
|
|
53
|
+
|
|
40
54
|
useEffect(() => {
|
|
41
55
|
if (page > 1 && data.products?.length === 0) {
|
|
42
56
|
const newUrl = new URL(window.location.href);
|
|
43
|
-
|
|
44
57
|
newUrl.searchParams.delete('page');
|
|
45
58
|
router.push(newUrl.pathname + newUrl.search, undefined);
|
|
46
59
|
}
|
|
47
|
-
}, [searchParams, data.products, page]);
|
|
60
|
+
}, [searchParams, data.products, page]);
|
|
48
61
|
|
|
49
|
-
const dispatch = useAppDispatch();
|
|
50
62
|
const { t } = useLocalization();
|
|
51
63
|
|
|
52
64
|
useEffect(() => {
|
|
@@ -58,9 +70,12 @@ export default function ListPage(props: ListPageProps) {
|
|
|
58
70
|
<>
|
|
59
71
|
<div className="container px-4 mx-auto lg:px-0 lg:my-4">
|
|
60
72
|
<div className="grid grid-cols-[19rem_1fr]">
|
|
61
|
-
<Filters
|
|
73
|
+
<Filters
|
|
74
|
+
isMenuOpen={isMenuOpen}
|
|
75
|
+
setIsMenuOpen={(open) => dispatch(setMenuOpen(open))}
|
|
76
|
+
/>
|
|
62
77
|
<div
|
|
63
|
-
onClick={() =>
|
|
78
|
+
onClick={() => dispatch(setMenuOpen(false))}
|
|
64
79
|
className={clsx(
|
|
65
80
|
'transition-opacity duration-300 ease-linear lg:hidden',
|
|
66
81
|
isMenuOpen
|
|
@@ -71,7 +86,7 @@ export default function ListPage(props: ListPageProps) {
|
|
|
71
86
|
<div className="flex flex-col items-center lg:items-stretch col-span-2 lg:col-span-1">
|
|
72
87
|
<CategoryHeader
|
|
73
88
|
totalCount={data.pagination?.total_count}
|
|
74
|
-
setMenuStatus={() =>
|
|
89
|
+
setMenuStatus={() => dispatch(setMenuOpen(true))}
|
|
75
90
|
sortOptions={data.sorters}
|
|
76
91
|
/>
|
|
77
92
|
<div className="hidden lg:block">
|
|
@@ -91,18 +106,17 @@ export default function ListPage(props: ListPageProps) {
|
|
|
91
106
|
|
|
92
107
|
<div
|
|
93
108
|
className={clsx('grid gap-x-4 gap-y-12 grid-cols-2', {
|
|
94
|
-
'md:grid-cols-3':
|
|
95
|
-
'lg:grid-cols-2':
|
|
96
|
-
'lg:grid-cols-3':
|
|
109
|
+
'md:grid-cols-3': layoutSize === 3,
|
|
110
|
+
'lg:grid-cols-2': layoutSize === 2,
|
|
111
|
+
'lg:grid-cols-3': layoutSize === 3
|
|
97
112
|
})}
|
|
98
113
|
>
|
|
99
114
|
{data.products.map((product, index) => (
|
|
100
115
|
<ProductItem
|
|
101
116
|
key={product.pk}
|
|
102
117
|
product={product}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
height={510}
|
|
118
|
+
width={itemDimensions.width}
|
|
119
|
+
height={itemDimensions.height}
|
|
106
120
|
index={index}
|
|
107
121
|
/>
|
|
108
122
|
))}
|