@@ -2,6 +2,8 @@ import { AppContent } from '@/components/app-content';
|
||||
import { AppShell } from '@/components/app-shell';
|
||||
import { AppSidebar } from '@/components/app-sidebar';
|
||||
import { AppSidebarHeader } from '@/components/app-sidebar-header';
|
||||
import { JourneyCompanion } from '@/components/journey-companion';
|
||||
import { PortalMenu } from '@/layouts/portal-navigation';
|
||||
import type { AppLayoutProps } from '@/types';
|
||||
|
||||
export default function AppSidebarLayout({
|
||||
@@ -13,6 +15,8 @@ export default function AppSidebarLayout({
|
||||
<AppSidebar />
|
||||
<AppContent variant="sidebar" className="min-w-0 overflow-x-clip">
|
||||
<AppSidebarHeader breadcrumbs={breadcrumbs} />
|
||||
<PortalMenu primary />
|
||||
<JourneyCompanion />
|
||||
{children}
|
||||
</AppContent>
|
||||
</AppShell>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { useId, useState } from 'react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import { PortalGroupedMenu } from '@/components/portal-grouped-menu';
|
||||
import type { ReactNode } from 'react';
|
||||
import { JourneyCompanion } from '@/components/journey-companion';
|
||||
|
||||
const MenuPlacement = createContext(false);
|
||||
|
||||
export const portalLinks = [
|
||||
['/', 'Início'],
|
||||
@@ -46,7 +50,19 @@ export default function PortalNavigation({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { url, props } = usePage();
|
||||
const { url, props, component } = usePage();
|
||||
const portalShell =
|
||||
['welcome', 'PortalInvestidor', 'management-access'].includes(
|
||||
component,
|
||||
) ||
|
||||
[
|
||||
'portal/',
|
||||
'investment/',
|
||||
'portfolio/',
|
||||
'desk/',
|
||||
'auth/',
|
||||
'land-assistance/',
|
||||
].some((prefix) => component.startsWith(prefix));
|
||||
const path = url.split('?')[0];
|
||||
const parent = Object.keys(names)
|
||||
.filter((p) => p !== '/' && path.startsWith(`${p}/`))
|
||||
@@ -72,119 +88,55 @@ export default function PortalNavigation({
|
||||
? 'Definições da conta'
|
||||
: 'Detalhes');
|
||||
return (
|
||||
<div className="pb-8 lg:pb-24 [&_button]:scroll-mb-24 [&_input]:scroll-mb-24 [&_select]:scroll-mb-24 [&_textarea]:scroll-mb-24">
|
||||
<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
|
||||
</a>
|
||||
<nav
|
||||
aria-label="Caminho de navegação"
|
||||
className="bg-background text-foreground flex flex-wrap items-center gap-2 border-b px-5 py-3 text-sm"
|
||||
>
|
||||
{path === '/' ? (
|
||||
<span aria-current="page">Início</span>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/" className="underline">
|
||||
Início
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{parent && (
|
||||
<>
|
||||
<Link href={parent} className="underline">
|
||||
{names[parent]}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
</>
|
||||
)}
|
||||
<span aria-current="page">{title}</span>
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
<div id="portal-content" tabIndex={-1}>
|
||||
{children}
|
||||
<MenuPlacement.Provider value={true}>
|
||||
<div className="pb-8 lg:pb-24 [&_button]:scroll-mb-24 [&_input]:scroll-mb-24 [&_select]:scroll-mb-24 [&_textarea]:scroll-mb-24">
|
||||
{portalShell && <PortalMenu primary />}
|
||||
<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
|
||||
</a>
|
||||
<nav
|
||||
aria-label="Caminho de navegação"
|
||||
className="bg-background text-foreground flex flex-wrap items-center gap-2 border-b px-5 py-3 text-sm"
|
||||
>
|
||||
{path === '/' ? (
|
||||
<span aria-current="page">Início</span>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/" className="underline">
|
||||
Início
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
{parent && (
|
||||
<>
|
||||
<Link href={parent} className="underline">
|
||||
{names[parent]}
|
||||
</Link>
|
||||
<span aria-hidden="true">/</span>
|
||||
</>
|
||||
)}
|
||||
<span aria-current="page">{title}</span>
|
||||
</>
|
||||
)}
|
||||
</nav>
|
||||
<div id="portal-content" tabIndex={-1}>
|
||||
{portalShell && <JourneyCompanion />}
|
||||
{children}
|
||||
</div>
|
||||
<a
|
||||
href="/apoio"
|
||||
className="mx-3 mt-4 block max-w-[calc(100%-1.5rem)] rounded-xl bg-emerald-800 px-5 py-3 text-center text-sm font-semibold text-white shadow-xl focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-emerald-600"
|
||||
>
|
||||
Contactar Apoio ao Investidor
|
||||
</a>
|
||||
</div>
|
||||
<a
|
||||
href="/apoio"
|
||||
className="mx-3 mt-4 block max-w-[calc(100%-1.5rem)] rounded-xl bg-emerald-800 px-5 py-3 text-center text-sm font-semibold text-white shadow-xl focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-emerald-600 lg:fixed lg:right-3 lg:bottom-3 lg:z-50 lg:mx-0 lg:mt-0 lg:max-w-[calc(100vw-1.5rem)]"
|
||||
>
|
||||
Contactar Apoio ao Investidor
|
||||
</a>
|
||||
</div>
|
||||
</MenuPlacement.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function PortalMenu() {
|
||||
const { existingBusinessEnabled } = usePage<{
|
||||
existingBusinessEnabled?: boolean;
|
||||
}>().props;
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const menuId = useId();
|
||||
return (
|
||||
<nav
|
||||
aria-label="Áreas do portal"
|
||||
className="border-b bg-white px-5 py-4 text-sm text-slate-800"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-4 md:hidden">
|
||||
<Link href="/" className="font-bold">
|
||||
Portal do Investidor
|
||||
</Link>
|
||||
<button
|
||||
type="button"
|
||||
className="rounded-lg border px-3 py-2 font-semibold focus-visible:outline-2 focus-visible:outline-emerald-700"
|
||||
aria-expanded={expanded}
|
||||
aria-controls={menuId}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
>
|
||||
{expanded ? 'Fechar menu' : 'Abrir menu'}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
id={menuId}
|
||||
className={`${expanded ? 'flex' : 'hidden'} mt-4 flex-wrap gap-x-5 gap-y-3 md:mt-0 md:flex`}
|
||||
>
|
||||
{portalLinks.map(([href, label]) => (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className="underline underline-offset-4"
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
))}
|
||||
<details className="relative">
|
||||
<summary className="cursor-pointer underline underline-offset-4 focus-visible:outline-2 focus-visible:outline-emerald-700">
|
||||
Catálogos territoriais e económicos
|
||||
</summary>
|
||||
<ul className="mt-2 grid gap-2 rounded-lg border bg-white p-4 shadow-sm md:absolute md:z-20 md:min-w-64">
|
||||
<li><Link className="underline" href="/carteira?kind=cluster">Clusters</Link></li>
|
||||
<li><Link className="underline" href="/carteira?kind=corridor">Corredores</Link></li>
|
||||
<li><Link className="underline" href="/zonas">ZEE, ZFI e parques industriais</Link></li>
|
||||
<li><Link className="underline" href="/carteira?kind=project">Projectos âncora</Link></li>
|
||||
<li><Link className="underline" href="/oportunidades">Oportunidades publicadas</Link></li>
|
||||
<li><Link className="underline" href="/negocios">Negócios existentes e participações publicadas</Link></li>
|
||||
</ul>
|
||||
</details>
|
||||
{existingBusinessEnabled && (
|
||||
<Link href="/investidor/negocios" className="underline">
|
||||
Os meus negócios
|
||||
</Link>
|
||||
)}
|
||||
<Link href="/parcerias" className="underline">
|
||||
Bolsa de Parcerias
|
||||
</Link>
|
||||
<Link href="/simulador-fiscal" className="underline">
|
||||
Simulador Fiscal
|
||||
</Link>
|
||||
<Link href="/balcao-virtual" className="underline">
|
||||
Balcão Virtual
|
||||
</Link>
|
||||
<Link href="/investidor/manifestacoes" className="underline">
|
||||
Área do investidor
|
||||
</Link>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
export function PortalMenu({ primary = false }: { primary?: boolean }) {
|
||||
const placed = useContext(MenuPlacement);
|
||||
return placed && !primary ? null : <PortalGroupedMenu />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user