@@ -1,20 +1,11 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
|
||||
import AppLogoIcon from '@/components/app-logo-icon';
|
||||
|
||||
export default function AppLogo() {
|
||||
const { name } = usePage().props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-md">
|
||||
<AppLogoIcon className="size-5 fill-current text-white dark:text-black" />
|
||||
</div>
|
||||
<div className="ml-1 grid flex-1 text-left text-sm">
|
||||
<span className="mb-0.5 truncate leading-tight font-semibold">
|
||||
{name}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-8 w-auto max-w-full object-contain group-data-[collapsible=icon]:h-auto group-data-[collapsible=icon]:w-8"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
import { useNavigationContext } from '@/components/navigation-context';
|
||||
import type { ProfileAccess } from '@/types/profile-access';
|
||||
import { Link, router, usePage } from '@inertiajs/react';
|
||||
import { LogOut } from 'lucide-react';
|
||||
import { logout } from '@/routes';
|
||||
import { useEffect, useId, useRef, useState } from 'react';
|
||||
import type { OpportunityManagementAccess } from '@/types/opportunity-management';
|
||||
import { ChevronDown, LogOut, UserRound } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { useNavigationContext } from '@/components/navigation-context';
|
||||
import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
|
||||
import {
|
||||
TempoLanguageSelector,
|
||||
TempoWeather,
|
||||
} from '@/components/tempo-header-tools';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuSub,
|
||||
DropdownMenuSubContent,
|
||||
DropdownMenuSubTrigger,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import {
|
||||
portalNavigation,
|
||||
currentNavigationGroup,
|
||||
currentNavigationItem,
|
||||
type PortalNavItem,
|
||||
} from '@/lib/portal-navigation';
|
||||
import type { PortalNavItem } from '@/lib/portal-navigation';
|
||||
import type { ProfileAccess } from '@/types/profile-access';
|
||||
import type { OpportunityManagementAccess } from '@/types/opportunity-management';
|
||||
import { logout } from '@/routes';
|
||||
|
||||
export function PortalGroupedMenu() {
|
||||
const { props, url } = usePage<{
|
||||
@@ -23,10 +39,10 @@ export function PortalGroupedMenu() {
|
||||
educationEnabled?: boolean;
|
||||
aiEnabled?: boolean;
|
||||
legacyContentEnabled?: boolean;
|
||||
portalOperator?: string | null;
|
||||
profileAccess?: ProfileAccess | null;
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
}>();
|
||||
const { t, language, requestCount } = useTempoUi();
|
||||
const navigation = useNavigationContext();
|
||||
const groups = portalNavigation({
|
||||
context: navigation.view
|
||||
@@ -44,159 +60,77 @@ export function PortalGroupedMenu() {
|
||||
});
|
||||
const current = currentNavigationGroup(groups, url);
|
||||
const currentItem = currentNavigationItem(groups, url);
|
||||
const [open, setOpen] = useState<string | null>(null);
|
||||
const [branch, setBranch] = useState<string | null>(null);
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [loggingOut, setLoggingOut] = useState(false);
|
||||
const root = useRef<HTMLElement>(null);
|
||||
const id = useId();
|
||||
useEffect(() => {
|
||||
const position = () => {
|
||||
const button = open
|
||||
? document.getElementById(`${id}-${open}-button`)
|
||||
: null;
|
||||
if (!button || window.innerWidth < 640) {
|
||||
setOffset(0);
|
||||
return;
|
||||
}
|
||||
const rect = button.getBoundingClientRect();
|
||||
const width = Math.min(288, window.innerWidth - 32);
|
||||
setOffset(
|
||||
Math.max(
|
||||
16,
|
||||
Math.min(rect.left, window.innerWidth - width - 16),
|
||||
) - rect.left,
|
||||
);
|
||||
};
|
||||
position();
|
||||
window.addEventListener('resize', position);
|
||||
return () => window.removeEventListener('resize', position);
|
||||
}, [open, id]);
|
||||
useEffect(() => {
|
||||
const outside = (event: PointerEvent) => {
|
||||
if (
|
||||
event.target instanceof Node &&
|
||||
!root.current?.contains(event.target)
|
||||
) {
|
||||
setOpen(null);
|
||||
setBranch(null);
|
||||
}
|
||||
};
|
||||
document.addEventListener('pointerdown', outside);
|
||||
return () => document.removeEventListener('pointerdown', outside);
|
||||
}, []);
|
||||
const close = () => {
|
||||
setOpen(null);
|
||||
setBranch(null);
|
||||
};
|
||||
const items = (children: PortalNavItem[]) =>
|
||||
children.map((item) => (
|
||||
<li key={item.id}>
|
||||
{item.children ? (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
id={`${id}-${item.id}-button`}
|
||||
className="flex w-full items-center justify-between rounded-lg px-3 py-2 text-left font-semibold hover:bg-emerald-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700"
|
||||
aria-expanded={branch === item.id}
|
||||
aria-controls={`${id}-${item.id}`}
|
||||
onClick={() =>
|
||||
setBranch(branch === item.id ? null : item.id)
|
||||
}
|
||||
>
|
||||
{item.label}
|
||||
<span aria-hidden="true">
|
||||
{branch === item.id ? '−' : '+'}
|
||||
</span>
|
||||
</button>
|
||||
{branch === item.id && (
|
||||
<ul
|
||||
id={`${id}-${item.id}`}
|
||||
className="ml-3 space-y-1 border-l-2 border-emerald-200 pl-2"
|
||||
>
|
||||
{items(item.children)}
|
||||
</ul>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
children.map((item) =>
|
||||
item.children ? (
|
||||
<DropdownMenuSub key={item.id}>
|
||||
<DropdownMenuSubTrigger className="tempo-menu-item font-semibold">
|
||||
{t(item.label)}
|
||||
</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[min(70vh,34rem)] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
{items(item.children)}
|
||||
</DropdownMenuSubContent>
|
||||
</DropdownMenuSub>
|
||||
) : (
|
||||
<DropdownMenuItem
|
||||
key={item.id}
|
||||
asChild
|
||||
className="tempo-menu-item"
|
||||
>
|
||||
<Link
|
||||
href={item.href!}
|
||||
onClick={close}
|
||||
aria-current={
|
||||
currentItem === item.id ? 'page' : undefined
|
||||
}
|
||||
className="block rounded-lg px-3 py-2 hover:bg-emerald-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700"
|
||||
>
|
||||
{item.label}
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
));
|
||||
</DropdownMenuItem>
|
||||
),
|
||||
);
|
||||
const accountGroups = groups.filter(
|
||||
(group) =>
|
||||
!['home', 'discovery', 'realization', 'support'].includes(group.id),
|
||||
);
|
||||
return (
|
||||
<header
|
||||
ref={root}
|
||||
className="relative z-40 border-b border-slate-200 bg-white text-slate-900"
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== 'Escape') return;
|
||||
event.preventDefault();
|
||||
if (branch) {
|
||||
document.getElementById(`${id}-${branch}-button`)?.focus();
|
||||
setBranch(null);
|
||||
} else if (open) {
|
||||
document.getElementById(`${id}-${open}-button`)?.focus();
|
||||
close();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="mx-auto max-w-7xl px-4 py-4 sm:px-6">
|
||||
<div className="mb-3 flex flex-wrap items-center justify-between gap-2">
|
||||
<Link
|
||||
href="/"
|
||||
className="text-xl font-extrabold tracking-tight text-emerald-900"
|
||||
>
|
||||
InvesteMoz
|
||||
</Link>
|
||||
<p className="max-w-2xl text-xs leading-relaxed text-slate-600">
|
||||
Iniciativa privada e independente de apoio ao
|
||||
investimento. Orientação e acompanhamento internos;
|
||||
decisões oficiais cabem às instituições competentes.
|
||||
{props.portalOperator && (
|
||||
<> Operador: {props.portalOperator}.</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{props.auth?.user && (
|
||||
<nav
|
||||
aria-label="Sessão da conta"
|
||||
className="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg bg-slate-50 px-3 py-2"
|
||||
>
|
||||
<p className="min-w-0 text-sm [overflow-wrap:anywhere] break-words text-slate-700">
|
||||
Sessão:{' '}
|
||||
{props.auth.user.name || props.auth.user.email}
|
||||
</p>
|
||||
<Link
|
||||
href={logout()}
|
||||
as="button"
|
||||
type="button"
|
||||
disabled={loggingOut}
|
||||
onClick={() => {
|
||||
close();
|
||||
router.flushAll();
|
||||
}}
|
||||
onStart={() => setLoggingOut(true)}
|
||||
onFinish={() => setLoggingOut(false)}
|
||||
data-test="portal-logout-button"
|
||||
className="inline-flex min-h-11 shrink-0 items-center gap-2 rounded-lg border border-slate-400 bg-white px-3 py-2 text-sm font-semibold text-slate-900 hover:bg-slate-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700 disabled:cursor-wait disabled:opacity-60"
|
||||
>
|
||||
<LogOut aria-hidden="true" className="size-4" />
|
||||
{loggingOut
|
||||
? 'A terminar sessão…'
|
||||
: 'Terminar sessão'}
|
||||
</Link>
|
||||
</nav>
|
||||
)}
|
||||
<nav aria-label="Áreas do portal">
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
<header className="tempo-header" lang={language}>
|
||||
<div className="tempo-header-inner mx-auto flex max-w-[1440px] flex-wrap items-center justify-between gap-x-3 gap-y-0 px-4 sm:px-6 xl:min-h-22">
|
||||
<Link
|
||||
href="/"
|
||||
aria-label="Tempo — início"
|
||||
className="tempo-logo-link my-4 shrink-0"
|
||||
>
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-9 w-auto object-contain sm:h-10"
|
||||
/>
|
||||
</Link>
|
||||
<nav
|
||||
aria-label="Áreas do portal"
|
||||
className="order-3 w-full border-t border-white/10 xl:order-none xl:w-auto xl:flex-1 xl:border-0"
|
||||
>
|
||||
<ul className="flex items-center justify-between gap-0 py-2 xl:justify-center xl:py-0">
|
||||
<li>
|
||||
<Link
|
||||
href="/"
|
||||
className="tempo-nav-trigger"
|
||||
aria-current={
|
||||
current === 'home' ? 'page' : undefined
|
||||
}
|
||||
data-current-group={
|
||||
current === 'home' || undefined
|
||||
}
|
||||
>
|
||||
{t('Início')}
|
||||
</Link>
|
||||
</li>
|
||||
{groups
|
||||
.filter((group) =>
|
||||
[
|
||||
@@ -206,109 +140,115 @@ export function PortalGroupedMenu() {
|
||||
].includes(group.id),
|
||||
)
|
||||
.map((group) => (
|
||||
<li
|
||||
key={group.id}
|
||||
className="relative w-full sm:w-auto"
|
||||
>
|
||||
<button
|
||||
id={`${id}-${group.id}-button`}
|
||||
type="button"
|
||||
className={`flex min-h-11 w-full items-center justify-between gap-2 rounded-lg border px-3 py-2 text-left text-sm font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700 ${current === group.id ? 'border-emerald-700 bg-emerald-50 text-emerald-950' : 'border-slate-200 hover:bg-slate-50'}`}
|
||||
aria-expanded={open === group.id}
|
||||
aria-controls={`${id}-${group.id}`}
|
||||
data-current-group={
|
||||
current === group.id || undefined
|
||||
}
|
||||
onClick={() => {
|
||||
setOpen(
|
||||
open === group.id
|
||||
? null
|
||||
: group.id,
|
||||
);
|
||||
setBranch(null);
|
||||
}}
|
||||
>
|
||||
{group.label}
|
||||
<span aria-hidden="true">
|
||||
{open === group.id ? '▴' : '▾'}
|
||||
</span>
|
||||
{current === group.id && (
|
||||
<span className="sr-only">
|
||||
Grupo actual
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
{open === group.id && (
|
||||
<ul
|
||||
id={`${id}-${group.id}`}
|
||||
style={{
|
||||
transform: `translateX(${offset}px)`,
|
||||
}}
|
||||
className="mt-2 max-h-[min(70vh,32rem)] w-full space-y-1 overflow-y-auto rounded-xl border border-slate-200 bg-white p-2 text-sm shadow-xl sm:absolute sm:top-full sm:left-0 sm:z-40 sm:w-72 sm:max-w-[calc(100vw-2rem)]"
|
||||
<li key={group.id}>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className="tempo-nav-trigger"
|
||||
data-current-group={
|
||||
current === group.id ||
|
||||
undefined
|
||||
}
|
||||
>
|
||||
{t(group.label)}
|
||||
<ChevronDown
|
||||
size={14}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{current === group.id && (
|
||||
<span className="sr-only">
|
||||
Grupo actual
|
||||
</span>
|
||||
)}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[min(75vh,36rem)] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
<li className="border-b border-slate-100 px-3 pb-2 text-xs leading-relaxed text-slate-600">
|
||||
{group.id === 'discovery'
|
||||
? 'Conhecer possibilidades, sectores e localizações.'
|
||||
: group.id === 'realization'
|
||||
? 'Preparar o investimento e os seus requisitos.'
|
||||
: 'Encontrar serviços, acompanhar e pedir apoio.'}
|
||||
</li>
|
||||
{items(group.children ?? [])}
|
||||
</ul>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<nav
|
||||
aria-label="Conta e trabalho por papel"
|
||||
className="mt-3 grid gap-3 sm:grid-cols-2"
|
||||
>
|
||||
<details className="rounded border p-3">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
A minha conta e atividade
|
||||
</summary>
|
||||
<ul className="mt-2 space-y-1">
|
||||
{items(
|
||||
groups.filter((g) =>
|
||||
['account', 'personal-activity'].includes(
|
||||
g.id,
|
||||
),
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</details>
|
||||
{groups.some((g) =>
|
||||
[
|
||||
'management',
|
||||
'profile-opportunities',
|
||||
'business-work',
|
||||
].includes(g.id),
|
||||
) && (
|
||||
<details className="rounded border p-3">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
Área de trabalho — criação, revisão, publicação
|
||||
e administração
|
||||
</summary>
|
||||
<p className="my-2 text-xs">
|
||||
Destinos disponíveis segundo o papel e âmbito
|
||||
existentes; não exige percorrer a jornada do
|
||||
investidor.
|
||||
</p>
|
||||
<ul className="space-y-1">
|
||||
{items(
|
||||
groups.filter((g) =>
|
||||
[
|
||||
'management',
|
||||
'profile-opportunities',
|
||||
'business-work',
|
||||
].includes(g.id),
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</details>
|
||||
<div className="tempo-panel-summary">
|
||||
<Link href="/investidor/manifestacoes">
|
||||
{t('O meu painel')}
|
||||
</Link>
|
||||
<span aria-live="polite" aria-atomic="true">
|
||||
{requestCount}{' '}
|
||||
{t(
|
||||
requestCount === 1
|
||||
? 'pedido recebido'
|
||||
: 'pedidos recebidos',
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="order-5 flex w-full items-center justify-between gap-2 border-t border-white/10 py-2 xl:order-none xl:w-auto xl:justify-end xl:border-0 xl:py-0">
|
||||
<div className="flex items-center gap-1 sm:gap-2">
|
||||
<TempoWeather />
|
||||
<TempoLanguageSelector />
|
||||
</div>
|
||||
<TempoSocialLinks />
|
||||
</div>
|
||||
<div className="tempo-header-actions">
|
||||
{props.auth?.user ? (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger className="tempo-login-button">
|
||||
<UserRound size={16} aria-hidden="true" />
|
||||
<span className="max-w-24 truncate">
|
||||
{props.auth.user.name || t('A minha área')}
|
||||
</span>
|
||||
<ChevronDown size={12} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
sideOffset={12}
|
||||
collisionPadding={12}
|
||||
className="tempo-dropdown max-h-[75vh] w-72 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
|
||||
>
|
||||
<DropdownMenuLabel className="truncate text-xs text-slate-500">
|
||||
{props.auth.user.email}
|
||||
</DropdownMenuLabel>
|
||||
{items(accountGroups)}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
asChild
|
||||
className="tempo-menu-item text-red-700"
|
||||
>
|
||||
<Link
|
||||
href={logout()}
|
||||
as="button"
|
||||
type="button"
|
||||
disabled={loggingOut}
|
||||
data-test="portal-logout-button"
|
||||
onClick={() => router.flushAll()}
|
||||
onStart={() => setLoggingOut(true)}
|
||||
onFinish={() => setLoggingOut(false)}
|
||||
>
|
||||
<LogOut size={16} aria-hidden="true" />
|
||||
{loggingOut
|
||||
? 'A terminar sessão…'
|
||||
: t('Terminar sessão')}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : (
|
||||
<Link href="/login" className="tempo-login-button">
|
||||
<UserRound size={15} aria-hidden="true" />
|
||||
{t('Entrar')}
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
<Link
|
||||
href="/manifestar-interesse"
|
||||
className="tempo-interest-button"
|
||||
>
|
||||
{t('Manifestar interesse')}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
import { createContext, useContext, useEffect, useState } from 'react';
|
||||
import { Facebook, Instagram, Linkedin, Youtube } from 'lucide-react';
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
|
||||
export const tempoSocialLinks = [
|
||||
{
|
||||
name: 'Facebook',
|
||||
href: 'https://www.facebook.com/revistatempo.mz/',
|
||||
icon: Facebook,
|
||||
color: '#1877f2',
|
||||
},
|
||||
{
|
||||
name: 'Instagram',
|
||||
href: 'https://www.instagram.com/revistatempo.mz/',
|
||||
icon: Instagram,
|
||||
color: '#e1306c',
|
||||
},
|
||||
{
|
||||
name: 'LinkedIn',
|
||||
href: 'https://www.linkedin.com/company/revistatempo/',
|
||||
icon: Linkedin,
|
||||
color: '#38a5df',
|
||||
},
|
||||
{
|
||||
name: 'YouTube',
|
||||
href: 'https://www.youtube.com/@RevistaTempoMz/',
|
||||
icon: Youtube,
|
||||
color: '#ff3333',
|
||||
},
|
||||
];
|
||||
|
||||
const menuTranslations = [
|
||||
['O meu painel', 'My dashboard', 'Mon espace', 'Mi panel'],
|
||||
[
|
||||
'Manifestar interesse',
|
||||
'Express interest',
|
||||
'Manifester un intérêt',
|
||||
'Manifestar interés',
|
||||
],
|
||||
[
|
||||
'pedido recebido',
|
||||
'request received',
|
||||
'demande reçue',
|
||||
'solicitud recibida',
|
||||
],
|
||||
[
|
||||
'pedidos recebidos',
|
||||
'requests received',
|
||||
'demandes reçues',
|
||||
'solicitudes recibidas',
|
||||
],
|
||||
[
|
||||
'Porquê investir em Moçambique',
|
||||
'Why invest in Mozambique',
|
||||
'Pourquoi investir au Mozambique',
|
||||
'Por qué invertir en Mozambique',
|
||||
],
|
||||
[
|
||||
'Oportunidades de investimento',
|
||||
'Investment opportunities',
|
||||
'Opportunités d’investissement',
|
||||
'Oportunidades de inversión',
|
||||
],
|
||||
[
|
||||
'Sectores de investimento',
|
||||
'Investment sectors',
|
||||
'Secteurs d’investissement',
|
||||
'Sectores de inversión',
|
||||
],
|
||||
['Localizações', 'Locations', 'Localisations', 'Ubicaciones'],
|
||||
[
|
||||
'Iniciar investimento',
|
||||
'Start an investment',
|
||||
'Démarrer un investissement',
|
||||
'Iniciar una inversión',
|
||||
],
|
||||
[
|
||||
'Incentivos e simulador fiscal',
|
||||
'Incentives and tax simulator',
|
||||
'Incitations et simulateur fiscal',
|
||||
'Incentivos y simulador fiscal',
|
||||
],
|
||||
['Licenciamento', 'Licensing', 'Autorisations', 'Licencias'],
|
||||
['Acesso à terra', 'Land access', 'Accès à la terre', 'Acceso a la tierra'],
|
||||
[
|
||||
'Serviços ao investidor',
|
||||
'Investor services',
|
||||
'Services aux investisseurs',
|
||||
'Servicios al inversor',
|
||||
],
|
||||
[
|
||||
'Acompanhamento do projecto',
|
||||
'Project follow-up',
|
||||
'Suivi du projet',
|
||||
'Seguimiento del proyecto',
|
||||
],
|
||||
[
|
||||
'Apoio ao investidor',
|
||||
'Investor support',
|
||||
'Assistance aux investisseurs',
|
||||
'Apoyo al inversor',
|
||||
],
|
||||
[
|
||||
'Dossiers e percursos',
|
||||
'Investment files and journeys',
|
||||
'Dossiers et parcours',
|
||||
'Expedientes y recorridos',
|
||||
],
|
||||
[
|
||||
'Perfil e empresas',
|
||||
'Profile and companies',
|
||||
'Profil et entreprises',
|
||||
'Perfil y empresas',
|
||||
],
|
||||
[
|
||||
'Pedidos e tarefas de acompanhamento',
|
||||
'Requests and follow-up tasks',
|
||||
'Demandes et tâches de suivi',
|
||||
'Solicitudes y tareas de seguimiento',
|
||||
],
|
||||
[
|
||||
'Manifestações e favoritos',
|
||||
'Expressions of interest and favourites',
|
||||
'Manifestations d’intérêt et favoris',
|
||||
'Manifestaciones de interés y favoritos',
|
||||
],
|
||||
['Notificações', 'Notifications', 'Notifications', 'Notificaciones'],
|
||||
['A minha atividade', 'My activity', 'Mes activités', 'Mi actividad'],
|
||||
[
|
||||
'As minhas parcerias',
|
||||
'My partnerships',
|
||||
'Mes partenariats',
|
||||
'Mis alianzas',
|
||||
],
|
||||
['Os meus negócios', 'My businesses', 'Mes entreprises', 'Mis negocios'],
|
||||
];
|
||||
const translatedMenu = (column: number) =>
|
||||
Object.fromEntries(menuTranslations.map((row) => [row[0], row[column]]));
|
||||
|
||||
const translations: Record<string, Record<string, string>> = {
|
||||
en: {
|
||||
...translatedMenu(1),
|
||||
Descoberta: 'Discover',
|
||||
Realização: 'Invest',
|
||||
Suporte: 'Support',
|
||||
Entrar: 'Sign in',
|
||||
'A minha área': 'My account',
|
||||
'Terminar sessão': 'Sign out',
|
||||
Contactos: 'Contacts',
|
||||
Navegação: 'Navigation',
|
||||
Início: 'Home',
|
||||
Oportunidades: 'Opportunities',
|
||||
Sectores: 'Sectors',
|
||||
Legislações: 'Legislation',
|
||||
'Guia do investidor': 'Investor guide',
|
||||
Contacto: 'Contact',
|
||||
'Política de Privacidade': 'Privacy Policy',
|
||||
'Termos de Uso': 'Terms of Use',
|
||||
'Todos os direitos reservados.': 'All rights reserved.',
|
||||
'Siga a Revista Tempo para actualizações exclusivas.':
|
||||
'Follow Revista Tempo for exclusive updates.',
|
||||
'Número de registo': 'Registration number',
|
||||
'A minha conta e atividade': 'My account and activity',
|
||||
'Área de trabalho': 'Workspace',
|
||||
},
|
||||
fr: {
|
||||
...translatedMenu(2),
|
||||
Descoberta: 'Découvrir',
|
||||
Realização: 'Investir',
|
||||
Suporte: 'Assistance',
|
||||
Entrar: 'Connexion',
|
||||
'A minha área': 'Mon compte',
|
||||
'Terminar sessão': 'Déconnexion',
|
||||
Contactos: 'Contacts',
|
||||
Navegação: 'Navigation',
|
||||
Início: 'Accueil',
|
||||
Oportunidades: 'Opportunités',
|
||||
Sectores: 'Secteurs',
|
||||
Legislações: 'Législation',
|
||||
'Guia do investidor': 'Guide de l’investisseur',
|
||||
Contacto: 'Contact',
|
||||
'Política de Privacidade': 'Politique de confidentialité',
|
||||
'Termos de Uso': 'Conditions d’utilisation',
|
||||
'Todos os direitos reservados.': 'Tous droits réservés.',
|
||||
'Siga a Revista Tempo para actualizações exclusivas.':
|
||||
'Suivez Revista Tempo pour des actualités exclusives.',
|
||||
'Número de registo': 'Numéro d’enregistrement',
|
||||
'A minha conta e atividade': 'Mon compte et mes activités',
|
||||
'Área de trabalho': 'Espace de travail',
|
||||
},
|
||||
es: {
|
||||
...translatedMenu(3),
|
||||
Descoberta: 'Descubrir',
|
||||
Realização: 'Invertir',
|
||||
Suporte: 'Soporte',
|
||||
Entrar: 'Entrar',
|
||||
'A minha área': 'Mi cuenta',
|
||||
'Terminar sessão': 'Cerrar sesión',
|
||||
Contactos: 'Contactos',
|
||||
Navegação: 'Navegación',
|
||||
Início: 'Inicio',
|
||||
Oportunidades: 'Oportunidades',
|
||||
Sectores: 'Sectores',
|
||||
Legislações: 'Legislación',
|
||||
'Guia do investidor': 'Guía del inversor',
|
||||
Contacto: 'Contacto',
|
||||
'Política de Privacidade': 'Política de privacidad',
|
||||
'Termos de Uso': 'Términos de uso',
|
||||
'Todos os direitos reservados.': 'Todos los derechos reservados.',
|
||||
'Siga a Revista Tempo para actualizações exclusivas.':
|
||||
'Siga Revista Tempo para recibir novedades exclusivas.',
|
||||
'Número de registo': 'Número de registro',
|
||||
'A minha conta e atividade': 'Mi cuenta y actividad',
|
||||
'Área de trabalho': 'Área de trabajo',
|
||||
},
|
||||
};
|
||||
|
||||
const TempoUi = createContext({
|
||||
language: 'pt',
|
||||
setLanguage: (_language: string) => {},
|
||||
t: (text: string) => text,
|
||||
requestCount: 0,
|
||||
registerSubmittedInterest: () => {},
|
||||
});
|
||||
|
||||
export function TempoUiProvider({ children }: { children: ReactNode }) {
|
||||
const [language, setCurrentLanguage] = useState('pt');
|
||||
const [requestCount, setRequestCount] = useState(0);
|
||||
useEffect(() => {
|
||||
try {
|
||||
const saved = localStorage.getItem('tempo-navigation-language');
|
||||
if (saved && ['pt', 'en', 'fr', 'es'].includes(saved))
|
||||
setCurrentLanguage(saved);
|
||||
} catch {
|
||||
/* Navigation remains usable without browser storage. */
|
||||
}
|
||||
}, []);
|
||||
const setLanguage = (next: string) => {
|
||||
setCurrentLanguage(next);
|
||||
try {
|
||||
localStorage.setItem('tempo-navigation-language', next);
|
||||
} catch {
|
||||
/* Optional persistence. */
|
||||
}
|
||||
};
|
||||
return (
|
||||
<TempoUi.Provider
|
||||
value={{
|
||||
language,
|
||||
setLanguage,
|
||||
t: (text) => translations[language]?.[text] ?? text,
|
||||
requestCount,
|
||||
registerSubmittedInterest: () =>
|
||||
setRequestCount((count) => count + 1),
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</TempoUi.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export const useTempoUi = () => useContext(TempoUi);
|
||||
|
||||
export function TempoSocialLinks({ footer = false }: { footer?: boolean }) {
|
||||
return (
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
aria-label="Redes sociais da Revista Tempo"
|
||||
>
|
||||
{tempoSocialLinks.map(({ name, href, icon: Icon, color }) => (
|
||||
<a
|
||||
key={name}
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`Revista Tempo — ${name}`}
|
||||
title={name}
|
||||
className={
|
||||
footer ? 'tempo-footer-social' : 'tempo-header-social'
|
||||
}
|
||||
style={{ '--social-color': color } as CSSProperties}
|
||||
>
|
||||
<Icon size={footer ? 19 : 16} aria-hidden="true" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { ChevronRight, Mail, MapPin, Phone } from 'lucide-react';
|
||||
import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
|
||||
|
||||
const navigation = [
|
||||
['/', 'Início'],
|
||||
['/apoio', 'Contacto'],
|
||||
];
|
||||
|
||||
export function TempoFooter() {
|
||||
const { t, language } = useTempoUi();
|
||||
return (
|
||||
<footer className="tempo-footer" lang={language}>
|
||||
<div className="mx-auto grid max-w-[1440px] gap-9 px-5 py-12 sm:grid-cols-2 sm:px-8 lg:grid-cols-[1.25fr_1.2fr_1fr_1fr_1.1fr] lg:gap-8 lg:py-14">
|
||||
<div className="space-y-6">
|
||||
<Link href="/" aria-label="Tempo — início">
|
||||
<img
|
||||
src="/images/logo/logo-vermelho.png"
|
||||
alt="Tempo"
|
||||
width="1787"
|
||||
height="564"
|
||||
className="h-11 w-auto object-contain"
|
||||
loading="lazy"
|
||||
/>
|
||||
</Link>
|
||||
<div className="flex items-start gap-3">
|
||||
<MapPin
|
||||
className="mt-1 size-5 shrink-0 text-[#ed1c24]"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<address className="border-l border-white/15 pl-3 text-sm leading-7 text-slate-300 not-italic">
|
||||
Av. Ahmed Sekou Touré, 1126 RC
|
||||
<br />
|
||||
Maputo Cidade, Moçambique
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="tempo-footer-heading">{t('Contactos')}</h2>
|
||||
<div className="space-y-3">
|
||||
{[
|
||||
['+258868010880', '+258 86 801 0880'],
|
||||
['+258833219644', '+258 83 321 9644'],
|
||||
].map(([number, label]) => (
|
||||
<a
|
||||
key={number}
|
||||
href={`tel:${number}`}
|
||||
className="tempo-contact-link"
|
||||
>
|
||||
<span className="tempo-contact-icon">
|
||||
<Phone size={16} aria-hidden="true" />
|
||||
</span>
|
||||
<strong className="text-sm font-medium">
|
||||
{label}
|
||||
</strong>
|
||||
</a>
|
||||
))}
|
||||
<a
|
||||
href="mailto:info@tempo.co.mz"
|
||||
className="tempo-contact-link"
|
||||
>
|
||||
<span className="tempo-contact-icon">
|
||||
<Mail size={16} aria-hidden="true" />
|
||||
</span>
|
||||
<strong className="text-sm font-medium [overflow-wrap:anywhere]">
|
||||
comercial@tempo.co.mz
|
||||
</strong>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<nav aria-label="Navegação do rodapé">
|
||||
<h2 className="tempo-footer-heading">{t('Navegação')}</h2>
|
||||
<ul className="space-y-3">
|
||||
{navigation.map(([href, label]) => (
|
||||
<li key={href}>
|
||||
<Link href={href} className="tempo-footer-link">
|
||||
<ChevronRight
|
||||
size={13}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{t(label)}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<nav aria-label="Informação legal">
|
||||
<h2 className="tempo-footer-heading">Legal</h2>
|
||||
<ul className="space-y-3">
|
||||
{[
|
||||
[
|
||||
'politica-de-privacidade',
|
||||
'Política de Privacidade',
|
||||
],
|
||||
['termos-de-uso', 'Termos de Uso'],
|
||||
].map(([path, label]) => (
|
||||
<li key={path}>
|
||||
<a
|
||||
href={`https://teste-info.tempo.co.mz/${path}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tempo-footer-link"
|
||||
>
|
||||
<ChevronRight
|
||||
size={13}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{t(label)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<div>
|
||||
<h2 className="tempo-footer-heading">Social</h2>
|
||||
<p className="mb-5 text-sm leading-6 text-slate-300">
|
||||
{t(
|
||||
'Siga a Revista Tempo para actualizações exclusivas.',
|
||||
)}
|
||||
</p>
|
||||
<TempoSocialLinks footer />
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-t border-white/10">
|
||||
<div className="mx-auto flex max-w-[1440px] flex-col justify-between gap-3 px-5 py-5 text-[11px] tracking-wide text-slate-400 sm:flex-row sm:px-8">
|
||||
<p>
|
||||
© {new Date().getFullYear()}{' '}
|
||||
<span className="text-[#ed1c24]">Tempo</span>.{' '}
|
||||
{t('Todos os direitos reservados.')}
|
||||
</p>
|
||||
<p>{t('Número de registo')}: 13/GABINFO-DE/: 2003</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ChevronDown, CloudSun, Globe, MapPin } from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { useTempoUi } from '@/components/tempo-brand';
|
||||
|
||||
type Weather = { temp: number; description: string; humidity?: number };
|
||||
|
||||
export function TempoWeather() {
|
||||
const { language } = useTempoUi();
|
||||
const [weather, setWeather] = useState<Weather | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), 8000);
|
||||
fetch(`https://teste-info.tempo.co.mz/api/weather?lang=${language}`, {
|
||||
signal: controller.signal,
|
||||
credentials: 'omit',
|
||||
})
|
||||
.then((response) => (response.ok ? response.json() : null))
|
||||
.then((data: { current?: Weather } | null) => {
|
||||
if (data?.current && Number.isFinite(data.current.temp))
|
||||
setWeather(data.current);
|
||||
})
|
||||
.catch(() => {
|
||||
/* No guessed temperatures when the source is unavailable. */
|
||||
})
|
||||
.finally(() => {
|
||||
clearTimeout(timer);
|
||||
setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
controller.abort();
|
||||
};
|
||||
}, [language]);
|
||||
return (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className="tempo-utility-button"
|
||||
aria-label="Temperatura em Maputo"
|
||||
>
|
||||
<CloudSun
|
||||
size={19}
|
||||
aria-hidden="true"
|
||||
className="text-amber-300"
|
||||
/>
|
||||
<span>
|
||||
{weather
|
||||
? `${Math.round(weather.temp)}°C`
|
||||
: loading
|
||||
? '…'
|
||||
: 'Maputo'}
|
||||
</span>
|
||||
<ChevronDown size={12} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
sideOffset={12}
|
||||
className="tempo-dropdown w-60 p-4"
|
||||
>
|
||||
<p className="mb-3 flex items-center gap-2 text-xs font-semibold text-slate-500">
|
||||
<MapPin size={14} /> Maputo, Moçambique
|
||||
</p>
|
||||
{weather ? (
|
||||
<>
|
||||
<p className="text-3xl font-semibold text-slate-950">
|
||||
{Math.round(weather.temp)}°C
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-slate-600">
|
||||
{weather.description}
|
||||
</p>
|
||||
{weather.humidity !== undefined && (
|
||||
<p className="mt-3 text-xs text-slate-500">
|
||||
Humidade: {weather.humidity}%
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p className="text-sm text-slate-600">
|
||||
{loading
|
||||
? 'A consultar a temperatura…'
|
||||
: 'Temperatura temporariamente indisponível.'}
|
||||
</p>
|
||||
)}
|
||||
<p className="mt-3 text-[11px] text-slate-400">
|
||||
Meteorologia · Tempo
|
||||
</p>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
||||
export function TempoLanguageSelector() {
|
||||
const { language, setLanguage } = useTempoUi();
|
||||
return (
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger
|
||||
className="tempo-utility-button"
|
||||
aria-label="Idioma da navegação"
|
||||
>
|
||||
<Globe size={16} aria-hidden="true" />
|
||||
<span className="text-xs font-semibold uppercase">
|
||||
{language}
|
||||
</span>
|
||||
<ChevronDown size={12} aria-hidden="true" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
sideOffset={12}
|
||||
className="tempo-dropdown min-w-44"
|
||||
>
|
||||
<DropdownMenuLabel className="text-xs text-slate-500">
|
||||
Navegação institucional
|
||||
</DropdownMenuLabel>
|
||||
{[
|
||||
['pt', 'Português'],
|
||||
['en', 'English'],
|
||||
['fr', 'Français'],
|
||||
['es', 'Español'],
|
||||
].map(([code, name]) => (
|
||||
<DropdownMenuItem
|
||||
key={code}
|
||||
onSelect={() => setLanguage(code)}
|
||||
className={`tempo-menu-item ${language === code ? 'bg-red-50 text-red-700' : ''}`}
|
||||
>
|
||||
<span className="w-6 text-[10px] font-bold uppercase">
|
||||
{code}
|
||||
</span>
|
||||
{name}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user