From 1c1bfe3c5b8befde0f1041addc38b20b2b3572aa Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:33:50 -0500 Subject: [PATCH 1/6] Allow querying of related videos content-for-sections --- .../graphql/queries/content-for-section.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/leaders-program/src/graphql/queries/content-for-section.js b/packages/leaders-program/src/graphql/queries/content-for-section.js index ba180c9fd..b98449c82 100644 --- a/packages/leaders-program/src/graphql/queries/content-for-section.js +++ b/packages/leaders-program/src/graphql/queries/content-for-section.js @@ -117,6 +117,33 @@ query ContentForLeadersSection( } } } + relatedVideos: relatedContent(input: { + withSite: false, + queryTypes: [company], + includeContentTypes: [Video], + pagination: { limit: $videoLimit }, + }) { + edges { + node { + id + name + primaryImage{ + id + src(input: { + options: { + auto: "format", + fit: "crop", + h: 180, + w: 240, + } + }) + alt + isLogo + } + canonicalPath + } + } + } } } } From 70af72ba037efbdbb02aa23824f1dbb38ae312b9 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:34:13 -0500 Subject: [PATCH 2/6] Display related videos when applicable --- .../src/components/card/index.vue | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/leaders-program/src/components/card/index.vue b/packages/leaders-program/src/components/card/index.vue index a1796d4f9..066fede1c 100644 --- a/packages/leaders-program/src/components/card/index.vue +++ b/packages/leaders-program/src/components/card/index.vue @@ -76,6 +76,28 @@ /> + + + + + @@ -137,11 +159,14 @@ export default { promotions() { return getEdgeNodes(this.company, 'promotions'); }, + relatedVideos() { + return getEdgeNodes(this.company, 'relatedVideos'); + }, videos() { return getEdgeNodes(this.company, 'videos'); }, displayBody() { - return Boolean(this.promotions.length || this.videos.length); + return Boolean(this.promotions.length || this.videos.length || this.relatedVideos.length); }, displayRightHeader() { return this.displayRightTopHeader || this.displayRightBottomHeader; @@ -168,6 +193,9 @@ export default { }, methods: { + convertToString(value) { + return String(value); + }, get(obj, path) { return get(obj, path); }, From c7228c8b0466f0da5cee3c6624e035fc4a92c087 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:34:37 -0500 Subject: [PATCH 3/6] Require an image for relatedVideo --- .../leaders-program/src/graphql/queries/content-for-section.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/leaders-program/src/graphql/queries/content-for-section.js b/packages/leaders-program/src/graphql/queries/content-for-section.js index b98449c82..ac006f508 100644 --- a/packages/leaders-program/src/graphql/queries/content-for-section.js +++ b/packages/leaders-program/src/graphql/queries/content-for-section.js @@ -122,6 +122,7 @@ query ContentForLeadersSection( queryTypes: [company], includeContentTypes: [Video], pagination: { limit: $videoLimit }, + requiresImage: true, }) { edges { node { From ff11eff52d6aad8df2cddf9fae0fd16d9f3d88b8 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:40:05 -0500 Subject: [PATCH 4/6] Use get accessor function for primaryImage src --- packages/leaders-program/src/components/card/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/leaders-program/src/components/card/index.vue b/packages/leaders-program/src/components/card/index.vue index 066fede1c..48b3e8452 100644 --- a/packages/leaders-program/src/components/card/index.vue +++ b/packages/leaders-program/src/components/card/index.vue @@ -93,7 +93,7 @@ :video-id="convertToString(item.id)" :title="item.name" :href="item.canonicalPath" - :image-src="item.primaryImage.src" + :image-src="get(item, 'primaryImage.src')" @click="handleVideoClick" /> From fdfd7a2f50bf8c63a20bd7cfa3804dd98541127c Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:49:05 -0500 Subject: [PATCH 5/6] Passthrough featureYoutubeVideos through to data cards --- .../src/components/containers/section-wrapper.vue | 5 +++++ .../leaders-program/src/components/containers/section.vue | 5 +++++ packages/leaders-program/src/components/leaders.vue | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/packages/leaders-program/src/components/containers/section-wrapper.vue b/packages/leaders-program/src/components/containers/section-wrapper.vue index 4b1c29434..627527077 100644 --- a/packages/leaders-program/src/components/containers/section-wrapper.vue +++ b/packages/leaders-program/src/components/containers/section-wrapper.vue @@ -27,6 +27,7 @@ :promotion-limit="promotionLimit" :video-limit="videoLimit" :featured-product-label="featuredProductLabel" + :feature-youtube-videos="featureYoutubeVideos" :icon-style="iconStyle" @action="emitAction" /> @@ -117,6 +118,10 @@ export default { type: String, default: 'Featured Products', }, + featureYoutubeVideos: { + type: Boolean, + default: true, + }, }, computed: { diff --git a/packages/leaders-program/src/components/containers/section.vue b/packages/leaders-program/src/components/containers/section.vue index 68160aef8..89124f0bf 100644 --- a/packages/leaders-program/src/components/containers/section.vue +++ b/packages/leaders-program/src/components/containers/section.vue @@ -37,6 +37,7 @@ :company="item" :is-active="isActive" :featured-product-label="featuredProductLabel" + :feature-youtube-videos="featureYoutubeVideos" @action="emitAction" /> @@ -114,6 +115,10 @@ export default { type: String, default: 'Featured Products', }, + featureYoutubeVideos: { + type: Boolean, + default: true, + }, iconStyle: { type: String, default: 'plus-minus', diff --git a/packages/leaders-program/src/components/leaders.vue b/packages/leaders-program/src/components/leaders.vue index 00fd48374..98c2a055d 100644 --- a/packages/leaders-program/src/components/leaders.vue +++ b/packages/leaders-program/src/components/leaders.vue @@ -36,6 +36,7 @@ :promotion-limit="promotionLimit" :video-limit="videoLimit" :featured-product-label="featuredProductLabel" + :feature-youtube-videos="featureYoutubeVideos" :icon-style="iconStyle" @action="emitAction" /> @@ -188,6 +189,10 @@ export default { type: String, default: 'Featured Products', }, + featureYoutubeVideos: { + type: Boolean, + default: true, + }, iconStyle: { type: String, default: 'plus-minus', From 474bf8c593005c1400079d1f1a1b9ff2cf41339a Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 21 May 2024 09:49:24 -0500 Subject: [PATCH 6/6] Utilize featureYoutubeVideos to determine when to feature them over related --- .../src/components/card/index.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/leaders-program/src/components/card/index.vue b/packages/leaders-program/src/components/card/index.vue index 48b3e8452..583749965 100644 --- a/packages/leaders-program/src/components/card/index.vue +++ b/packages/leaders-program/src/components/card/index.vue @@ -54,7 +54,12 @@ /> - + @@ -76,7 +81,12 @@ /> - + @@ -138,6 +148,10 @@ export default { type: String, default: 'Featured Products', }, + featureYoutubeVideos: { + type: Boolean, + default: true, + }, }, computed: {