Skip to content

Commit

Permalink
Merge pull request #998 from basedosdados/feat/i18n_adjustments
Browse files Browse the repository at this point in the history
Feat/i18n adjustments
  • Loading branch information
rdahis authored Oct 29, 2024
2 parents cf74008 + 9ec4df2 commit 3d31b47
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 45 deletions.
2 changes: 1 addition & 1 deletion next/components/atoms/DatasetCardTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function DatasetCardTag({ slug, name, locale, ...props }) {
cursor="pointer"
>
<Link
href={`/dataset?tag=${slug}`}
href={`/search?tag=${slug}`}
locale={locale}
fontWeight="300"
fontFamily="ubuntu"
Expand Down
13 changes: 10 additions & 3 deletions next/components/atoms/PayPalButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@ const PayPalButton = () => {

useEffect(() => {
const renderButton = () => {
if (window.paypal) {
if (window.paypal && window.paypal.HostedButtons) {
const buttonConfig = getButtonConfig(locale);
window.paypal.HostedButtons({
hostedButtonId: buttonConfig.id,
}).render(`#paypal-container-${buttonConfig.id}`);
}
};

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]);

Expand Down
10 changes: 5 additions & 5 deletions next/components/molecules/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function Footer({ template, ocult = false }) {
marginLeft="auto"
>
<SectionCategories title={t('footer.products.title')} marginBottom={isMobileMod() && "24px !important"}>
<FooterLink target="_self" href="/dataset">
<FooterLink target="_self" href="/search">
{t('footer.products.searchEngine')}
</FooterLink>
<FooterLink href={
Expand All @@ -211,16 +211,16 @@ export default function Footer({ template, ocult = false }) {
</SectionCategories>

<SectionCategories title={t('footer.services.title')} marginBottom={isMobileMod() && "24px !important"}>
<FooterLink target="_self" href="/services#Captura de dados">
<FooterLink target="_self" href="/services#data-capture">
{t('footer.services.dataCapture')}
</FooterLink>
<FooterLink href="/services#Análise de dados">
<FooterLink href="/services#analytics">
{t('footer.services.dataAnalytics')}
</FooterLink>
<FooterLink href="/services#Consultoria de dados">
<FooterLink href="/services#consulting">
{t('footer.services.dataConsulting')}
</FooterLink>
<FooterLink href="/services#Estudos de caso">
<FooterLink href="/services#case-studies">
{t('footer.services.caseStudies')}
</FooterLink>
</SectionCategories>
Expand Down
12 changes: 6 additions & 6 deletions next/components/molecules/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -633,7 +633,7 @@ function SearchInputUser ({ user }) {
fill="#464A51"
icon={
<Link
href={`/dataset?q=${search.trim()}`}
href={`/search?q=${search.trim()}`}
onClick={(e) => {
e.preventDefault();
openSearchLink();
Expand Down Expand Up @@ -680,7 +680,7 @@ function SearchInputUser ({ user }) {
fill="#464A51"
icon={
<Link
href={`/dataset?q=${search.trim()}`}
href={`/search?q=${search.trim()}`}
onClick={(e) => {
e.preventDefault();
openSearchLink();
Expand Down Expand Up @@ -836,7 +836,7 @@ function DesktopLinks({
}

<HStack spacing="21px" display={{ base: "none", lg: "flex" }}>
{(path === "/dataset" || path === "/dataset/[dataset]" || "/user/[username]") &&
{(path === "/search" || path === "/dataset/[dataset]" || "/user/[username]") &&
<HelpWidget
tooltip={t('tooltip.helpAndResources')}
options={[
Expand Down Expand Up @@ -974,7 +974,7 @@ export default function MenuNav({ simpleTemplate = false, userTemplate = false }
}, [lastScrollY, router.pathname])

function maxWidthDataset() {
if (route === "/dataset" || route === "/dataset/[dataset]" || route === "/user/[username]") return "1440px"
if (route === "/search" || route === "/dataset/[dataset]" || route === "/user/[username]") return "1440px"
return "1264px"
}

Expand All @@ -998,7 +998,7 @@ export default function MenuNav({ simpleTemplate = false, userTemplate = false }
}, [userBD, isLoading])

const links = {
[t('data')]: `/dataset`,
[t('data')]: `/search`,
[t('solutions')]: [
{
icon: locale === 'en' ? <DBLogoProImage widthImage="54px"/> : <BDLogoProImage widthImage="54px"/>,
Expand Down
2 changes: 1 addition & 1 deletion next/components/organisms/Dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default function Dataset({
{t('organization')}:
</Text>
<Link
href={`/dataset?organization=${organization?.slug}`}
href={`/search?organization=${organization?.slug}`}
color="#71757A"
fontWeight="400"
_hover={{
Expand Down
4 changes: 2 additions & 2 deletions next/components/organisms/DatasetCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function DatasetCard({
overflow="hidden"
filter="invert(1)"
_hover={{ opacity: "none" }}
href={`/dataset?theme=${c.slug}`}
href={`/search?theme=${c.slug}`}
target="_blank"
>
<CategoryIcon
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function DatasetCard({
{name}
</Text>
</Link>
<Link href={`/dataset?organization=${organization.slug}`}>
<Link href={`/search?organization=${organization.slug}`}>
<Text
noOfLines={2}
lineHeight="16px"
Expand Down
2 changes: 1 addition & 1 deletion next/components/organisms/PostDatasetForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default function PostDatasetForm({
setIsSuccess({notDelete: true})
onClose()
}
if(result === true) router.push("/dataset", undefined, { locale: router.locale })
if(result === true) router.push("/search", undefined, { locale: router.locale })
}

if(isLoading) return <LoadingSpin/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ export default function PlansAndPayment ({ userData }) {
]}
button={{
text: t('username.exploreFeatures'),
href: "/dataset",
href: "/search",
noHasModal: true,
}}
/>
Expand Down
13 changes: 12 additions & 1 deletion next/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,16 @@ module.exports = {
},
output: "standalone",
reactStrictMode: true,
swcMinify: true
swcMinify: true,

async redirects() {
return [
{
source: '/dataset',
destination: '/search',
permanent: true,
}
]
}

};
2 changes: 1 addition & 1 deletion next/pages/dataset/[dataset].js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default function DatasetPage ({ dataset }) {
{t('organization')}
</Text>
<Link
href={`/dataset?organization=${dataset?.organization?.slug || ""}`}
href={`/search?organization=${dataset?.organization?.slug || ""}`}
color="#464A51"
fontWeight="400"
>
Expand Down
8 changes: 4 additions & 4 deletions next/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -157,7 +157,7 @@ function Hero({ dataThemeCatalog, locale }) {
rightIcon={
(search ?
<Link
href={`/dataset?q=${search}`}
href={`/search?q=${search}`}
onClick={(e) => {
e.preventDefault();
openSearchLink();
Expand Down Expand Up @@ -282,7 +282,7 @@ function Products() {

<SectionLink
marginTop="24px !important"
href={"/dataset"}
href={"/search"}
>
{t('products.start_search')}
</SectionLink>
Expand Down Expand Up @@ -325,7 +325,7 @@ function Products() {

<SectionLink
marginTop="24px !important"
href={"/dataset?contains=tables"}
href={"/search?contains=tables"}
>
{t('products.view_available_data')}
</SectionLink>
Expand Down
2 changes: 1 addition & 1 deletion next/pages/prices.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export function SectionPrice() {
}))}
button={{
text: t('exploreFeatures'),
href: "/dataset",
href: "/search",
}}
locale={locale}
/>
Expand Down
24 changes: 12 additions & 12 deletions next/pages/dataset/index.js → next/pages/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -357,7 +357,7 @@ export default function SearchDatasetPage() {
)}

<Link
href="/dataset"
href="/search"
fontFamily="Roboto"
fontWeight="400"
fontSize="14px"
Expand Down
16 changes: 11 additions & 5 deletions next/pages/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function CaseStudies ({}) {

return (
<Stack
id="Estudos de caso"
id="case-studies"
width="100%"
maxWidth="1264px"
paddingTop="100px"
Expand Down Expand Up @@ -336,6 +336,12 @@ export default function Services() {
[t('services.dataConsulting')]: "https://storage.googleapis.com/basedosdados-website/images/lightbulb.png",
}

const service_ids = {
[t('services.dataCapture')]: "data-capture",
[t('services.dataAnalysis')]: "analytics",
[t('services.dataConsulting')]: "consulting",
}

return (
<MainPageTemplate>
<Head>
Expand Down Expand Up @@ -365,7 +371,7 @@ export default function Services() {
gap="120px"
>
{Object.entries(services).map(([k, v]) => (
<Link href={`#${k}`} key={v}>
<Link href={`#${service_ids[k]}`} key={v}>
<VStack justify="flex-end">
<Image alt="" marginBottom="15px" height="100px" src={v} />
<SectionText fontSize="20px" fontWeight="bold">
Expand All @@ -379,7 +385,7 @@ export default function Services() {
<CaseStudies />

<VStack
id="Captura de dados"
id="data-capture"
width="100%"
maxWidth="1264px"
padding="100px 0 40px"
Expand Down Expand Up @@ -434,7 +440,7 @@ export default function Services() {
</VStack>

<VStack
id="Análise de dados"
id="analytics"
width="100%"
maxWidth="1264px"
padding="100px 0 40px"
Expand Down Expand Up @@ -468,7 +474,7 @@ export default function Services() {
</VStack>

<VStack
id="Consultoria de dados"
id="consulting"
width="100%"
maxWidth="1264px"
padding="100px 0 40px"
Expand Down
2 changes: 1 addition & 1 deletion next/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"start_search": "Start your search",
"processed_tables": "PROCESSED TABLES",
"access_quality_data": "Access quality data",
"processed_tables_description": "With the processed tables from our public data lake, you no longer need to spend hours cleaning datasets. Our standardization methodology allows you to easily cross-reference data from different organizations. This way, you can focus on what really matters.",
"processed_tables_description": "With the processed tables in our data lake, you no longer need to spend hours cleaning data. Our standardization methodology allows you to easily cross-reference data from different organizations. This way, you can focus on what really matters.",
"view_available_data": "View available data",
"packages": "PACKAGES",
"explore_in_your_favorite_language": "Explore in your favorite language",
Expand Down

0 comments on commit 3d31b47

Please sign in to comment.