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

Commit 93c16e7

Browse files
authored
Merge branch 'trunk' into add/9369-product-collection-full-grid-pattern
2 parents e163e48 + 2333280 commit 93c16e7

File tree

161 files changed

+3213
-1408
lines changed

Some content is hidden

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

161 files changed

+3213
-1408
lines changed

.github/workflows/check-doc-links.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,23 @@ concurrency:
1111
permissions: {}
1212

1313
jobs:
14-
markdown-link-check:
15-
runs-on: ubuntu-latest
16-
permissions:
17-
contents: read
18-
steps:
19-
- uses: actions/checkout@v3
20-
- uses: gaurav-nelson/github-action-markdown-link-check@v1
21-
with:
22-
use-quiet-mode: 'yes'
23-
use-verbose-mode: 'no'
24-
config-file: '.github/workflows/check-doc-links-config.json'
25-
folder-path: './docs'
26-
file-path: './README.md'
27-
max-depth: 3
28-
base-branch: 'trunk'
14+
markdown_link_check:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Install Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version-file: '.nvmrc'
25+
cache: 'npm'
26+
27+
- name: Install markdown-link-check
28+
run: npm install -g markdown-link-check
29+
30+
- name: Run markdown-link-check
31+
run: |
32+
find ./docs -path ./docs/internal-developers/testing/releases -prune -o -name "*.md" -print0 | xargs -0 -n1 markdown-link-check -c .github/workflows/check-doc-links-config.json
33+

.github/workflows/nightly-builds.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- cron: '0 0 * * *' # Run at 12 AM UTC.
66
workflow_dispatch:
77

8+
env:
9+
NODE_OPTIONS: --max-old-space-size=4096 # development build takes a lot of memory
10+
811
jobs:
912
build:
1013
name: Nightly builds

assets/js/atomic/blocks/product-elements/button/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
white-space: normal;
44
display: flex;
55
justify-content: center;
6+
flex-direction: column;
67
align-items: center;
78
gap: $gap-small;
89

assets/js/base/components/reviews/review-list-item/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { __, sprintf } from '@wordpress/i18n';
55
import classNames from 'classnames';
66
import ReadMore from '@woocommerce/base-components/read-more';
7-
import type { BlockAttributes } from '@wordpress/blocks';
7+
import { ReviewBlockAttributes } from '@woocommerce/blocks/reviews/attributes';
88

99
/**
1010
* Internal dependencies
@@ -154,8 +154,9 @@ function getReviewRating( review: Review ): JSX.Element {
154154
</div>
155155
);
156156
}
157+
157158
interface ReviewListItemProps {
158-
attributes: BlockAttributes;
159+
attributes: ReviewBlockAttributes;
159160
review?: Review;
160161
}
161162

assets/js/base/components/reviews/review-list/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@
22
* External dependencies
33
*/
44
import { getSetting } from '@woocommerce/settings';
5-
import type { BlockAttributes } from '@wordpress/blocks';
5+
import { ReviewBlockAttributes } from '@woocommerce/blocks/reviews/attributes';
66

77
/**
88
* Internal dependencies
99
*/
1010
import ReviewListItem from '../review-list-item';
1111
import type { Review } from '../types';
1212
import './style.scss';
13-
1413
interface ReviewListProps {
15-
attributes: BlockAttributes;
14+
attributes: ReviewBlockAttributes;
1615
reviews: Review[];
1716
}
1817

1918
const ReviewList = ( {
2019
attributes,
2120
reviews,
2221
}: ReviewListProps ): JSX.Element => {
23-
const showAvatars = getSetting( 'showAvatars', true );
24-
const reviewRatingsEnabled = getSetting( 'reviewRatingsEnabled', true );
22+
const showAvatars = getSetting< boolean >( 'showAvatars', true );
23+
const reviewRatingsEnabled = getSetting< boolean >(
24+
'reviewRatingsEnabled',
25+
true
26+
);
2527
const showReviewImage =
2628
( showAvatars || attributes.imageType === 'product' ) &&
2729
attributes.showReviewImage;

assets/js/base/context/hooks/collections/use-collection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export interface useCollectionOptions {
4949
isEditor?: boolean;
5050
}
5151

52-
export const useCollection = (
52+
export const useCollection = < T >(
5353
options: useCollectionOptions
5454
): {
55-
results: unknown;
55+
results: T[];
5656
isLoading: boolean;
5757
} => {
5858
const {
@@ -68,7 +68,7 @@ export const useCollection = (
6868
'the resource properties.'
6969
);
7070
}
71-
const currentResults = useRef< { results: unknown; isLoading: boolean } >( {
71+
const currentResults = useRef< { results: T[]; isLoading: boolean } >( {
7272
results: [],
7373
isLoading: true,
7474
} );
@@ -102,7 +102,7 @@ export const useCollection = (
102102
}
103103

104104
return {
105-
results: store.getCollection< T >( ...args ),
105+
results: store.getCollection< T[] >( ...args ),
106106
isLoading: ! store.hasFinishedResolution(
107107
'getCollection',
108108
args

assets/js/base/context/hooks/use-store-products.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ export const useStoreProducts = (
3535
namespace: '/wc/store/v1',
3636
resourceName: 'products',
3737
};
38-
const { results: products, isLoading: productsLoading } = useCollection( {
39-
...collectionOptions,
40-
query,
41-
} );
38+
const { results: products, isLoading: productsLoading } =
39+
useCollection< ProductResponseItem >( {
40+
...collectionOptions,
41+
query,
42+
} );
4243
const { value: totalProducts } = useCollectionHeader( 'x-wp-total', {
4344
...collectionOptions,
4445
query,
4546
} );
4647
return {
47-
products: products as ProductResponseItem[], // TODO: Remove this once getCollection selector and resolver is converted to TS.
48+
products,
4849
totalProducts: parseInt( totalProducts as string, 10 ),
4950
productsLoading,
5051
};

assets/js/blocks/active-filters/active-attribute-filters.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { __ } from '@wordpress/i18n';
1111
import { getSettingWithCoercion } from '@woocommerce/settings';
1212
import {
1313
AttributeObject,
14+
AttributeTerm,
1415
isAttributeQueryCollection,
1516
isAttributeTermCollection,
1617
isBoolean,
@@ -47,7 +48,7 @@ const ActiveAttributeFilters = ( {
4748
displayStyle,
4849
isLoadingCallback,
4950
}: ActiveAttributeFiltersProps ) => {
50-
const { results, isLoading } = useCollection( {
51+
const { results, isLoading } = useCollection< AttributeTerm >( {
5152
namespace: '/wc/store/v1',
5253
resourceName: 'products/attributes/terms',
5354
resourceValues: [ attributeObject.id ],

assets/js/blocks/attribute-filter/block.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getSettingWithCoercion } from '@woocommerce/settings';
1919
import { getQueryArgs, removeQueryArgs } from '@wordpress/url';
2020
import {
2121
AttributeQuery,
22+
AttributeTerm,
2223
isAttributeQueryCollection,
2324
isBoolean,
2425
isString,
@@ -124,7 +125,7 @@ const AttributeFilterBlock = ( {
124125
useQueryStateByKey( 'attributes', [] );
125126

126127
const { results: attributeTerms, isLoading: attributeTermsLoading } =
127-
useCollection( {
128+
useCollection< AttributeTerm >( {
128129
namespace: '/wc/store/v1',
129130
resourceName: 'products/attributes/terms',
130131
resourceValues: [ attributeObject?.id || 0 ],
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { SVG, Rect } from '@wordpress/primitives';
5+
6+
export const queryPaginationIcon = (
7+
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
8+
<Rect
9+
x="4"
10+
y="10.5"
11+
width="6"
12+
height="3"
13+
rx="1.5"
14+
fill="currentColor"
15+
/>
16+
<Rect
17+
x="12"
18+
y="10.5"
19+
width="3"
20+
height="3"
21+
rx="1.5"
22+
fill="currentColor"
23+
/>
24+
<Rect
25+
x="17"
26+
y="10.5"
27+
width="3"
28+
height="3"
29+
rx="1.5"
30+
fill="currentColor"
31+
/>
32+
</SVG>
33+
);

0 commit comments

Comments
 (0)