Skip to content

Commit

Permalink
Merge pull request #990 from basedosdados/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
rdahis authored Oct 28, 2024
2 parents 04f9d8e + b6d8aa7 commit 5c94133
Show file tree
Hide file tree
Showing 60 changed files with 1,107 additions and 567 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from '../atoms/Link';
import Link from './Link';
import { Tag } from '@chakra-ui/react';

export function ThemeTag({ slug, locale, ...props }) {
export function DatasetCardTag({ slug, name, locale, ...props }) {
return (
<Tag
borderRadius="8px"
Expand All @@ -21,7 +21,7 @@ export function ThemeTag({ slug, locale, ...props }) {
whiteSpace="nowrap"
{...props}
>
{slug}
{name}
</Link>
</Tag>
);
Expand Down
26 changes: 26 additions & 0 deletions next/components/atoms/LanguageSelector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Menu, MenuButton, MenuList, MenuItem, Button } from "@chakra-ui/react";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import LanguageIcon from "../../public/img/icons/languageIcon";

export default function LanguageSelector() {
const { locale } = useRouter();
const router = useRouter();

const changeLanguage = (locale) => {
router.push(router.pathname, router.asPath, { locale });
};

return (
<Menu>
<MenuButton as={Button} rightIcon={<LanguageIcon />} variant="ghost">
{locale === 'pt' ? 'PT' : locale === 'en' ? 'EN' : 'ES'}
</MenuButton>
<MenuList>
<MenuItem onClick={() => changeLanguage('pt')}>Português</MenuItem>
<MenuItem onClick={() => changeLanguage('en')}>English</MenuItem>
<MenuItem onClick={() => changeLanguage('es')}>Español</MenuItem>
</MenuList>
</Menu>
);
}
54 changes: 54 additions & 0 deletions next/components/atoms/PayPalButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { useEffect } from 'react';
import Script from 'next/script';
import { useRouter } from 'next/router';

const PayPalButton = () => {
const router = useRouter();
const { locale } = router;

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

if (window.paypal) {
renderButton();
} else {
window.renderPayPalButton = renderButton;
}
}, [locale]);

const getButtonConfig = (locale) => {
switch (locale) {
case 'en':
return { id: '7Z8VZRT49598E', localeParam: 'en_US' };
case 'es':
return { id: '9T4KS6AZABF92', localeParam: 'es_ES' };
default:
return { id: '9XUDXZSNZFS84', localeParam: 'pt_BR' };
}
};

const buttonConfig = getButtonConfig(locale);

return (
<>
<Script
src={`https://www.paypal.com/sdk/js?client-id=BAAMRKxOIs8HZRucUi9h6KGCm--Le5G4bexjKHt6phnjlGLYPvr4VvXNxKuABcWPY8Cr6-E3AydIRd0r-4&components=hosted-buttons&disable-funding=venmo&locale=${buttonConfig.localeParam}`}
onLoad={() => {
if (window.renderPayPalButton) {
window.renderPayPalButton();
}
}}
/>
<div id={`paypal-container-${buttonConfig.id}`}></div>
</>
);
};

export default PayPalButton;
6 changes: 4 additions & 2 deletions next/components/atoms/ReadMore.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {
Text,
} from "@chakra-ui/react";
import { useState, useEffect, useRef } from "react";
import { useTranslation } from 'next-i18next';

export default function ReadMore({ children, id, ...props}) {
const [isReadMore, setIsReadMore] = useState(false)
const [isOverflowing, setIsOverflowing] = useState(false)
const textRef = useRef(null)
const { t } = useTranslation('dataset');

const modifiedChildren = `
${children.trim()}
Expand All @@ -26,7 +28,7 @@ export default function ReadMore({ children, id, ...props}) {
"
onmouseover="this.style.color='#0057A4'"
onmouseout="this.style.color='#0068C5'"
>Ler menos</span>`
>${t('readLess')}</span>`

useEffect(() => {
if (textRef.current) {
Expand Down Expand Up @@ -85,7 +87,7 @@ export default function ReadMore({ children, id, ...props}) {
bottom="0"
right="0"
>
<span style={{color:"#464A51", marginRight:"4px"}}>...</span>Ler mais
<span style={{color:"#464A51", marginRight:"4px"}}>...</span>{t('readMore')}
</Text>
}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion next/components/molecules/Cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function ConfirmCookies() {
>
Utilizamos cookies essenciais para o funcionamento da plataforma.

Veja mais sobre nossa <Link fontFamily="ubuntu" fontSize="16px" color="#42B0FF" href="/termos-e-privacidade?section=cookies" target="_blank">Política de Cookies</Link>.
Veja mais sobre nossa <Link fontFamily="ubuntu" fontSize="16px" color="#42B0FF" href="/terms?section=cookies" target="_blank">Política de Cookies</Link>.
</Text>

<Box width="100%" display="flex" >
Expand Down
44 changes: 31 additions & 13 deletions next/components/molecules/DataInformationQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import rHighlight from "highlight.js/lib/languages/r";
import cookies from "js-cookie";
import 'highlight.js/styles/obsidian.css'
import { useTranslation } from 'next-i18next';
import { useRouter } from "next/router";

import GreenTab from "../atoms/GreenTab";
import Toggle from "../atoms/Toggle";
import ColumnsTable from "./ColumnsTable";
import { SectionPrice } from "../../pages/precos";
import TableColumns from "./TableColumns";
import { SectionPrice } from "../../pages/prices";
import { ModalGeneral } from "./uiUserPage";
import { AlertDiscalimerBox} from "./DisclaimerBox";
import { triggerGAEvent, formatBytes } from "../../utils";
Expand All @@ -42,6 +43,7 @@ import DownloadIcon from "../../public/img/icons/downloadIcon";
import InfoIcon from "../../public/img/icons/infoIcon";
import ChevronIcon from "../../public/img/icons/chevronIcon";
import CheckIcon from "../../public/img/icons/checkIcon";
import Link from "../atoms/Link";

export function CodeHighlight({ language, children }) {
const textRef = useRef(null)
Expand Down Expand Up @@ -174,6 +176,7 @@ export function CodeHighlight({ language, children }) {

export default function DataInformationQuery({ resource }) {
const { t } = useTranslation('dataset');
const { locale } = useRouter();
const [tabAccessIndex, setTabAccessIndex] = useState(0)
const [tabIndex, setTabIndex] = useState(0)
const [downloadPermitted, setDownloadPermitted] = useState(false)
Expand Down Expand Up @@ -381,7 +384,7 @@ export default function DataInformationQuery({ resource }) {
</Text>
</Skeleton>

<ColumnsTable
<TableColumns
tableId={resource._id}
checkedColumns={checkedColumns}
onChangeCheckedColumns={setCheckedColumns}
Expand All @@ -404,9 +407,9 @@ export default function DataInformationQuery({ resource }) {
type="info"
>
{t('table.infoTranslationNotAvailable', { returnObjects: true })[0]}
<Text as="a" marginRight="4px" href="https://basedosdados.org/dataset/e083c9a2-1cee-4342-bedc-535cbad6f3cd?table=0308fbe0-270c-4135-9115-ea1100f400f6" target="_blank" color="#0068C5" _hover={{color: "#0057A4"}}>{t('table.infoTranslationNotAvailable', { returnObjects: true })[1]}</Text>
<Link href="https://basedosdados.org/dataset/e083c9a2-1cee-4342-bedc-535cbad6f3cd?table=0308fbe0-270c-4135-9115-ea1100f400f6" target="_blank" color="#0068C5" _hover={{color: "#0057A4"}}>{t('table.infoTranslationNotAvailable', { returnObjects: true })[1]}</Link>
{t('table.infoTranslationNotAvailable', { returnObjects: true })[2]}
<Text as="a" margin="0 4px" href="https://basedosdados.org/dataset/33b49786-fb5f-496f-bb7c-9811c985af8e?table=dffb65ac-9df9-4151-94bf-88c45bfcb056" target="_blank" color="#0068C5" _hover={{color: "#0057A4"}}>{t('table.infoTranslationNotAvailable', { returnObjects: true })[3]}</Text>
<Link href="https://basedosdados.org/dataset/33b49786-fb5f-496f-bb7c-9811c985af8e?table=dffb65ac-9df9-4151-94bf-88c45bfcb056" target="_blank" color="#0068C5" _hover={{color: "#0057A4"}}>{t('table.infoTranslationNotAvailable', { returnObjects: true })[3]}</Link>
{t('table.infoTranslationNotAvailable', { returnObjects: true })[4]}
</AlertDiscalimerBox>
</Skeleton>
Expand Down Expand Up @@ -573,7 +576,11 @@ export default function DataInformationQuery({ resource }) {
<Text
as="a"
target="_blank"
href="https://basedosdados.github.io/mais/colab_data/"
href={
locale === "en" ? "https://basedosdados.github.io/mais/en/colab_data/" :
locale === "es" ? "https://basedosdados.github.io/mais/es/colab_data/" :
"https://basedosdados.github.io/mais/colab_data/"
}
color="#0068C5"
_hover={{color: "#0057A4"}}
>
Expand All @@ -586,15 +593,14 @@ export default function DataInformationQuery({ resource }) {
type="warning"
>
{t('table.warningPaidPlanRequired', { returnObjects: true })[0]}
<Text
as="a"
<Link
target="_blank"
href="https://basedosdados.org/precos"
href="/prices"
color="#0068C5"
_hover={{color: "#0057A4"}}
>
{t('table.warningPaidPlanRequired', { returnObjects: true })[1]}
</Text>
</Link>
{t('table.warningPaidPlanRequired', { returnObjects: true })[2]}
</AlertDiscalimerBox>
}
Expand Down Expand Up @@ -719,7 +725,11 @@ export default function DataInformationQuery({ resource }) {
marginLeft="4px"
as="a"
target="_blank"
href="https://basedosdados.github.io/mais/access_data_bq/#primeiros-passos"
href={
locale === "en" ? "https://basedosdados.github.io/mais/en/access_data_bq/#getting-started" :
locale === "es" ? "https://basedosdados.github.io/mais/es/access_data_bq/#pinitos" :
"https://basedosdados.github.io/mais/access_data_bq/#primeiros-passos"
}
color="#0068C5"
_hover={{color: "#0057A4"}}
>
Expand Down Expand Up @@ -829,7 +839,11 @@ export default function DataInformationQuery({ resource }) {
marginLeft="4px"
as="a"
target="_blank"
href="https://basedosdados.github.io/mais/api_reference_python/"
href={
locale === "en" ? "https://basedosdados.github.io/mais/en/api_reference_python/" :
locale === "es" ? "https://basedosdados.github.io/mais/es/api_reference_python/" :
"https://basedosdados.github.io/mais/api_reference_python/"
}
color="#0068C5"
_hover={{color: "#0057A4"}}
>
Expand Down Expand Up @@ -900,7 +914,11 @@ bd.read_sql(query = query, billing_project_id = billing_id)`}
marginLeft="4px"
as="a"
target="_blank"
href="https://basedosdados.github.io/mais/api_reference_r/"
href={
locale === "en" ? "https://basedosdados.github.io/mais/en/api_reference_r/" :
locale === "es" ? "https://basedosdados.github.io/mais/es/api_reference_r/" :
"https://basedosdados.github.io/mais/api_reference_r/"
}
color="#0068C5"
_hover={{color: "#0057A4"}}
>
Expand Down
50 changes: 30 additions & 20 deletions next/components/molecules/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function TextFooterSimple({children, ...props}) {

export default function Footer({ template, ocult = false }) {
const { t } = useTranslation('common');
const { locale } = useRouter();

if(template === "simple") return (
<VStack
Expand Down Expand Up @@ -114,23 +115,23 @@ export default function Footer({ template, ocult = false }) {
{t('footer.copyright', { year: new Date().getFullYear() })}
</TextFooterSimple>
<Link
href="/termos-e-privacidade?section=terms"
href="/terms?section=terms"
_hover={{ color: "#252A32" }}
>
<TextFooterSimple>
{t('footer.termsOfUse')}
</TextFooterSimple>
</Link>
<Link
href="/termos-e-privacidade?section=privacy"
href="/terms?section=privacy"
_hover={{ color: "#252A32" }}
>
<TextFooterSimple>
{t('footer.privacyPolicy')}
</TextFooterSimple>
</Link>
<Link
href="/contato"
href="/contact"
_hover={{ color: "#252A32" }}
>
<TextFooterSimple>
Expand Down Expand Up @@ -191,37 +192,46 @@ export default function Footer({ template, ocult = false }) {
<FooterLink target="_self" href="/dataset">
{t('footer.products.searchEngine')}
</FooterLink>
<FooterLink href="https://basedosdados.github.io/mais/">
<FooterLink href={
locale === "en" ? "https://basedosdados.github.io/mais/en" :
locale === "es" ? "https://basedosdados.github.io/mais/es" :
"https://basedosdados.github.io/mais"
}
>
{t('footer.products.publicDatalake')}
</FooterLink>
<FooterLink href="https://basedosdados.github.io/mais/access_data_packages/">
{t('footer.products.dataPackages')}
</FooterLink>
<FooterLink href="https://info.basedosdados.org/bd-pro">
{t('footer.products.bdPro')}
<FooterLink href={locale === 'en' ? "https://info.basedosdados.org/en/bd-pro" :
locale === 'es' ? "https://info.basedosdados.org/es/bd-pro" :
"https://info.basedosdados.org/bd-pro"}>
{t('footer.products.DBPro')}
</FooterLink>
<FooterLink href="https://info.basedosdados.org/bd-edu-sql">
{t('footer.products.bdEdu')}
{t('footer.products.DBEdu')}
</FooterLink>
</SectionCategories>

<SectionCategories title={t('footer.services.title')} marginBottom={isMobileMod() && "24px !important"}>
<FooterLink target="_self" href="/servicos#Captura de dados">
<FooterLink target="_self" href="/services#Captura de dados">
{t('footer.services.dataCapture')}
</FooterLink>
<FooterLink href="/servicos#Análise de dados">
<FooterLink href="/services#Análise de dados">
{t('footer.services.dataAnalytics')}
</FooterLink>
<FooterLink href="/servicos#Consultoria de dados">
<FooterLink href="/services#Consultoria de dados">
{t('footer.services.dataConsulting')}
</FooterLink>
<FooterLink href="/servicos#Estudos de caso">
<FooterLink href="/services#Estudos de caso">
{t('footer.services.caseStudies')}
</FooterLink>
</SectionCategories>

<SectionCategories title={t('footer.tutorials.title')} marginBottom={isMobileMod() && "24px !important"}>
<FooterLink href="https://basedosdados.github.io/mais/">
<FooterLink href={
locale === "en" ? "https://basedosdados.github.io/mais/en" :
locale === "es" ? "https://basedosdados.github.io/mais/es" :
"https://basedosdados.github.io/mais"
}
>
{t('footer.tutorials.documentation')}
</FooterLink>
<FooterLink href="https://www.youtube.com/watch?v=nGM2OwTUY_M&list=PLu5pyM8QY6hg3GpNCyCtSS3sUi4Jo8Pir">
Expand All @@ -230,10 +240,10 @@ export default function Footer({ template, ocult = false }) {
</SectionCategories>

<SectionCategories title={t('footer.institutional.title')} marginBottom={isMobileMod() && "24px !important"}>
<FooterLink target="_self" href="/quem-somos">
<FooterLink target="_self" href="/about-us">
{t('footer.institutional.aboutUs')}
</FooterLink>
<FooterLink target="_self" href="/transparencia">
<FooterLink target="_self" href="/transparency">
{t('footer.institutional.transparency')}
</FooterLink>
<FooterLink href="https://info.basedosdados.org/newsletter">
Expand All @@ -242,13 +252,13 @@ export default function Footer({ template, ocult = false }) {
<FooterLink href="https://info.basedosdados.org/carreiras">
{t('footer.institutional.careers')}
</FooterLink>
<FooterLink href="/perguntas-frequentes">
<FooterLink href="/faq">
{t('footer.institutional.faq')}
</FooterLink>
<FooterLink target="_self" href="/termos-e-privacidade">
<FooterLink target="_self" href="/terms">
{t('footer.institutional.termsAndPrivacy')}
</FooterLink>
<FooterLink target="_self" href="/contato">
<FooterLink target="_self" href="/contact">
{t('footer.institutional.contact')}
</FooterLink>
<Link fontWeight="700" color="white" href="/#support">
Expand Down
Loading

0 comments on commit 5c94133

Please sign in to comment.