Skip to content

Commit

Permalink
Merge pull request #995 from basedosdados/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
rdahis authored Oct 29, 2024
2 parents f6d920a + 67b7887 commit af276fe
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 104 deletions.
24 changes: 13 additions & 11 deletions next/components/molecules/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ function useIsMobileMod() {
return useCheckMobile();
}

function MenuDrawer({ userData, isOpen, onClose, links, locale }) {
function MenuDrawer({ userData, isOpen, onClose, links }) {
const { t } = useTranslation('menu');
const { locale } = useRouter();
const router = useRouter();
const isMobile = useIsMobileMod();

return (
Expand All @@ -65,14 +67,14 @@ function MenuDrawer({ userData, isOpen, onClose, links, locale }) {
widthImage="65px"
heightImage="30px"
marginBottom="24px"
onClick={() => window.open("/", "_self")}
onClick={() => router.push('/')}
/>
) : (
<BDLogoImage
widthImage="65px"
heightImage="30px"
marginBottom="24px"
onClick={() => window.open("/", "_self")}
onClick={() => router.push('/')}
/>
)}
<VStack alignItems="flex-start" width="100%" spacing="16px">
Expand All @@ -87,7 +89,7 @@ function MenuDrawer({ userData, isOpen, onClose, links, locale }) {
fontFamily="Roboto"
fontSize="20px"
borderRadius="30px"
onClick={() => window.open(b.href, "_blank")}
onClick={() => router.push(b.href)}
>
{b.name}
</RoundedButton>
Expand Down Expand Up @@ -235,14 +237,14 @@ function MenuDrawerUser({ userData, isOpen, onClose, isUserPro}) {
widthImage="65px"
heightImage="30px"
marginBottom="24px"
onClick={() => window.open("/", "_self")}
onClick={() => router.push('/')}
/>
) : (
<BDLogoImage
widthImage="65px"
heightImage="30px"
marginBottom="24px"
onClick={() => window.open("/", "_self")}
onClick={() => router.push('/')}
/>
)}

Expand Down Expand Up @@ -362,7 +364,7 @@ function MenuDrawerUser({ userData, isOpen, onClose, isUserPro}) {
onClick={() => {
cookies.remove('userBD', { path: '/' })
cookies.remove('token', { path: '/' })
window.open("/", "_self")
router.push('/')
}}
>
<SignOutIcon width="20px" height="20px"/>
Expand All @@ -386,6 +388,7 @@ function MenuUser ({ userData, onOpen, onClose, isUserPro }) {
const [isOpenMenu, setIsOpenMenu] = useState(false)
const { t } = useTranslation('menu');
const isMobile = useIsMobileMod();
const router = useRouter();

const btnMouseEnterEvent = () => {
setIsOpenMenu(true)
Expand Down Expand Up @@ -527,7 +530,7 @@ function MenuUser ({ userData, onOpen, onClose, isUserPro }) {
gap="8px"
padding="16px"
_hover={{ backgroundColor: "transparent", opacity: "0.7" }}
onClick={() => window.open(`/user/${userData.username}`, "_self")}
onClick={() => router.push(`/user/${userData.username}`)}
>
<SettingsIcon fill="#D0D0D0" width="20px" height="20px"/>
<Text
Expand All @@ -551,8 +554,8 @@ function MenuUser ({ userData, onOpen, onClose, isUserPro }) {
onClick={() => {
cookies.remove('userBD', { path: '/' })
cookies.remove('token', { path: '/' })
window.open("/", "_self")}
}
router.push('/')
}}
>
<SignOutIcon width="20px" height="20px" fill="#D0D0D0"/>
<Text
Expand Down Expand Up @@ -1065,7 +1068,6 @@ export default function MenuNav({ simpleTemplate = false, userTemplate = false }
<MenuDrawer
userData={userData}
links={links}
locale={locale}
{...menuDisclosure}
/>

Expand Down
4 changes: 3 additions & 1 deletion next/components/molecules/ThemeCatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import React, { useState, useEffect } from "react";
import axios from 'axios';
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { capitalize } from "lodash";
import { useMediaQuery } from "@chakra-ui/react";
import { useCheckMobile } from "../../hooks/useCheckMobile.hook";
Expand Down Expand Up @@ -278,6 +279,7 @@ function CardThemes ({ responsive, datasetsCards = [], loading, locale }) {
}

export default function ThemeCatalog ({ data, locale }) {
const router = useRouter()
const [listThemes, setListThemes] = useState([])
const [defaultDatasetsCards, setDefaultDatasetCards] = useState([])
const [fetchThemesTimeout, setFetchThemesTimeout] = useState(null)
Expand Down Expand Up @@ -328,7 +330,7 @@ export default function ThemeCatalog ({ data, locale }) {
const handleSelectTheme = (elm) => {
triggerGAEvent("theme_home", elm)
triggerGAEvent("theme", elm)
window.open("#theme", "_self")
router.push("#theme", undefined, { locale: router.locale })
if(selectedTheme.includes(elm)) {
setSelectedTheme(selectedTheme.filter(res => res !== elm))
} else {
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) window.open("/dataset", "_self")
if(result === true) router.push("/dataset", undefined, { locale: router.locale })
}

if(isLoading) return <LoadingSpin/>
Expand Down
2 changes: 1 addition & 1 deletion next/components/organisms/TablePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function TablePage({ id }) {
_hover: {
fill: "#0057A4"
},
onClick: () => {window.open(href)}
onClick: () => {router.push(href)}
}
}

Expand Down
4 changes: 3 additions & 1 deletion next/components/organisms/componentsUserPage/Account.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { useState } from "react";
import cookies from 'js-cookie';
import { useTranslation } from "react-i18next";
import { useRouter } from "next/router";
import Link from "../../atoms/Link";

import {
Expand All @@ -23,6 +24,7 @@ import {

export default function Account({ userInfo }) {
const { t } = useTranslation('user');
const router = useRouter();
const usernameModal = useDisclosure()
const eraseModalAccount = useDisclosure()
const sucessEraseModalAccount = useDisclosure()
Expand Down Expand Up @@ -295,7 +297,7 @@ export default function Account({ userInfo }) {
color: "#22703E",
borderColor: "#22703E"
}}
onClick={() => window.open("/contact")}
onClick={() => router.push('/contact')}
>{t('username.contactUs')}</Button>
</Box>

Expand Down
10 changes: 5 additions & 5 deletions next/components/organisms/componentsUserPage/PlansAndPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default function PlansAndPayment ({ userData }) {
{name: t('username.cloudAccess')},
{name: t('username.sqlPythonRAccess')},
{name: t('username.biIntegration')},
planActive ? "" : {name: t('username.directDownloadLimit'), tooltip: t('username.downloadLimitTooltip')},
planActive ? "" : {name: t('username.downloadLimit100MB'), tooltip: t('username.downloadLimit100MBTooltip')},
]
},
"bd_pro" : {
Expand All @@ -180,7 +180,7 @@ export default function PlansAndPayment ({ userData }) {
resources : [
{name: t('username.dozensOfHighFrequencyDatasets')},
{name: t('username.companyReferenceTable')},
{name: t('username.directDownloadLimitPro'), tooltip: t('username.downloadLimitProTooltip')},
{name: t('username.downloadLimit1GB'), tooltip: t('username.downloadLimit1GBTooltip')},
]
},
"bd_pro_empresas" : {
Expand Down Expand Up @@ -929,7 +929,7 @@ export default function PlansAndPayment ({ userData }) {
onClick={() => handlerEmailGcp()}
isLoading={isLoadingEmailChange}
>
{t('username.nextStep')}
{t('username.next')}
</Button>
</Stack>
</ModalGeneral>
Expand Down Expand Up @@ -1210,7 +1210,7 @@ export default function PlansAndPayment ({ userData }) {
{name: t('username.cloudAccess')},
{name: t('username.sqlPythonRAccess')},
{name: t('username.biIntegration')},
{name: t('username.directDownloadLimit'), tooltip: t('username.directDownloadLimitTooltip')},
{name: t('username.downloadLimit100MB'), tooltip: t('username.downloadLimit100MBTooltip')},
]}
button={{
text: t('username.exploreFeatures'),
Expand All @@ -1228,7 +1228,7 @@ export default function PlansAndPayment ({ userData }) {
resources={[
{name: t('username.dozensOfHighFrequencyDatasets')},
{name: t('username.companyReferenceTable')},
{name: t('username.directDownloadLimitPro'), tooltip: t('username.downloadLimitProTooltip')}
{name: t('username.downloadLimit1GB'), tooltip: t('username.downloadLimit1GBTooltip')}
]}
button={{
text: `${subscriptionInfo?.stripeSubscription === "bd_pro" ? t('username.currentPlan') : hasSubscribed ? t('username.subscribe') : t('username.startFreeTrial')}`,
Expand Down
4 changes: 3 additions & 1 deletion next/pages/case-studies/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import Image from 'next/image';
import { useState, useEffect } from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';

Expand Down Expand Up @@ -54,6 +55,7 @@ export default function CaseStudies ({
body
}) {
const { t } = useTranslation('caseStudies');
const router = useRouter();
const [isMobileMod, setIsMobileMod] = useState(false)
const isMobile = useCheckMobile();

Expand Down Expand Up @@ -207,7 +209,7 @@ export default function CaseStudies ({
{t('contactText')}
</BodyText>
<RoundedButton
onClick={() => window.open("/contact", "_blank")}
onClick={() => router.push('/contact')}
>
{t('contactButton')}
</RoundedButton>
Expand Down
9 changes: 7 additions & 2 deletions next/pages/contact-consulting.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useEffect } from "react";
import { MainPageTemplate } from "../components/templates/main";
import { withPages } from "../hooks/pages.hook";
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';

export async function getStaticProps({ locale }) {
Expand All @@ -22,6 +23,7 @@ export async function getStaticProps({ locale }) {

export default function ContactConsulting() {
const { t } = useTranslation('contact');
const { locale } = useRouter();

useEffect(() => {
const script = document.createElement('script');
Expand All @@ -33,12 +35,15 @@ export default function ContactConsulting() {
window.hbspt.forms.create({
region: "na1",
portalId: "9331013",
formId: "1b1d4a12-5cbc-4ffc-837a-12b905c2d87b",
formId:
locale === "en" ? "a81d259d-7c97-494d-866d-639416f70df2" :
locale === "es" ? "3e1063fa-f29e-4044-9f71-37e6e0cdf678" :
"1b1d4a12-5cbc-4ffc-837a-12b905c2d87b",
target: '#form-hbspt'
})
}
})
},[])
}, [locale])

return (
<MainPageTemplate paddingX="24px">
Expand Down
51 changes: 26 additions & 25 deletions next/pages/prices.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,32 +230,33 @@ export const CardPrice = ({
{t('currentPlan')}
</Box>
) : (
<Box
as="button"
onClick={() => {
if(button.onClick) return button.onClick()
return window.open(button.href, "_self")
}}
display="flex"
alignItems="center"
justifyContent="center"
<Link
href={button.onClick ? '#' : button.href}
width="100%"
borderRadius="8px"
backgroundColor="#0D99FC"
padding="12px 16px"
cursor="pointer"
color="#FFF"
fontFamily="Roboto"
fontWeight="500"
fontSize="20px"
lineHeight="36px"
textDecoration="none"
_hover={{
backgroundColor: "#0B89E2"
}}
style={{ textDecoration: 'none' }}
>
{t(button.text)}
</Box>
<Box
display="flex"
alignItems="center"
justifyContent="center"
width="100%"
borderRadius="8px"
backgroundColor="#0D99FC"
padding="12px 16px"
cursor="pointer"
color="#FFF"
fontFamily="Roboto"
fontWeight="500"
fontSize="20px"
lineHeight="36px"
onClick={button.onClick}
_hover={{
backgroundColor: "#0B89E2"
}}
>
{t(button.text)}
</Box>
</Link>
)}

<Text
Expand Down Expand Up @@ -524,4 +525,4 @@ export default function Price() {
</Stack>
</MainPageTemplate>
)
}
}
6 changes: 4 additions & 2 deletions next/pages/user/activate-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { MainPageTemplate } from "../../components/templates/main";
import { EmailConfirmImage, EmailRecoveryImage } from "../../public/img/emailImage";
import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';

export async function getServerSideProps(context) {
const { query, locale } = context;
Expand All @@ -27,6 +28,7 @@ export async function getServerSideProps(context) {
}

export default function ActiveAccount({ data }) {
const router = useRouter();
const { t } = useTranslation('user');

return (
Expand Down Expand Up @@ -63,7 +65,7 @@ export default function ActiveAccount({ data }) {

<RoundedButton
borderRadius="30px"
onClick={() => window.open("/user/login", "_self")}
onClick={() => router.push('/user/login')}
>
{t('activate.loginToAccount')}
</RoundedButton>
Expand All @@ -81,7 +83,7 @@ export default function ActiveAccount({ data }) {
<SectionText textAlign="center">{t('activate.activationProblem')}</SectionText>
<RoundedButton
borderRadius="30px"
onClick={() => window.open("/contact", "_self")}
onClick={() => router.push('/contact')}
>
{t('activate.contactUs')}
</RoundedButton>
Expand Down
6 changes: 4 additions & 2 deletions next/pages/user/check-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useState, useEffect } from "react";
import axios from "axios";
import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';

import Display from "../../components/atoms/Display";
import { isMobileMod } from "../../hooks/useCheckMobile.hook"
Expand All @@ -22,16 +23,17 @@ export async function getStaticProps({ locale }) {
}

export default function CheckEmail() {
const router = useRouter();
const { t } = useTranslation('user');
const [email, setEmail] = useState("")
const [count, setCount] = useState(0)
const [forwardingDisabled, setForwardingDisabled] = useState(false)

useEffect(() => {
const res = sessionStorage.getItem("registration_email_bd") || ""
if(res === "") return window.open("/", "_self")
if(res === "") return router.push('/')
setEmail(res)
}, [])
}, [router])

useEffect(() => {
if(count > 0) {
Expand Down
Loading

0 comments on commit af276fe

Please sign in to comment.