Skip to content

Commit

Permalink
Merge pull request #778 from basedosdados/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
AldemirLucas authored Feb 27, 2024
2 parents 97b20b3 + 34eee34 commit baece25
Show file tree
Hide file tree
Showing 44 changed files with 396 additions and 366 deletions.
4 changes: 2 additions & 2 deletions next/components/atoms/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import "swiper/css/autoplay";
export default function Carousel({ settings, children }) {
return (
<Swiper modules={[Navigation, Pagination, Autoplay, Mousewheel]} {...settings}>
{children && children.map((elm)=> {
{children && children.map((elm, i)=> {
return (
<SwiperSlide>
<SwiperSlide key={i}>
{elm}
</SwiperSlide>
)
Expand Down
1 change: 0 additions & 1 deletion next/components/atoms/CategoryIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export function CategoryIcon({ url, active, size = "50px", ...style }) {
<Image
width={size}
height={size}
priority={true}
border="0px"
src={url}
{...style}
Expand Down
19 changes: 16 additions & 3 deletions next/components/molecules/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import { isMobileMod, useCheckMobile } from "../../hooks/useCheckMobile.hook"
import ControlledInput from "../atoms/ControlledInput";
import Link from "../atoms/Link";
import RoundedButton from "../atoms/RoundedButton";
import { getUserDataJson } from "../../utils";
import {
getUserDataJson,
triggerGAEvent
} from "../../utils";

import BDLogoProImage from "../../public/img/logos/bd_logo_pro";
import BDLogoEduImage from "../../public/img/logos/bd_logo_edu";
Expand Down Expand Up @@ -493,6 +496,8 @@ function SearchInput ({ status }) {
},[query])

function openSearchLink() {
triggerGAEvent("search", search)
triggerGAEvent("search_menu", search)
window.open(`/dataset?q=${search}`, "_self")
}

Expand Down Expand Up @@ -553,6 +558,8 @@ function SearchInputUser () {
const [showSearch, setShowSearch] = useState(false)

function openSearchLink() {
triggerGAEvent("search", search)
triggerGAEvent("search_menu", search)
window.open(`/dataset?q=${search}`, "_self")
}

Expand Down Expand Up @@ -650,13 +657,14 @@ function DesktopLinks({ links, position = false, path, userTemplate = false }) {
setStatusSearch(elm.status)
}

const LinkMenuDropDown = ({ url, text, icon }) => {
const LinkMenuDropDown = ({ key, url, text, icon }) => {
const [flag, setFlag] = useBoolean()

if(url === undefined && text === undefined) return <Divider marginBottom="10px" padding="10px 0 0" borderColor="#DEDFE0"/>

return (
<Link
key={key}
display="flex"
flexDirection="colunm"
_hover={{ opacity: "0.6" }}
Expand Down Expand Up @@ -948,7 +956,12 @@ export default function MenuNav({ simpleTemplate = false, userTemplate = false }
{simpleTemplate ?
<></>
:
<DesktopLinks links={links} position={isScrollDown} path={route} userTemplate={userTemplate}/>
<DesktopLinks
links={links}
position={isScrollDown}
path={route}
userTemplate={userTemplate}
/>
}

{userTemplate && isMobileMod() && <SearchInputUser />}
Expand Down
2 changes: 1 addition & 1 deletion next/components/molecules/NamedAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function NamedAvatar({ src, name, position, ...props }) {
</Text>
<Text
fontFamily="Ubuntu"
fontSiz="14px"
fontSize="14px"
fontWeight="300"
color="#252A32"
paddingTop="4px"
Expand Down
3 changes: 3 additions & 0 deletions next/components/molecules/ThemeCatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import React, { useState, useEffect } from "react";
import { useMediaQuery } from "@chakra-ui/react";
import { useCheckMobile } from "../../hooks/useCheckMobile.hook";
import { triggerGAEvent } from "../../utils";

import {
getAllThemes,
Expand Down Expand Up @@ -283,6 +284,8 @@ export default function ThemeCatalog () {
},[selectedTheme])

const handleSelectTheme = (elm) => {
triggerGAEvent("theme_home", elm)
triggerGAEvent("theme", elm)
window.open("#theme", "_self")
if(selectedTheme.includes(elm)) {
setSelectedTheme(selectedTheme.filter(res => res !== elm))
Expand Down
56 changes: 26 additions & 30 deletions next/components/organisms/DatabaseCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function DatabaseCard({
color={tables?.number === undefined || tables?.number === 0? "#C4C4C4" : "#2B8C4D"}
>
<a
href={tables?.number > 0 && `${link}?table=${tables?.id}`}
href={tables?.number > 0 ? `${link}?table=${tables?.id}` : ""}
target="_blank"
style={{display: "flex"}}
>
Expand Down Expand Up @@ -152,7 +152,7 @@ export default function DatabaseCard({
<ThemeTag
name={t.name}
display="block"
alignText="center"
aligntext="center"
whiteSpace="nowrap"
overflow="hidden"
minHeight="0"
Expand All @@ -177,39 +177,35 @@ export default function DatabaseCard({
justifyContent="space-between"
width="220px"
>
<a
href={rawDataSources.length > 0 && `${link}?raw_data_source=${rawDataSources.id}`}
<Link
target="_blank"
href={rawDataSources.number > 0 ? `${link}?raw_data_source=${rawDataSources.id}` : ""}
pointerEvents={rawDataSources.number > 0 ? "default" : "none"}
fontFamily="Ubuntu"
fontSize="12px"
fontWeight="400"
letterSpacing="0.3px"
color={databaseInfo[1] ? "#252A32" : "#C4C4C4"}
cursor={databaseInfo[1] && "pointer"}
_hover={databaseInfo[1] && {opacity : "0.7"}}
>
<Text
fontFamily="Ubuntu"
fontSize="12px"
fontWeight="400"
letterSpacing="0.3px"
color={databaseInfo[1] ? "#252A32" : "#C4C4C4"}
cursor={databaseInfo[1] && "pointer"}
_hover={databaseInfo[1] && {opacity : "0.7"}}
>
{databaseInfo[1] ? databaseInfo[1] : "0 fontes originais"}
</Text>
</a>
{databaseInfo[1] ? databaseInfo[1] : "0 fontes originais"}
</Link>
<Text color="#DEDFE0"></Text>
<a
href={informationRequests.length > 0 && `${link}?information_request=${informationRequests.id}`}
<Link
target="_blank"
href={informationRequests.number > 0 ? `${link}?information_request=${informationRequests.id}` : ""}
pointerEvents={informationRequests.number > 0 ? "default" : "none"}
fontFamily="Ubuntu"
fontSize="12px"
fontWeight="400"
letterSpacing="0.3px"
color={databaseInfo[2] ? "#252A32" : "#C4C4C4"}
cursor={databaseInfo[2] && "pointer"}
_hover={databaseInfo[2] && {opacity : "0.7"}}
>
<Text
fontFamily="Ubuntu"
fontSize="12px"
fontWeight="400"
letterSpacing="0.3px"
color={databaseInfo[2] ? "#252A32" : "#C4C4C4"}
cursor={databaseInfo[2] && "pointer"}
_hover={databaseInfo[2] && {opacity : "0.7"}}
>
{databaseInfo[2] ? databaseInfo[2] : "0 pedidos LAI"}
</Text>
</a>
{databaseInfo[2] ? databaseInfo[2] : "0 pedidos LAI"}
</Link>
</HStack>
</VStack>
</Card>
Expand Down
11 changes: 10 additions & 1 deletion next/pages/dataset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import ReactPaginate from "react-paginate";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { isMobileMod, useCheckMobile } from "../../hooks/useCheckMobile.hook";
import { getUserDataJson } from "../../utils";
import {
getUserDataJson,
triggerGAEvent
} from "../../utils";

import {
getSearchDatasets
Expand Down Expand Up @@ -94,6 +97,10 @@ export default function SearchPage({ pages }) {
async function getDatasets({q, filters, page}) {
setIsLoading(true)
const res = await getSearchDatasets({q:q, filter: filters, page:page})
if(q) {
triggerGAEvent("search", q)
triggerGAEvent("search_dataset", q)
}
setPageInfo({page: page, count: res?.count})
setIsLoading(false)
setShowEmptyState(true)
Expand Down Expand Up @@ -153,6 +160,8 @@ export default function SearchPage({ pages }) {

if (indice === -1) {
newArray.push(elm)
triggerGAEvent("theme_dataset", elm[1])
triggerGAEvent("theme", elm[1])
} else {
newArray.splice(indice, 1)
}
Expand Down
11 changes: 4 additions & 7 deletions next/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
} from "@chakra-ui/react";
import { useState } from "react";
import { useMediaQuery } from "@chakra-ui/react";
// import Typist from "react-typist";

import { withPages } from "../hooks/pages.hook";
import { isMobileMod } from "../hooks/useCheckMobile.hook";
import BodyText from "../components/atoms/BodyText";
Expand All @@ -28,6 +26,7 @@ import { ThemeTag } from "../components/atoms/ThemeTag";
import ThemeCatalog from "../components/molecules/ThemeCatalog";
import { BePartner } from "../components/organisms/BePartner";
import { MainPageTemplate } from "../components/templates/main";
import { triggerGAEvent } from "../utils";

import SearchIcon from "../public/img/icons/searchIcon";
import ArrowIcon from "../public/img/icons/arrowIcon";
Expand All @@ -47,6 +46,8 @@ function Hero() {
const [mediumQuery] = useMediaQuery("(max-width: 1366px)")

function openSearchLink() {
triggerGAEvent("search", search)
triggerGAEvent("search_home", search)
return window.open(`/dataset?q=${search}`, "_self");
}

Expand Down Expand Up @@ -344,10 +345,7 @@ function Products() {
minHeight={{ base: "200px", md: "none" }}
padding={{ base: "60px 20px", lg: "60px 30px" }}
fontSize={{ base: "12px", lg: "inherit" }}
id="termynal"
data-termynal
data-ty-typeDelay="40"
data-ty-lineDelay="700"

width="100%"
>
{/* <Typist
Expand Down Expand Up @@ -638,7 +636,6 @@ function Support({ pages }) {
>
💰 Gostaria de apoiar a BD institucionalmente?
<Link
dash={false}
fontFamily="ubuntu"
textDecoration="none"
fontWeight="500"
Expand Down
6 changes: 6 additions & 0 deletions next/pages/user/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@chakra-ui/react";
import { useState } from "react";
import { registerAccount } from "../api/user";
import { triggerGAEvent } from "../../utils";

import Input from "../../components/atoms/SimpleInput";
import Button from "../../components/atoms/RoundedButton";
Expand Down Expand Up @@ -49,6 +50,8 @@ export default function Register() {
}

const handleSubmit = (e) => {
triggerGAEvent("user", "register_try")

const regexPassword = {}
const validationErrors = {}
e.preventDefault()
Expand Down Expand Up @@ -92,6 +95,9 @@ export default function Register() {

if (Object.keys(validationErrors).length === 0) {
createRegister(formData)
triggerGAEvent("user", "register_success")
} else {
triggerGAEvent("user", "register_err")
}
}

Expand Down
2 changes: 1 addition & 1 deletion next/public/img/categories/icone_agropecuaria-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit baece25

Please sign in to comment.