Skip to content

Commit

Permalink
added components to check empty carasel
Browse files Browse the repository at this point in the history
  • Loading branch information
okeino committed Oct 17, 2023
1 parent 3d90469 commit c98aa76
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
27 changes: 27 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ type Collection implements Node & UniformResourceLocatable {
after: String
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -2087,6 +2090,9 @@ type Person implements Node & UniformResourceLocatable {
collectionId: ID
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -2399,6 +2405,9 @@ type Query {
collectionId: ID
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -2653,6 +2662,9 @@ type Query {
collectionIds: [ID!]
contentType: SequenceContentType

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -2786,6 +2798,9 @@ type Query {
collectionId: ID
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -3200,6 +3215,9 @@ type Query {
collectionIds: [ID!]
contentType: SequenceContentType

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -3228,6 +3246,9 @@ type Query {
collectionId: ID
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -3459,6 +3480,9 @@ type Query {
collectionId: ID
collectionIds: [ID!]

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down Expand Up @@ -4540,6 +4564,9 @@ type Sponsor implements Node & UniformResourceLocatable {
collectionIds: [ID!]
contentType: SequenceContentType = SERIES

"""The sequence must not be associated with any of the persons provided."""
excludePersons: [RecordingPersonInput!]

"""Return up to the first `n` elements from the list."""
first: Int

Expand Down
16 changes: 16 additions & 0 deletions src/components/atoms/hasTitleField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';

interface ComponentWithTitleProps {
children?: React.ReactNode;
title?: string; // Modify this type according to your specific title field type
}

const hasTitleField = (
component: React.ReactElement<ComponentWithTitleProps>
): boolean => {
const { title } = component.props;

return !!title; // Return true if the component has a non-empty title
};

export default hasTitleField;
12 changes: 12 additions & 0 deletions src/components/atoms/isComponentEmpty.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

const isComponentEmpty = (component: React.ReactNode): boolean => {
// Check if the component is null, undefined, or has no children
return (
component === null ||
component === undefined ||
React.Children.count(component) === 0
);
};

export default isComponentEmpty;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ query getSectionAudiobooks(
first: $first
after: $after
orderBy: [{ field: RECORDING_PUBLISHED_AT, direction: DESC }]
excludePersons: [{ personId: "128" }]
) {
nodes {
...cardSequence
Expand Down
1 change: 1 addition & 0 deletions src/containers/audiobook/list.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ query getAudiobookListPageData(
first: $first
offset: $offset
orderBy: [{ field: TITLE, direction: ASC }]
excludePersons: [{ personId: "128" }]
) {
nodes {
...cardSequence
Expand Down

0 comments on commit c98aa76

Please sign in to comment.