diff --git a/web-marketplace/src/components/organisms/RegistryLayout/RegistryLayout.TerrasosFooter.tsx b/web-marketplace/src/components/organisms/RegistryLayout/RegistryLayout.TerrasosFooter.tsx index 2b944c4fb0..8b2f903ecf 100644 --- a/web-marketplace/src/components/organisms/RegistryLayout/RegistryLayout.TerrasosFooter.tsx +++ b/web-marketplace/src/components/organisms/RegistryLayout/RegistryLayout.TerrasosFooter.tsx @@ -1,5 +1,8 @@ import React from 'react'; import { useLingui } from '@lingui/react'; +import { useAtomValue } from 'jotai'; + +import { selectedLanguageAtom } from 'lib/atoms/languageSwitcher.atoms'; import TerrasosFooter from '../TerrasosFooter'; import { @@ -16,7 +19,11 @@ import { const RegistryLayoutTerrasosFooter: React.FC> = () => { const { _ } = useLingui(); - const TerrasosColumnItems = getTerrasosFooterColumns(_); + const selectedLanguage = useAtomValue(selectedLanguageAtom); + const TerrasosColumnItems = getTerrasosFooterColumns({ + _, + selectedLanguage, + }); return ( [ - { - title: 'TERRASOS', - links: [ - { - label: _(msg`About Us`), - href: 'https://www.terrasos.co/nosotros/', - }, - { - label: _(msg`Our Services`), - href: 'https://www.terrasos.co/servicios/', - }, - { - label: _(msg`Habitat banks`), - href: '/projects/1', - }, - { - label: _(msg`What is Tebu`), - href: 'https://www.terrasos.co/que-es-tebu/', - }, - { - label: _(msg`Geo-Viewer`), - href: 'https://www.terrasos.co/geovisor/', - }, +type Params = { + _: TranslatorType; + selectedLanguage: string; +}; - { - label: _(msg`Contact`), - href: 'https://www.terrasos.co/contacto/', - }, - ], - }, - { - title: 'USEFUL LINKS', - links: [ - { - label: _(msg`Act Now - Tebu`), - href: 'https://tebu.terrasos.co/', - }, - { - label: _(msg`Opportunities`), - href: 'https://www.terrasos.co/convocatorias/', - }, - { - label: _(msg`PQR Request`), - href: 'https://www.terrasos.co/pqrs/', - }, - { - label: _(msg`Terms and Conditions`), - href: 'https://www.terrasos.co/terminos-y-condiciones/', - }, - { - label: _(msg`Privacy Policy`), - href: 'https://www.terrasos.co/politica-de-privacidad/', - }, +export const getTerrasosFooterColumns = ({ + _, + selectedLanguage, +}: Params): TerrasosColumnItem[] => { + const domainUrl = 'https://www.terrasos.co'; + const baseUrl = selectedLanguage === 'en' ? `${domainUrl}/en` : domainUrl; + const tebuDomainUrl = 'https://tebu.terrasos.co'; + const tebuUrl = + selectedLanguage === 'en' ? `${tebuDomainUrl}/en` : tebuDomainUrl; - { - label: _(msg`Cookies Policy`), - href: 'https://www.terrasos.co/politica-de-cookies/', - }, - ], - }, - { - title: 'CONTACT US', - links: [ - { - label: 'Carrera 13 # 90 - 20,\n Bogotá, D.C. (Colombia)', - href: 'https://maps.app.goo.gl/ChQczporqpW6TS1m8', - }, - { - subLinks: [ - { - label: '+57 (601) 467-3587', - href: 'tel:+576014673587', - }, - { - label: '+57 310-457-7606', - href: 'https://wa.me/573104577606', - }, - ], - }, - ], - }, -]; + return [ + { + title: 'TERRASOS', + links: [ + { + label: _(msg`About Us`), + href: `${baseUrl}/nosotros/`, + }, + { + label: _(msg`Our Services`), + href: `${baseUrl}/servicios/`, + }, + { + label: _(msg`Habitat banks`), + href: '/projects/1', + }, + { + label: _(msg`What is Tebu`), + href: `${baseUrl}/que-es-tebu/`, + }, + { + label: _(msg`Geo-Viewer`), + href: `${baseUrl}/geovisor/`, + }, + + { + label: _(msg`Contact`), + href: `${baseUrl}/contacto/`, + }, + ], + }, + { + title: 'USEFUL LINKS', + links: [ + { + label: _(msg`Act Now - Tebu`), + href: tebuUrl, + }, + { + label: _(msg`Opportunities`), + href: `${baseUrl}/convocatorias/`, + }, + { + label: _(msg`PQR Request`), + href: `${baseUrl}/pqrs/`, + }, + { + label: _(msg`Terms and Conditions`), + href: `${baseUrl}/terminos-y-condiciones/`, + }, + { + label: _(msg`Privacy Policy`), + href: `${baseUrl}/politica-de-privacidad/`, + }, + + { + label: _(msg`Cookies Policy`), + href: `${baseUrl}/politica-de-cookies/`, + }, + ], + }, + { + title: 'CONTACT US', + links: [ + { + label: 'Carrera 13 # 90 - 20,\n Bogotá, D.C. (Colombia)', + href: 'https://maps.app.goo.gl/ChQczporqpW6TS1m8', + }, + { + subLinks: [ + { + label: '+57 (601) 467-3587', + href: 'tel:+576014673587', + }, + { + label: '+57 310-457-7606', + href: 'https://wa.me/573104577606', + }, + ], + }, + ], + }, + ]; +}; diff --git a/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.constants.ts b/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.constants.ts index 0f761b0b2f..b64de8437d 100644 --- a/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.constants.ts +++ b/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.constants.ts @@ -7,68 +7,79 @@ import { TerrasosHeaderItem } from './TerrasosHeader.types'; export const TERRASOS_LOGO_ALT = msg`Terrasos Logo`; export const TERRASOS_BASE_PATHNAME = '/project'; -export const getTerrasosHeaderItems = ( - _: TranslatorType, -): TerrasosHeaderItem[] => [ - { - label: _(msg`Home`), - href: 'https://www.terrasos.co/', - }, - { - label: _(msg`About Us`), - href: 'https://www.terrasos.co/nosotros/', - }, - { - label: _(msg`Services`), - href: 'https://www.terrasos.co/servicios/', - }, - { - label: _(msg`Habitat banks`), - href: '/projects/1', - items: [ - { - label: _(msg`Information`), - href: 'https://www.terrasos.co/informacion-de-bancos-de-habitat/', - }, - { - label: _(msg`Explore Banks`), - href: '/projects/1', - default: true, - }, - ], - }, - { - label: _(msg`What is Tebu`), - href: 'https://www.terrasos.co/que-es-tebu/', - }, - { - label: _(msg`Geo-Viewer`), - href: 'https://www.terrasos.co/geovisor/', - }, - { - label: _(msg`Information`), - href: '', - items: [ - { - label: _(msg`News`), - href: 'https://www.terrasos.co/noticias/', - }, - { - label: _(msg`Articles`), - href: 'https://www.terrasos.co/blog/', - }, - { - label: _(msg`Publications`), - href: 'https://www.terrasos.co/publicaciones/', - }, - { - label: _(msg`Frequently Asked Questions`), - href: 'https://www.terrasos.co/preguntas-frecuentes/', - }, - { - label: _(msg`Contact`), - href: 'https://www.terrasos.co/contacto/', - }, - ], - }, -]; +type Params = { + _: TranslatorType; + selectedLanguage: string; +}; + +export const getTerrasosHeaderItems = ({ + _, + selectedLanguage, +}: Params): TerrasosHeaderItem[] => { + const domainUrl = 'https://www.terrasos.co'; + const baseUrl = selectedLanguage === 'en' ? `${domainUrl}/en` : domainUrl; + + return [ + { + label: _(msg`Home`), + href: baseUrl, + }, + { + label: _(msg`About Us`), + href: `${baseUrl}/nosotros/`, + }, + { + label: _(msg`Services`), + href: `${baseUrl}/servicios/`, + }, + { + label: _(msg`Habitat banks`), + href: `/projects/1`, + items: [ + { + label: _(msg`Information`), + href: `${baseUrl}/informacion-de-bancos-de-habitat/`, + }, + { + label: _(msg`Explore Banks`), + href: '/projects/1', + default: true, + }, + ], + }, + { + label: _(msg`What is Tebu`), + href: `${baseUrl}/que-es-tebu/`, + }, + { + label: _(msg`Geo-Viewer`), + href: `${baseUrl}/geovisor/`, + }, + { + label: _(msg`Information`), + href: '', + items: [ + { + label: _(msg`News`), + href: `${baseUrl}/noticias/`, + }, + { + label: _(msg`Articles`), + href: `${baseUrl}/blog/`, + }, + { + label: _(msg`Publications`), + href: `${baseUrl}/publicaciones/`, + }, + { + label: _(msg`Frequently Asked Questions`), + href: `${baseUrl}/preguntas-frecuentes/`, + }, + { + label: _(msg`Contact`), + href: `${baseUrl}/contacto/`, + }, + ], + }, + ]; +}; diff --git a/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.tsx b/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.tsx index bd6b4a90fe..0434a263db 100644 --- a/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.tsx +++ b/web-marketplace/src/components/organisms/TerrasosHeader/TerrasosHeader.tsx @@ -1,10 +1,13 @@ import { useMemo, useState } from 'react'; import { msg } from '@lingui/macro'; import { useLingui } from '@lingui/react'; +import { useAtomValue } from 'jotai'; import BreadcrumbIcon from 'web-components/src/components/icons/BreadcrumbIcon'; import { cn } from 'web-components/src/utils/styles/cn'; +import { selectedLanguageAtom } from 'lib/atoms/languageSwitcher.atoms'; + import HamburgerIcon from 'components/atoms/HumberIconTerrasos'; import TerrasosLogo from 'components/atoms/TerrasosLogo'; @@ -21,7 +24,11 @@ export interface Props { export const TerrasosHeader = ({ className }: Props): JSX.Element => { const { _ } = useLingui(); - const items = useMemo(() => getTerrasosHeaderItems(_), [_]); + const selectedLanguage = useAtomValue(selectedLanguageAtom); + const items = useMemo( + () => getTerrasosHeaderItems({ _, selectedLanguage }), + [_], + ); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); return (