From a3869d29cf18071bcbe39e2c6184748e6bff61e6 Mon Sep 17 00:00:00 2001 From: Ricardo Dahis Date: Tue, 29 Oct 2024 14:57:16 +1100 Subject: [PATCH 1/2] fix: PayPal button loading wait --- next/components/atoms/PayPalButton.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/next/components/atoms/PayPalButton.js b/next/components/atoms/PayPalButton.js index f669753c..0be64027 100644 --- a/next/components/atoms/PayPalButton.js +++ b/next/components/atoms/PayPalButton.js @@ -8,7 +8,7 @@ const PayPalButton = () => { useEffect(() => { const renderButton = () => { - if (window.paypal) { + if (window.paypal && window.paypal.HostedButtons) { const buttonConfig = getButtonConfig(locale); window.paypal.HostedButtons({ hostedButtonId: buttonConfig.id, @@ -16,10 +16,17 @@ const PayPalButton = () => { } }; - if (window.paypal) { + if (window.paypal && window.paypal.HostedButtons) { renderButton(); } else { - window.renderPayPalButton = renderButton; + const checkPayPal = setInterval(() => { + if (window.paypal && window.paypal.HostedButtons) { + renderButton(); + clearInterval(checkPayPal); + } + }, 100); + + return () => clearInterval(checkPayPal); } }, [locale]); From 1b2e39cc063051aca8061ad7eac525235b998ff2 Mon Sep 17 00:00:00 2001 From: Ricardo Dahis Date: Tue, 29 Oct 2024 15:23:04 +1100 Subject: [PATCH 2/2] feat: /dataset to /search --- next/components/atoms/DatasetCardTag.js | 2 +- next/components/molecules/Footer.js | 10 ++++---- next/components/molecules/Menu.js | 12 +++++----- next/components/organisms/Dataset.js | 2 +- next/components/organisms/DatasetCard.js | 4 ++-- next/components/organisms/PostDatasetForm.js | 2 +- .../componentsUserPage/PlansAndPayment.js | 2 +- next/next.config.js | 13 +++++++++- next/pages/dataset/[dataset].js | 2 +- next/pages/index.js | 8 +++---- next/pages/prices.js | 2 +- next/pages/{dataset/index.js => search.js} | 24 +++++++++---------- next/pages/services.js | 16 +++++++++---- next/public/locales/en/common.json | 2 +- 14 files changed, 59 insertions(+), 42 deletions(-) rename next/pages/{dataset/index.js => search.js} (97%) diff --git a/next/components/atoms/DatasetCardTag.js b/next/components/atoms/DatasetCardTag.js index 703c1a16..2121d91d 100644 --- a/next/components/atoms/DatasetCardTag.js +++ b/next/components/atoms/DatasetCardTag.js @@ -10,7 +10,7 @@ export function DatasetCardTag({ slug, name, locale, ...props }) { cursor="pointer" > - + {t('footer.products.searchEngine')} - + {t('footer.services.dataCapture')} - + {t('footer.services.dataAnalytics')} - + {t('footer.services.dataConsulting')} - + {t('footer.services.caseStudies')} diff --git a/next/components/molecules/Menu.js b/next/components/molecules/Menu.js index 7eac751b..1ea29b88 100644 --- a/next/components/molecules/Menu.js +++ b/next/components/molecules/Menu.js @@ -587,7 +587,7 @@ function SearchInputUser ({ user }) { function openSearchLink() { if(search.trim() === "") return triggerGAEvent("search_menu", search.trim()) - router.push(`/dataset?q=${search.trim()}`); + router.push(`/search?q=${search.trim()}`); } const handleClickOutside = (event) => { @@ -633,7 +633,7 @@ function SearchInputUser ({ user }) { fill="#464A51" icon={ { e.preventDefault(); openSearchLink(); @@ -680,7 +680,7 @@ function SearchInputUser ({ user }) { fill="#464A51" icon={ { e.preventDefault(); openSearchLink(); @@ -836,7 +836,7 @@ function DesktopLinks({ } - {(path === "/dataset" || path === "/dataset/[dataset]" || "/user/[username]") && + {(path === "/search" || path === "/dataset/[dataset]" || "/user/[username]") && : , diff --git a/next/components/organisms/Dataset.js b/next/components/organisms/Dataset.js index a13d03a4..ece00d0e 100644 --- a/next/components/organisms/Dataset.js +++ b/next/components/organisms/Dataset.js @@ -223,7 +223,7 @@ export default function Dataset({ {t('organization')}: - + diff --git a/next/components/organisms/componentsUserPage/PlansAndPayment.js b/next/components/organisms/componentsUserPage/PlansAndPayment.js index e3b2cd52..8812c9e0 100644 --- a/next/components/organisms/componentsUserPage/PlansAndPayment.js +++ b/next/components/organisms/componentsUserPage/PlansAndPayment.js @@ -1214,7 +1214,7 @@ export default function PlansAndPayment ({ userData }) { ]} button={{ text: t('username.exploreFeatures'), - href: "/dataset", + href: "/search", noHasModal: true, }} /> diff --git a/next/next.config.js b/next/next.config.js index 7c823203..8adf47b5 100644 --- a/next/next.config.js +++ b/next/next.config.js @@ -12,5 +12,16 @@ module.exports = { }, output: "standalone", reactStrictMode: true, - swcMinify: true + swcMinify: true, + + async redirects() { + return [ + { + source: '/dataset', + destination: '/search', + permanent: true, + } + ] + } + }; diff --git a/next/pages/dataset/[dataset].js b/next/pages/dataset/[dataset].js index bc49d2eb..26b93f6e 100644 --- a/next/pages/dataset/[dataset].js +++ b/next/pages/dataset/[dataset].js @@ -197,7 +197,7 @@ export default function DatasetPage ({ dataset }) { {t('organization')} diff --git a/next/pages/index.js b/next/pages/index.js index 20965981..b418be0a 100644 --- a/next/pages/index.js +++ b/next/pages/index.js @@ -75,7 +75,7 @@ function Hero({ dataThemeCatalog, locale }) { function openSearchLink() { triggerGAEvent("search", search) triggerGAEvent("search_home", search) - router.push(`/dataset?q=${search}`); + router.push(`/search?q=${search}`); } return ( @@ -157,7 +157,7 @@ function Hero({ dataThemeCatalog, locale }) { rightIcon={ (search ? { e.preventDefault(); openSearchLink(); @@ -282,7 +282,7 @@ function Products() { {t('products.start_search')} @@ -325,7 +325,7 @@ function Products() { {t('products.view_available_data')} diff --git a/next/pages/prices.js b/next/pages/prices.js index 1156bc32..d70a4866 100644 --- a/next/pages/prices.js +++ b/next/pages/prices.js @@ -438,7 +438,7 @@ export function SectionPrice() { }))} button={{ text: t('exploreFeatures'), - href: "/dataset", + href: "/search", }} locale={locale} /> diff --git a/next/pages/dataset/index.js b/next/pages/search.js similarity index 97% rename from next/pages/dataset/index.js rename to next/pages/search.js index 4b3851e9..719c2345 100644 --- a/next/pages/dataset/index.js +++ b/next/pages/search.js @@ -16,22 +16,22 @@ import { useEffect, useState } from "react"; import cookies from "js-cookie"; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; -import Link from "../../components/atoms/Link"; -import { isMobileMod, useCheckMobile } from "../../hooks/useCheckMobile.hook"; -import { triggerGAEvent } from "../../utils"; +import Link from "../components/atoms/Link"; +import { isMobileMod, useCheckMobile } from "../hooks/useCheckMobile.hook"; +import { triggerGAEvent } from "../utils"; import { getSearchDatasets -} from "../api/datasets/index"; +} from "./api/datasets/index"; -import { CheckboxFilterAccordion } from "../../components/atoms/FilterAccordion"; -import Checkbox from "../../components/atoms/Checkbox"; -import { TagFilter } from "../../components/atoms/Tag"; -import Dataset from "../../components/organisms/Dataset"; -import { MainPageTemplate } from "../../components/templates/main"; +import { CheckboxFilterAccordion } from "../components/atoms/FilterAccordion"; +import Checkbox from "../components/atoms/Checkbox"; +import { TagFilter } from "../components/atoms/Tag"; +import Dataset from "../components/organisms/Dataset"; +import { MainPageTemplate } from "../components/templates/main"; -import FilterIcon from "../../public/img/icons/filterIcon"; -import NotFoundImage from "../../public/img/notFoundImage"; +import FilterIcon from "../public/img/icons/filterIcon"; +import NotFoundImage from "../public/img/notFoundImage"; export async function getStaticProps({ locale }) { return { @@ -357,7 +357,7 @@ export default function SearchDatasetPage() { )} @@ -365,7 +371,7 @@ export default function Services() { gap="120px" > {Object.entries(services).map(([k, v]) => ( - + @@ -379,7 +385,7 @@ export default function Services() {