@@ -3,7 +3,7 @@ import { AppShell } from '@/components/app-shell';
|
||||
import { AppSidebar } from '@/components/app-sidebar';
|
||||
import { AppSidebarHeader } from '@/components/app-sidebar-header';
|
||||
import { NavigationContextSummary } from '@/components/navigation-context';
|
||||
import { PortalMenu } from '@/layouts/portal-navigation';
|
||||
import { PortalMenu } from '@/components/portal-menu';
|
||||
import type { AppLayoutProps } from '@/types';
|
||||
|
||||
export default function AppSidebarLayout({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AuthLayoutTemplate from '@/layouts/auth/auth-simple-layout';
|
||||
import { useTempoUi } from '@/components/tempo-brand';
|
||||
|
||||
export default function AuthLayout({
|
||||
title = '',
|
||||
@@ -9,8 +10,9 @@ export default function AuthLayout({
|
||||
description?: string;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const { t } = useTempoUi();
|
||||
return (
|
||||
<AuthLayoutTemplate title={title} description={description}>
|
||||
<AuthLayoutTemplate title={t(title)} description={t(description)}>
|
||||
{children}
|
||||
</AuthLayoutTemplate>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import SearchFeedback from '@/components/search-feedback';
|
||||
import { searchTerritoryHref } from '@/lib/search-territory';
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import { PortalGroupedMenu } from '@/components/portal-grouped-menu';
|
||||
import { TempoUiProvider } from '@/components/tempo-brand';
|
||||
import { MenuPlacement, PortalMenu } from '@/components/portal-menu';
|
||||
import { TempoUiProvider, useTempoUi } from '@/components/tempo-brand';
|
||||
import { PageTranslator } from '@/translation/page-translator';
|
||||
import { TempoFooter } from '@/components/tempo-footer';
|
||||
import type { ReactNode } from 'react';
|
||||
import {
|
||||
@@ -11,8 +11,6 @@ import {
|
||||
NavigationContextSummary,
|
||||
} from '@/components/navigation-context';
|
||||
|
||||
const MenuPlacement = createContext(false);
|
||||
|
||||
export const portalLinks = [
|
||||
['/', 'Início'],
|
||||
['/oportunidades', 'Oportunidades de Investimento'],
|
||||
@@ -67,6 +65,11 @@ export default function PortalNavigation({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return <TempoUiProvider><PageTranslator /><PortalNavigationContent>{children}</PortalNavigationContent></TempoUiProvider>;
|
||||
}
|
||||
|
||||
function PortalNavigationContent({ children }: { children: ReactNode }) {
|
||||
const { t } = useTempoUi();
|
||||
const { url, props, component } = usePage();
|
||||
const printable = component === 'land-assistance/print';
|
||||
const portalShell =
|
||||
@@ -108,29 +111,23 @@ export default function PortalNavigation({
|
||||
? 'Definições da conta'
|
||||
: 'Detalhes');
|
||||
return (
|
||||
<TempoUiProvider>
|
||||
<NavigationContextProvider>
|
||||
<MenuPlacement.Provider value={true}>
|
||||
<div className="min-h-screen [&_button]:scroll-mb-24 [&_input]:scroll-mb-24 [&_select]:scroll-mb-24 [&_textarea]:scroll-mb-24">
|
||||
<nav
|
||||
aria-label="Atalho para o conteúdo"
|
||||
aria-label={t('Atalho para o conteúdo')}
|
||||
className={printable ? 'print:hidden' : undefined}
|
||||
>
|
||||
<a
|
||||
href="#portal-content"
|
||||
className="sr-only focus:not-sr-only focus:block focus:bg-white focus:p-4 focus:text-emerald-900"
|
||||
>
|
||||
Saltar para o conteúdo
|
||||
{t('Saltar para o conteúdo')}
|
||||
</a>
|
||||
</nav>
|
||||
{props.homologationReserved === true && (
|
||||
<aside
|
||||
aria-label="Ambiente de homologação"
|
||||
className="border-b border-amber-200 bg-amber-50 px-5 py-2 text-sm text-amber-950 print:hidden"
|
||||
>
|
||||
Homologação reservada à revisão da Tempo.
|
||||
Consulte o conteúdo público; entre na sua conta
|
||||
quando iniciar uma operação.
|
||||
<aside aria-label="Ambiente de homologação" className="border-b border-amber-200 bg-amber-50 px-5 py-2 text-sm text-amber-950 print:hidden">
|
||||
Homologação reservada à revisão da Tempo. Consulte o conteúdo público; entre na sua conta quando iniciar uma operação.
|
||||
</aside>
|
||||
)}
|
||||
{portalShell && (
|
||||
@@ -144,12 +141,12 @@ export default function PortalNavigation({
|
||||
)}
|
||||
{path !== '/' && (
|
||||
<nav
|
||||
aria-label="Caminho de navegação"
|
||||
aria-label={t('Caminho de navegação')}
|
||||
className={`bg-background text-foreground flex flex-wrap items-center gap-2 border-b px-5 py-3 text-sm ${printable ? 'print:hidden' : ''}`}
|
||||
>
|
||||
<>
|
||||
<Link href="/" className="underline">
|
||||
Início
|
||||
{t('Início')}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{parent && (
|
||||
@@ -161,12 +158,12 @@ export default function PortalNavigation({
|
||||
)}
|
||||
className="underline"
|
||||
>
|
||||
{names[parent]}
|
||||
{t(names[parent])}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
</>
|
||||
)}
|
||||
<span aria-current="page">{title}</span>
|
||||
<span aria-current="page">{t(title)}</span>
|
||||
</>
|
||||
</nav>
|
||||
)}
|
||||
@@ -184,14 +181,14 @@ export default function PortalNavigation({
|
||||
{children}
|
||||
</div>
|
||||
<aside
|
||||
aria-label="Contacto de apoio ao investidor"
|
||||
aria-label={t('Contacto de apoio ao investidor')}
|
||||
className={`mx-auto flex max-w-6xl justify-center px-5 pt-4 ${printable ? 'print:hidden' : ''}`}
|
||||
>
|
||||
<a
|
||||
href="/apoio"
|
||||
className="inline-flex min-h-11 max-w-full items-center justify-center rounded-lg bg-[#ed1c24] px-4 py-2 text-center text-sm font-semibold text-white shadow-sm transition-colors hover:bg-[#c9141b] focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#ed1c24]"
|
||||
>
|
||||
Contactar Apoio ao Investidor
|
||||
{t('Contactar Apoio ao Investidor')}
|
||||
</a>
|
||||
</aside>
|
||||
<div className={printable ? 'print:hidden' : undefined}>
|
||||
@@ -200,11 +197,6 @@ export default function PortalNavigation({
|
||||
</div>
|
||||
</MenuPlacement.Provider>
|
||||
</NavigationContextProvider>
|
||||
</TempoUiProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export function PortalMenu({ primary = false }: { primary?: boolean }) {
|
||||
const placed = useContext(MenuPlacement);
|
||||
return placed && !primary ? null : <PortalGroupedMenu />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user