Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tradução do frontend v0 #946

Open
wants to merge 50 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5c5ac20
Merge pull request #906 from basedosdados/staging
AldemirLucas Aug 12, 2024
9043356
Merge pull request #907 from basedosdados/staging
AldemirLucas Aug 12, 2024
565d389
fix: fix download url
AldemirLucas Aug 13, 2024
f911362
fix: downalod link broken page
AldemirLucas Aug 13, 2024
d8bdf8d
Merge pull request #899 from basedosdados/development
AldemirLucas Aug 14, 2024
e92ec0b
Merge pull request #915 from basedosdados/development
AldemirLucas Aug 15, 2024
70759c5
Merge pull request #917 from basedosdados/development
AldemirLucas Aug 15, 2024
d365b01
Merge pull request #921 from basedosdados/development
AldemirLucas Aug 19, 2024
4c0f6fe
Merge pull request #922 from basedosdados/development
AldemirLucas Aug 20, 2024
31b0ca3
Merge pull request #923 from basedosdados/development
AldemirLucas Aug 20, 2024
a968024
Merge pull request #924 from basedosdados/development
AldemirLucas Aug 20, 2024
1deb828
chore: remove anul plans
AldemirLucas Aug 20, 2024
c101d70
chore: code R ajust space
AldemirLucas Aug 20, 2024
e430d04
Merge branch 'main' into staging
AldemirLucas Aug 20, 2024
2066171
Merge pull request #925 from basedosdados/staging
AldemirLucas Aug 20, 2024
1065c17
Merge pull request #932 from basedosdados/development
AldemirLucas Sep 9, 2024
5fe36fb
Merge pull request #937 from basedosdados/development
AldemirLucas Sep 9, 2024
a7420d5
Merge pull request #938 from basedosdados/staging
AldemirLucas Sep 9, 2024
9ebd092
fix: toggle for anual plans
AldemirLucas Sep 9, 2024
0628127
Merge pull request #939 from basedosdados/staging
AldemirLucas Sep 9, 2024
02c56ac
feat: working translation for index.js page
rdahis Sep 13, 2024
24e5fb3
feat: translate menu and footer
rdahis Sep 13, 2024
c9978ce
feat: about us, dataset, search
rdahis Sep 14, 2024
63d649c
feat: translate prices, services, transparency, login, sign up
rdahis Sep 16, 2024
635683d
feat: more translations, table fields translated, [dataset].js still …
rdahis Sep 16, 2024
f197bc5
feat: more elements
rdahis Sep 16, 2024
aef6171
feat: correct footers, new getShowDataset API, broken [dataset].js
rdahis Sep 17, 2024
ff9381e
feat: almost whole website with i18n. [dataset].js page still consumi…
rdahis Sep 18, 2024
91cc223
Merge branch 'development' into feat/i18n
rdahis Sep 18, 2024
f426671
feat: search API calls with locale parameter
rdahis Sep 20, 2024
e511dd9
Merge branch 'development' into feat/i18n
rdahis Sep 20, 2024
e0dce96
feat: translate rawDataSource, informationRequest
rdahis Sep 21, 2024
a1e7a83
feat: ajust visual
AldemirLucas Sep 20, 2024
12d8644
Merge branch 'development' into feat/i18n
rdahis Sep 22, 2024
d5ca27e
feat: user pages. [username].js still broken
rdahis Sep 22, 2024
36b0c02
feat: working user pages, adjustments
rdahis Sep 24, 2024
e13930a
Merge branch 'development' into feat/i18n
rdahis Sep 24, 2024
61a53e7
feat: fully translated ThemeCatalog and its APIs
rdahis Sep 25, 2024
5470ed4
feat: href inheriting locales in all links
rdahis Sep 25, 2024
01a0619
feat: translate contato-consultoria. fix: locale inheritance for sear…
rdahis Sep 26, 2024
8897295
feat: routing locale for tags, tables, menu sign in and sign up
rdahis Sep 26, 2024
aecc4b0
feat: locale routing for clearFilters
rdahis Sep 26, 2024
f4f6984
feat: locale routing for simple footer
rdahis Sep 26, 2024
a495fbb
feat: translate terms, fix routing to price buttons
rdahis Sep 26, 2024
c6111cf
Merge branch 'development' into feat/i18n
rdahis Sep 26, 2024
2a317c2
Merge branch 'development' into feat/i18n
rdahis Sep 30, 2024
61d7c86
Merge branch 'development' into feat/i18n
AldemirLucas Oct 9, 2024
49187f8
feat: ajust api get's and themes carroussel
AldemirLucas Oct 10, 2024
98554ae
feat: wip code review and ajusts
AldemirLucas Oct 14, 2024
a1a87dc
feat: wip translation review
AldemirLucas Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions next/components/atoms/FilterAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import {
Skeleton
} from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { useTranslation } from 'next-i18next';
import Checkbox from "../atoms/Checkbox";
import { ControlledInput, ControlledInputSimple} from "./ControlledInput";
import SectionText from "./SectionText";
import SearchIcon from "../../public/img/icons/searchIcon"
import SearchIcon from "../../public/img/icons/searchIcon";

export function BaseFilterAccordion({
fieldName,
Expand All @@ -26,6 +27,8 @@ export function BaseFilterAccordion({
alwaysOpen = false,
isHovering = true
}) {
const { t } = useTranslation('common');

return (
<Accordion allowToggle width="100%">
<AccordionItem border="0px">
Expand Down Expand Up @@ -85,6 +88,7 @@ export function CheckboxFilterAccordion({
canSearch = false,
isLoading
}) {
const { t } = useTranslation('common');
const [options , setOptions] = useState([])
const [search, setSearch] = useState("");
const [inputFocus, setInputFocus] = useState(false)
Expand Down Expand Up @@ -130,7 +134,7 @@ export function CheckboxFilterAccordion({
onChange={setSearch}
inputFocus={inputFocus}
changeInputFocus={setInputFocus}
placeholder="Pesquisar"
placeholder={t('search')}
fill="#464A51"
icon={
<SearchIcon
Expand Down Expand Up @@ -211,6 +215,7 @@ export function RangeFilterAccordion({
maxValue = null,
minValue = null,
}) {
const { t } = useTranslation('common');
const [min, setMin] = useState();
const [max, setMax] = useState();
const [error, setError] = useState(false);
Expand Down Expand Up @@ -245,7 +250,7 @@ export function RangeFilterAccordion({
value={min}
onChange={setMin}
width="100%"
placeholder="Min"
placeholder={t('min')}
inputStyle={{
height: "40px",
fontSize: "14px",
Expand All @@ -258,7 +263,7 @@ export function RangeFilterAccordion({
value={max}
onChange={setMax}
width="100%"
placeholder="Max"
placeholder={t('max')}
inputStyle={{
height: "40px",
fontSize: "14px",
Expand Down
66 changes: 46 additions & 20 deletions next/components/atoms/HelpWidget.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import {
Menu,
MenuButton,
Expand All @@ -11,26 +12,51 @@ import HelpIcon from "../../public/img/icons/helpIcon"
export default function HelpWidget({options, tooltip}) {
const optionsRender = (options) => {
return options.map((option, i) => {
if(option.name){ return (
<MenuItem
key={i}
letterSpacing="0.1px"
lineHeight="18px"
fontWeight="400"
fontSize="12px"
fontFamily="Roboto"
color="#252A32"
backgroundColor="#FFF"
padding="0 16px 10px"
_focus={{backgroundColor: "transparent"}}
_hover={{backgroundColor: "transparent", opacity: "0.7"}}
onClick={() => window.open(option.url, "_blank")}
>
{option.name}
</MenuItem>)
} else { return <MenuDivider key={i} margin="0 0 14px"/> }
})
}
if(option.name){
const menuItemProps = {
key: i,
letterSpacing: "0.1px",
lineHeight: "18px",
fontWeight: "400",
fontSize: "12px",
fontFamily: "Roboto",
color: "#252A32",
backgroundColor: "#FFF",
padding: "0 16px 10px",
_focus: {backgroundColor: "transparent"},
_hover: {backgroundColor: "transparent", opacity: "0.7"},
};

if (option.url) {
return (
<MenuItem
{...menuItemProps}
onClick={() => window.open(option.url, "_blank")}
>
{option.name}
</MenuItem>
);
} else if (option.component) {
return (
<MenuItem {...menuItemProps} as="div">
{React.cloneElement(option.component, {
style: {
letterSpacing: "0.1px",
lineHeight: "18px",
fontWeight: "400",
fontSize: "12px",
fontFamily: "Roboto",
color: "#252A32",
}
})}
</MenuItem>
);
}
} else {
return <MenuDivider key={i} margin="0 0 14px"/>;
}
});
};

return (
<Menu>
Expand Down
37 changes: 23 additions & 14 deletions next/components/atoms/Link.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Link as ChakraLink } from "@chakra-ui/react";
import { Text } from "@chakra-ui/react";
import NextLink from 'next/link';
import { useRouter } from 'next/router';

export default function Link({
children,
Expand All @@ -8,19 +10,26 @@ export default function Link({
fontWeight = "700",
...props
}) {
const { locale } = useRouter();

return (
<ChakraLink
target={target}
href={href}
fontFamily="Lato"
fontSize="14px"
letterSpacing="0.5px"
color={color}
_hover={{ textDecoration: "none", opacity:"0.6" }}
fontWeight={fontWeight}
{...props}
>
{children}
</ChakraLink>
<NextLink href={href || '#'} locale={locale} passHref legacyBehavior>
<Text
as="a"
display="flex"
flexDirection="row"
alignItems="center"
fontFamily="Roboto"
fontSize="14px"
lineHeight="20px"
fontWeight={fontWeight}
color={color}
target={target}
{...props}
>
{children}
</Text>
</NextLink>
);
}

14 changes: 11 additions & 3 deletions next/components/atoms/ObservationLevelTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ import {
Th,
Td,
} from "@chakra-ui/react";
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { capitalize } from "lodash";

export default function ObservationLevel({ resource }) {
const headers = ["Entidade","Colunas Correspondentes"]
const { t } = useTranslation('dataset');
const router = useRouter();
const { locale } = router;

const headers = [t('observationLevelTable.entityHeader'), t('observationLevelTable.columnsHeader')];

let array = []
const keys = Object.keys(resource?.observationLevels)
Expand All @@ -18,8 +25,9 @@ export default function ObservationLevel({ resource }) {
const value = resource?.observationLevels[elm]

const valueEntity = () => {
if(value.entity[`name${capitalize(locale)}`]) return value.entity[`name${capitalize(locale)}`]
if(value.entity.name) return value.entity.name
return "Não informado"
return t('observationLevelTable.notProvided')
}

const valueColumns = () => {
Expand All @@ -30,7 +38,7 @@ export default function ObservationLevel({ resource }) {
columns.push(column?.name)
})
} else {
columns = ["Não informado"]
columns = [t('observationLevelTable.notProvided')]
}
return columns.join(", ")
}
Expand Down
38 changes: 21 additions & 17 deletions next/components/atoms/SectionLink.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
import { Link as ChakraLink } from "@chakra-ui/react";
import NextLink from 'next/link';
import { useEffect, useState } from "react";
import { useCheckMobile } from "../../hooks/useCheckMobile.hook";
import { useRouter } from 'next/router';

export default function Link({
export default function SectionLink({
children,
href,
target,
...props
}) {
const [isMobileMod, setIsMobileMod] = useState(false)
const isMobile = useCheckMobile();
const { locale } = useRouter();

useEffect(() => {
setIsMobileMod(isMobile)
}, [isMobile])

return (
<ChakraLink
width="fit-content"
target={target}
href={href}
fontFamily="Ubuntu"
fontSize={isMobileMod ? "12px" : "15px"}
letterSpacing={isMobileMod ? "0.2px" : "0.1px"}
fontWeight="700"
color="#42B0FF"
_hover={{ textDecoration: "none", opacity:"0.6" }}
paddingBottom="4px"
borderBottom="1px solid #42B0FF"
{...props}
>
{children}
</ChakraLink>
<NextLink href={href} locale={locale} passHref legacyBehavior>
<ChakraLink
width="fit-content"
target={target}
fontFamily="Ubuntu"
fontSize={isMobileMod ? "12px" : "15px"}
letterSpacing={isMobileMod ? "0.2px" : "0.1px"}
fontWeight="700"
color="#42B0FF"
_hover={{ textDecoration: "none", opacity:"0.6" }}
paddingBottom="4px"
borderBottom="1px solid #42B0FF"
{...props}
>
{children}
</ChakraLink>
</NextLink>
);
}
30 changes: 17 additions & 13 deletions next/components/atoms/ThemeTag.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { Tag } from "@chakra-ui/react";
import Link from '../atoms/Link';
import { Tag } from '@chakra-ui/react';

export function ThemeTag({ name, ...style }) {
export function ThemeTag({ slug, locale, ...props }) {
return (
<Tag
position="relative"
fontSize="10px"
whiteSpace="nowrap"
borderRadius="8px"
padding="2px 8px"
color="#252A32"
backgroundColor="#DEDFE0"
cursor="pointer"
letterSpacing="0.2px"
fontWeight="300"
fontFamily="ubuntu"
{...style}
>
<a href={`/dataset?tag=${name.toLowerCase()}`} target="_blank">
{name}
</a>
<Link
href={`/dataset?tag=${slug}`}
locale={locale}
fontWeight="300"
fontFamily="ubuntu"
fontSize="10px"
color="#252A32"
letterSpacing="0.2px"
position="relative"
whiteSpace="nowrap"
{...props}
>
{slug}
</Link>
</Tag>
);
}
Loading