@@ -1,52 +1,55 @@
|
||||
import { Link, usePage } from "@inertiajs/react";
|
||||
import { useId, useState } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import { useId, useState } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export const portalLinks = [
|
||||
["/", "Início"],
|
||||
["/oportunidades", "Oportunidades de Investimento"],
|
||||
["/clusters", "Clusters"],
|
||||
["/corredores", "Corredores"],
|
||||
["/zonas", "ZEE, ZFI e parques"],
|
||||
["/projectos-ancora", "Projectos âncora"],
|
||||
["/educacao", "Educação"],
|
||||
["/sectores", "Sectores Prioritários"],
|
||||
["/como-investir", "Como Investir"],
|
||||
["/legislacao", "Legislação e Incentivos"],
|
||||
["/documentos", "Documentos e Formulários"],
|
||||
["/apoio", "Apoio ao Investidor"],
|
||||
['/', 'Início'],
|
||||
['/oportunidades', 'Oportunidades de Investimento'],
|
||||
['/educacao', 'Educação'],
|
||||
['/sectores', 'Sectores Prioritários'],
|
||||
['/como-investir', 'Como Investir'],
|
||||
['/terra-duat', 'Terra e DUAT'],
|
||||
['/legislacao', 'Legislação e Incentivos'],
|
||||
['/documentos', 'Documentos e Formulários'],
|
||||
['/apoio', 'Apoio ao Investidor'],
|
||||
] as const;
|
||||
const names: Record<string, string> = {
|
||||
"/investidor/negocios": "Os meus negócios",
|
||||
"/management/negocios": "Revisão de negócios",
|
||||
'/investidor/negocios': 'Os meus negócios',
|
||||
'/management/negocios': 'Revisão de negócios',
|
||||
...Object.fromEntries(portalLinks),
|
||||
"/parcerias": "Bolsa de Parcerias",
|
||||
"/simulador-fiscal": "Simulador Fiscal",
|
||||
"/balcao-virtual": "Balcão Virtual",
|
||||
"/investidor/manifestacoes": "Manifestações e favoritos",
|
||||
"/investidor/profile": "Perfil e empresas",
|
||||
"/investidor/notifications": "Notificações",
|
||||
"/management/investment/references": "Referências e formulários",
|
||||
"/management/investment/zones": "Gestão de ZEE, ZFI e parques",
|
||||
"/formularios/investidor": "Formulário de investidor",
|
||||
"/formularios/empresa": "Formulário de empresa",
|
||||
"/manifestar-interesse": "Manifestar interesse",
|
||||
"/carteira": "Corredores, clusters e projectos",
|
||||
"/investidor": "O meu painel",
|
||||
"/login": "Entrar",
|
||||
"/register": "Criar conta",
|
||||
"/dashboard": "Painel",
|
||||
"/acesso-gestao": "Acesso à gestão",
|
||||
"/management/portfolio": "Carteira de investimento",
|
||||
"/management/ai": "Assistência",
|
||||
"/management/interests": "Pedidos de interesse",
|
||||
"/management/portal-services": "Documentos e parcerias",
|
||||
'/investidor/terra-duat': 'Os meus pedidos Terra e DUAT',
|
||||
'/management/terra-duat': 'Gestão de Terra e DUAT',
|
||||
'/parcerias': 'Bolsa de Parcerias',
|
||||
'/simulador-fiscal': 'Simulador Fiscal',
|
||||
'/balcao-virtual': 'Balcão Virtual',
|
||||
'/investidor/manifestacoes': 'Manifestações e favoritos',
|
||||
'/investidor/profile': 'Perfil e empresas',
|
||||
'/investidor/notifications': 'Notificações',
|
||||
'/management/investment/references': 'Referências e formulários',
|
||||
'/management/investment/zones': 'Gestão de ZEE, ZFI e parques',
|
||||
'/formularios/investidor': 'Formulário de investidor',
|
||||
'/formularios/empresa': 'Formulário de empresa',
|
||||
'/manifestar-interesse': 'Manifestar interesse',
|
||||
'/carteira': 'Corredores, clusters e projectos',
|
||||
'/investidor': 'O meu painel',
|
||||
'/login': 'Entrar',
|
||||
'/register': 'Criar conta',
|
||||
'/dashboard': 'Painel',
|
||||
'/acesso-gestao': 'Acesso à gestão',
|
||||
'/management/portfolio': 'Carteira de investimento',
|
||||
'/management/ai': 'Assistência',
|
||||
'/management/interests': 'Pedidos de interesse',
|
||||
'/management/portal-services': 'Documentos e parcerias',
|
||||
};
|
||||
export default function PortalNavigation({ children }: { children: ReactNode }) {
|
||||
export default function PortalNavigation({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { url, props } = usePage();
|
||||
const path = url.split("?")[0];
|
||||
const path = url.split('?')[0];
|
||||
const parent = Object.keys(names)
|
||||
.filter((p) => p !== "/" && path.startsWith(`${p}/`))
|
||||
.filter((p) => p !== '/' && path.startsWith(`${p}/`))
|
||||
.sort((a, b) => b.length - a.length)[0];
|
||||
const pageProps = props as {
|
||||
record?: { title?: string; name?: string };
|
||||
@@ -61,15 +64,15 @@ export default function PortalNavigation({ children }: { children: ReactNode })
|
||||
pageProps.zone?.name ??
|
||||
pageProps.sector?.name ??
|
||||
pageProps.initialOpportunity?.title ??
|
||||
(path.includes("/edit")
|
||||
? "Editar registo"
|
||||
: path.startsWith("/management")
|
||||
? "Gestão do portal"
|
||||
: path.startsWith("/settings")
|
||||
? "Definições da conta"
|
||||
: "Detalhes");
|
||||
(path.includes('/edit')
|
||||
? 'Editar registo'
|
||||
: path.startsWith('/management')
|
||||
? 'Gestão do portal'
|
||||
: path.startsWith('/settings')
|
||||
? 'Definições da conta'
|
||||
: 'Detalhes');
|
||||
return (
|
||||
<div className="pb-24 [&_input]:scroll-mb-24 [&_select]:scroll-mb-24 [&_textarea]:scroll-mb-24 [&_button]:scroll-mb-24">
|
||||
<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"
|
||||
@@ -78,9 +81,9 @@ export default function PortalNavigation({ children }: { children: ReactNode })
|
||||
</a>
|
||||
<nav
|
||||
aria-label="Caminho de navegação"
|
||||
className="flex flex-wrap items-center gap-2 border-b bg-background px-5 py-3 text-sm text-foreground"
|
||||
className="bg-background text-foreground flex flex-wrap items-center gap-2 border-b px-5 py-3 text-sm"
|
||||
>
|
||||
{path === "/" ? (
|
||||
{path === '/' ? (
|
||||
<span aria-current="page">Início</span>
|
||||
) : (
|
||||
<>
|
||||
@@ -105,7 +108,7 @@ export default function PortalNavigation({ children }: { children: ReactNode })
|
||||
</div>
|
||||
<a
|
||||
href="/apoio"
|
||||
className="fixed right-3 bottom-3 z-50 max-w-[calc(100vw-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"
|
||||
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>
|
||||
@@ -114,7 +117,9 @@ export default function PortalNavigation({ children }: { children: ReactNode })
|
||||
}
|
||||
|
||||
export function PortalMenu() {
|
||||
const { existingBusinessEnabled } = usePage<{ existingBusinessEnabled?: boolean }>().props;
|
||||
const { existingBusinessEnabled } = usePage<{
|
||||
existingBusinessEnabled?: boolean;
|
||||
}>().props;
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const menuId = useId();
|
||||
return (
|
||||
@@ -133,18 +138,35 @@ export function PortalMenu() {
|
||||
aria-controls={menuId}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
>
|
||||
{expanded ? "Fechar menu" : "Abrir menu"}
|
||||
{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`}
|
||||
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">
|
||||
<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
|
||||
|
||||
Reference in New Issue
Block a user