From c6160b5cb70b0ab368b15db069c9ea316a8fecd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roc=C3=ADo=20Llanes?= Date: Wed, 29 May 2024 11:52:15 -0300 Subject: [PATCH 1/3] SBIT-266: subscription url or landing management added --- .../Footer/Subscription/subscription.js | 24 ++++++++++++++--- src/hooks/useFooter.js | 7 +++-- src/schema/layoutSchema.js | 27 +++++++++++++++++++ src/schema/schema.js | 26 ++++++++++++++++++ 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/src/components/Footer/Subscription/subscription.js b/src/components/Footer/Subscription/subscription.js index a487bd21..cbd7dc7e 100644 --- a/src/components/Footer/Subscription/subscription.js +++ b/src/components/Footer/Subscription/subscription.js @@ -6,6 +6,10 @@ import "./subscription.scss" export default function Subscription() { const data = useFooter() const dataSubscription = data?.allStrapiLayout?.nodes[0]?.footer?.subscription + const subscriptionUrl = dataSubscription?.url + const subscriptionLanding = data?.allStrapiLayout?.nodes[0]?.footer?.subscription?.landing_page?.slug + + const isExternalLink = subscriptionUrl && subscriptionUrl.startsWith('http') return (
@@ -13,13 +17,27 @@ export default function Subscription() {
) -} +} \ No newline at end of file diff --git a/src/hooks/useFooter.js b/src/hooks/useFooter.js index c73e894e..2827a39b 100644 --- a/src/hooks/useFooter.js +++ b/src/hooks/useFooter.js @@ -74,6 +74,10 @@ const useFooter = () => { } subscription { title + url + landing_page { + slug + } } } } @@ -82,5 +86,4 @@ const useFooter = () => { `) } -export default useFooter - +export default useFooter \ No newline at end of file diff --git a/src/schema/layoutSchema.js b/src/schema/layoutSchema.js index fabdde60..c68bbd6a 100644 --- a/src/schema/layoutSchema.js +++ b/src/schema/layoutSchema.js @@ -117,7 +117,34 @@ type StrapiLayoutNavbarNavButtonLanding_page { type StrapiLayoutFooterSubscription { id: Int title: String + url: String + landing_page: StrapiLayoutFooterSubscriptionLanding } + + type StrapiLayoutFooterSubscriptionLanding { + id: Int + name: String + slug: String + published_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date + created_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date + updated_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date + } + type StrapiLayoutFooterNavegation { id: Int diff --git a/src/schema/schema.js b/src/schema/schema.js index 3591b8d4..c17b7bf9 100644 --- a/src/schema/schema.js +++ b/src/schema/schema.js @@ -1308,6 +1308,32 @@ type StrapiLayoutNavbarLogo { type StrapiLayoutFooterSubscription { id: Int title: String + url: String + landing_page: StrapiLayoutFooterSubscriptionLanding +} + +type StrapiLayoutFooterSubscriptionLanding { + id: Int + name: String + slug: String + published_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date + created_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date + updated_at( + formatString: String + fromNow: Boolean + difference: String + locale: String + ): Date } type StrapiLayoutFooterNavegation { From e1538a9181923c2d6bf4592a9d33344de48a0241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roc=C3=ADo=20Llanes?= Date: Wed, 29 May 2024 15:21:31 -0300 Subject: [PATCH 2/3] SBIT-266: fixes --- src/components/Footer/Subscription/subscription.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Footer/Subscription/subscription.js b/src/components/Footer/Subscription/subscription.js index cbd7dc7e..1233e107 100644 --- a/src/components/Footer/Subscription/subscription.js +++ b/src/components/Footer/Subscription/subscription.js @@ -6,10 +6,10 @@ import "./subscription.scss" export default function Subscription() { const data = useFooter() const dataSubscription = data?.allStrapiLayout?.nodes[0]?.footer?.subscription - const subscriptionUrl = dataSubscription?.url + const subscriptionUrl = data?.allStrapiLayout?.nodes[0]?.footer?.subscription?.url const subscriptionLanding = data?.allStrapiLayout?.nodes[0]?.footer?.subscription?.landing_page?.slug - const isExternalLink = subscriptionUrl && subscriptionUrl.startsWith('http') + const isExternalLink = subscriptionUrl?.startsWith('http') return (
From 8955705053ea6efe2b00e27880e3e3ea09fdc9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roc=C3=ADo=20Llanes?= Date: Wed, 29 May 2024 16:06:48 -0300 Subject: [PATCH 3/3] fix on constants --- src/components/Footer/Subscription/subscription.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Footer/Subscription/subscription.js b/src/components/Footer/Subscription/subscription.js index 1233e107..6305d1af 100644 --- a/src/components/Footer/Subscription/subscription.js +++ b/src/components/Footer/Subscription/subscription.js @@ -6,8 +6,8 @@ import "./subscription.scss" export default function Subscription() { const data = useFooter() const dataSubscription = data?.allStrapiLayout?.nodes[0]?.footer?.subscription - const subscriptionUrl = data?.allStrapiLayout?.nodes[0]?.footer?.subscription?.url - const subscriptionLanding = data?.allStrapiLayout?.nodes[0]?.footer?.subscription?.landing_page?.slug + const subscriptionUrl = dataSubscription?.url + const subscriptionLanding = dataSubscription?.landing_page?.slug const isExternalLink = subscriptionUrl?.startsWith('http')