fix: unify horizontal portal menus and remove discovery duplicates
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import AppLayoutTemplate from '@/layouts/app/app-sidebar-layout';
|
||||
import AppLayoutTemplate from '@/layouts/app/app-header-layout';
|
||||
import type { BreadcrumbItem } from '@/types';
|
||||
|
||||
export default function AppLayout({
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import { AppContent } from '@/components/app-content';
|
||||
import { AppHeader } from '@/components/app-header';
|
||||
import { AppShell } from '@/components/app-shell';
|
||||
import { Breadcrumbs } from '@/components/breadcrumbs';
|
||||
import type { AppLayoutProps } from '@/types';
|
||||
|
||||
/** Global navigation is owned by PortalNavigation for every page. */
|
||||
export default function AppHeaderLayout({
|
||||
children,
|
||||
breadcrumbs,
|
||||
breadcrumbs = [],
|
||||
}: AppLayoutProps) {
|
||||
return (
|
||||
<AppShell variant="header">
|
||||
<AppHeader breadcrumbs={breadcrumbs} />
|
||||
<AppContent variant="header">{children}</AppContent>
|
||||
</AppShell>
|
||||
<div className="flex min-w-0 flex-col">
|
||||
{breadcrumbs.length > 0 && (
|
||||
<div className="border-b px-5 py-3">
|
||||
<Breadcrumbs breadcrumbs={breadcrumbs} />
|
||||
</div>
|
||||
)}
|
||||
<main className="flex min-w-0 flex-1 flex-col">{children}</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -65,27 +65,18 @@ export default function PortalNavigation({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return <TempoUiProvider><PageTranslator /><PortalNavigationContent>{children}</PortalNavigationContent></TempoUiProvider>;
|
||||
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 =
|
||||
['welcome', 'PortalInvestidor', 'management-access'].includes(
|
||||
component,
|
||||
) ||
|
||||
[
|
||||
'qa/',
|
||||
'portal/',
|
||||
'investment/',
|
||||
'portfolio/',
|
||||
'desk/',
|
||||
'investor-path/',
|
||||
'auth/',
|
||||
'land-assistance/',
|
||||
].some((prefix) => component.startsWith(prefix));
|
||||
const path = url.split('?')[0];
|
||||
const parent = Object.keys(names)
|
||||
.filter((p) => p !== '/' && path.startsWith(`${p}/`))
|
||||
@@ -111,92 +102,92 @@ function PortalNavigationContent({ children }: { children: ReactNode }) {
|
||||
? 'Definições da conta'
|
||||
: 'Detalhes');
|
||||
return (
|
||||
<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={t('Atalho para o conteúdo')}
|
||||
className={printable ? 'print:hidden' : undefined}
|
||||
<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={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"
|
||||
>
|
||||
<a
|
||||
href="#portal-content"
|
||||
className="sr-only focus:not-sr-only focus:block focus:bg-white focus:p-4 focus:text-emerald-900"
|
||||
>
|
||||
{t('Saltar para o conteúdo')}
|
||||
</a>
|
||||
{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>
|
||||
)}
|
||||
{
|
||||
<div className={printable ? 'print:hidden' : undefined}>
|
||||
<PortalMenu primary />
|
||||
</div>
|
||||
}
|
||||
{path !== '/' && (
|
||||
<nav
|
||||
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">
|
||||
{t('Início')}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{parent && (
|
||||
<>
|
||||
<Link
|
||||
href={searchTerritoryHref(
|
||||
parent,
|
||||
url,
|
||||
)}
|
||||
className="underline"
|
||||
>
|
||||
{t(names[parent])}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
</>
|
||||
)}
|
||||
<span aria-current="page">{t(title)}</span>
|
||||
</>
|
||||
</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>
|
||||
)}
|
||||
{portalShell && (
|
||||
)}
|
||||
<div id="portal-content" tabIndex={-1}>
|
||||
{
|
||||
<div
|
||||
className={
|
||||
printable ? 'print:hidden' : undefined
|
||||
}
|
||||
>
|
||||
<PortalMenu primary />
|
||||
<NavigationContextSummary />
|
||||
</div>
|
||||
)}
|
||||
{path !== '/' && (
|
||||
<nav
|
||||
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">
|
||||
{t('Início')}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{parent && (
|
||||
<>
|
||||
<Link
|
||||
href={searchTerritoryHref(
|
||||
parent,
|
||||
url,
|
||||
)}
|
||||
className="underline"
|
||||
>
|
||||
{t(names[parent])}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
</>
|
||||
)}
|
||||
<span aria-current="page">{t(title)}</span>
|
||||
</>
|
||||
</nav>
|
||||
)}
|
||||
<div id="portal-content" tabIndex={-1}>
|
||||
{portalShell && (
|
||||
<div
|
||||
className={
|
||||
printable ? 'print:hidden' : undefined
|
||||
}
|
||||
>
|
||||
<NavigationContextSummary />
|
||||
</div>
|
||||
)}
|
||||
<SearchFeedback />
|
||||
{children}
|
||||
</div>
|
||||
<aside
|
||||
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]"
|
||||
>
|
||||
{t('Contactar Apoio ao Investidor')}
|
||||
</a>
|
||||
</aside>
|
||||
<div className={printable ? 'print:hidden' : undefined}>
|
||||
<TempoFooter />
|
||||
</div>
|
||||
}
|
||||
<SearchFeedback />
|
||||
{children}
|
||||
</div>
|
||||
</MenuPlacement.Provider>
|
||||
</NavigationContextProvider>
|
||||
<aside
|
||||
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]"
|
||||
>
|
||||
{t('Contactar Apoio ao Investidor')}
|
||||
</a>
|
||||
</aside>
|
||||
<div className={printable ? 'print:hidden' : undefined}>
|
||||
<TempoFooter />
|
||||
</div>
|
||||
</div>
|
||||
</MenuPlacement.Provider>
|
||||
</NavigationContextProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -482,22 +482,6 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
id: 'discovery',
|
||||
label: 'Descoberta',
|
||||
children: [
|
||||
link(
|
||||
'why',
|
||||
'Porquê investir em Moçambique?',
|
||||
'/porque-investir',
|
||||
),
|
||||
link(
|
||||
'opportunities',
|
||||
'Consultar oportunidades',
|
||||
'/oportunidades',
|
||||
),
|
||||
link(
|
||||
'simulator',
|
||||
'Simulador Fiscal',
|
||||
access.context?.simulator || '/simulador-fiscal',
|
||||
),
|
||||
link('sectors', 'Sectores de investimento', '/sectores'),
|
||||
link('locations', 'Localizações', '/oportunidades?view=map'),
|
||||
...(access.funding
|
||||
? [
|
||||
|
||||
Reference in New Issue
Block a user