@secretstache/wordpress-gutenberg 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
package/build/styles.css CHANGED
@@ -269,5 +269,8 @@
269
269
  box-shadow: inset 0 0 0 1px #1e1e1e;
270
270
  color: #1e1e1e; }
271
271
 
272
- .block-editor-inserter__quick-inserter-results .block-editor-block-types-list > [role=presentation] {
272
+ .block-editor__container .block-editor-inserter__insertable-blocks-at-selection + .block-editor-inserter__all-blocks {
273
+ display: none; }
274
+
275
+ .block-editor__container .block-editor-block-types-list > [role=presentation] {
273
276
  justify-content: center; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -1,16 +1,17 @@
1
1
  import { Notice, Placeholder, Spinner } from '@wordpress/components';
2
2
 
3
- const EmptyNotice = ({
4
- message = 'No resources were found matching your criteria. Please try to adjust the query.'
5
- }) => (
3
+ const DEFAULT_EMPTY_RESOURCES_MESSAGE = 'No resources were found matching your criteria. Please try to adjust the query.';
4
+ const DEFAULT_EMPTY_SELECTION_MESSAGE = 'No items are selected. Please use the corresponding relationship field to populate this block.';
5
+
6
+ export const EmptyNotice = ({ message }) => (
6
7
  <Notice status="info" isDismissible={false}>
7
8
  <p>{message}</p>
8
9
  </Notice>
9
10
  );
10
11
 
11
- const LoadingSpinner = () => <Spinner className="bc-spinner" />;
12
+ export const LoadingSpinner = () => <Spinner className="bc-spinner" />;
12
13
 
13
- const PlaceholderContent = ({
14
+ export const PlaceholderContent = ({
14
15
  icon = 'info-outline',
15
16
  instructions = 'Please configure the block in the sidebar.',
16
17
  ...restProps
@@ -24,9 +25,11 @@ const PlaceholderContent = ({
24
25
 
25
26
  export const ResourcesWrapper = ({
26
27
  isLoading,
27
- isEmpty,
28
+ isEmptyResources,
29
+ isEmptySelection,
28
30
  isPlaceholder,
29
- emptyMessage,
31
+ emptyResourcesMessage,
32
+ emptySelectionMessage,
30
33
  placeholderProps = {},
31
34
  children,
32
35
  }) => {
@@ -34,8 +37,12 @@ export const ResourcesWrapper = ({
34
37
  return <LoadingSpinner />;
35
38
  }
36
39
 
37
- if (isEmpty) {
38
- return <EmptyNotice message={emptyMessage} />;
40
+ if (isEmptySelection) {
41
+ return <EmptyNotice message={emptySelectionMessage || DEFAULT_EMPTY_SELECTION_MESSAGE} />;
42
+ }
43
+
44
+ if (isEmptyResources) {
45
+ return <EmptyNotice message={emptyResourcesMessage || DEFAULT_EMPTY_RESOURCES_MESSAGE} />;
39
46
  }
40
47
 
41
48
  if (isPlaceholder) {
@@ -5,8 +5,8 @@ export const useDataQuery = (config, dependencies = []) => {
5
5
  postType,
6
6
  curatedPostsIds,
7
7
 
8
- categoriesTaxonomy,
9
- curatedCategoriesIds,
8
+ taxonomySlug,
9
+ curatedTermsIds,
10
10
 
11
11
  numberOfPosts = -1,
12
12
  extraQueryArgs,
@@ -21,8 +21,8 @@ export const useDataQuery = (config, dependencies = []) => {
21
21
  ...extraQueryArgs,
22
22
  };
23
23
 
24
- if (categoriesTaxonomy && curatedCategoriesIds?.length > 0) {
25
- queryArgs[categoriesTaxonomy] = curatedCategoriesIds.join(',');
24
+ if (taxonomySlug && curatedTermsIds?.length > 0) {
25
+ queryArgs[taxonomySlug] = curatedTermsIds.join(',');
26
26
  }
27
27
 
28
28
  if (curatedPostsIds?.length > 0) {
@@ -37,7 +37,7 @@ export const useDataQuery = (config, dependencies = []) => {
37
37
  const postsToShow = select('core').getEntityRecords('postType', preparedPostType, queryArgs);
38
38
  const isResolving = select('core/data').isResolving('core', 'getEntityRecords', ['postType', preparedPostType, queryArgs]);
39
39
 
40
- const isEmpty = postsToShow !== null && postsToShow?.length === 0;
40
+ const isEmpty = (postsToShow !== null && postsToShow?.length === 0) || numberOfPosts === 0;
41
41
 
42
42
  return {
43
43
  postsToShow,
@@ -78,8 +78,12 @@
78
78
  @import "responsive-spacing";
79
79
  @import "new-child-btn";
80
80
  }
81
- }
82
81
 
83
- .block-editor-inserter__quick-inserter-results .block-editor-block-types-list > [role=presentation] {
84
- justify-content: center;
82
+ .block-editor-inserter__insertable-blocks-at-selection + .block-editor-inserter__all-blocks {
83
+ display: none;
84
+ }
85
+
86
+ .block-editor-block-types-list > [role=presentation] {
87
+ justify-content: center;
88
+ }
85
89
  }