Compare commits

...
33 changed files with 686 additions and 445 deletions
@@ -126,7 +126,7 @@ class PortalServicesController extends Controller
'r.source_url', 'r.language', 'r.version_label', 'r.document_group_id', 'r.territorial_scope', 'r.territory_id', 'r.source_url', 'r.language', 'r.version_label', 'r.document_group_id', 'r.territorial_scope', 'r.territory_id',
'r.source_confirmation', 'r.legal_status', 'r.rights_status', 'r.last_reviewed_at', 'r.last_reviewed_by', 'r.independent_review', 'r.metadata_version', 'r.source_reference', 'r.essential', 'r.source_confirmation', 'r.legal_status', 'r.rights_status', 'r.last_reviewed_at', 'r.last_reviewed_by', 'r.independent_review', 'r.metadata_version', 'r.source_reference', 'r.essential',
'd.file_name', 'd.media_type', 'd.size_bytes', 'd.issuer', 'd.issued_on', 'd.valid_until', 'd.version_no', 'd.file_name', 'd.media_type', 'd.size_bytes', 'd.issuer', 'd.issued_on', 'd.valid_until', 'd.version_no',
])->paginate(5)->withQueryString(); ])->paginate(3)->withQueryString();
$pageResult->getCollection()->transform(fn ($resource) => app(PublicDocumentPresentation::class)->resource($resource)); $pageResult->getCollection()->transform(fn ($resource) => app(PublicDocumentPresentation::class)->resource($resource));
$props['resources'] = $pageResult; $props['resources'] = $pageResult;
app(PublicSearchMetrics::class)->candidate($request, 'documents', $pageResult->total(), $filters); app(PublicSearchMetrics::class)->candidate($request, 'documents', $pageResult->total(), $filters);
+26 -17
View File
@@ -69,10 +69,10 @@
gap: 0.35rem; gap: 0.35rem;
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.25rem; line-height: 1.25rem;
color: #e2e8f0; color: #fff;
transition: transition:
color 0.2s, color 0.3s ease,
transform 0.2s; transform 0.3s ease;
} }
.tempo-footer-link > svg { .tempo-footer-link > svg {
align-self: center; align-self: center;
@@ -80,18 +80,18 @@
flex-shrink: 0; flex-shrink: 0;
} }
.tempo-footer-link:hover { .tempo-footer-link:hover {
color: #fb7185; color: #ef4444;
transform: translateX(3px); transform: translateX(3px);
} }
.tempo-contact-link { .tempo-contact-link {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.75rem; gap: 1rem;
min-height: 40px; min-height: 40px;
transition: color 0.2s; transition: color 0.3s ease;
} }
.tempo-contact-link:hover { .tempo-contact-link:hover {
color: #fb7185; color: #ef4444;
} }
.tempo-contact-icon { .tempo-contact-icon {
display: flex; display: flex;
@@ -100,9 +100,16 @@
flex-shrink: 0; flex-shrink: 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid #ffffff12; border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 0.65rem; border-radius: 0.75rem;
background: #ffffff08; background: rgba(255, 255, 255, 0.03);
transition:
background-color 0.3s ease,
border-color 0.3s ease;
}
.tempo-contact-link:hover .tempo-contact-icon {
background: #dc2626;
border-color: #dc2626;
} }
.tempo-footer-social { .tempo-footer-social {
display: flex; display: flex;
@@ -110,13 +117,15 @@
height: 44px; height: 44px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border: 1px solid #ffffff15; border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 0.65rem; border-radius: 0.75rem;
background: rgba(255, 255, 255, 0.03);
color: #fff; color: #fff;
transition: transition:
color 0.2s, color 0.3s ease,
border-color 0.2s, border-color 0.3s ease,
transform 0.2s; transform 0.3s ease,
background-color 0.3s ease;
} }
.tempo-footer [aria-label='Redes sociais da Revista Tempo'] { .tempo-footer [aria-label='Redes sociais da Revista Tempo'] {
gap: 0.75rem; gap: 0.75rem;
@@ -206,7 +215,7 @@
} }
:root { :root {
--background: oklch(1 0 0); --background: #d8e2db;
--foreground: oklch(0.145 0 0); --foreground: oklch(0.145 0 0);
--card: oklch(1 0 0); --card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0); --card-foreground: oklch(0.145 0 0);
@@ -242,7 +251,7 @@
} }
.dark { .dark {
--background: oklch(0.145 0 0); --background: #0d302a;
--foreground: oklch(0.985 0 0); --foreground: oklch(0.985 0 0);
--card: oklch(0.145 0 0); --card: oklch(0.145 0 0);
--card-foreground: oklch(0.985 0 0); --card-foreground: oklch(0.985 0 0);
+99 -52
View File
@@ -1,21 +1,41 @@
/* Presentation choice for Tempo's 21/10/2026 request: one shared navigation. */ /* Presentation choice for Tempo's 21/10/2026 request: one shared navigation. */
.tempo-header { .tempo-header {
position: sticky; position: fixed;
top: 0; top: 0;
right: 0;
left: 0;
z-index: 40; z-index: 40;
background: #090909; background: rgba(0, 0, 0, 0.95);
color: #fff; color: #fff;
border-bottom: 1px solid #ffffff14; border-bottom: 1px solid transparent;
-webkit-backdrop-filter: blur(12px);
backdrop-filter: blur(12px);
box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
transition: all 0.5s ease;
}
.tempo-header[data-home]:not([data-scrolled]):not([data-expanded]) {
background: transparent;
-webkit-backdrop-filter: none;
backdrop-filter: none;
box-shadow: none;
}
.tempo-header[data-scrolled],
.tempo-header[data-expanded] {
background: rgba(0, 0, 0, 0.95);
-webkit-backdrop-filter: blur(12px);
backdrop-filter: blur(12px);
box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
} }
.tempo-header-inner { .tempo-header-inner {
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr) auto auto;
grid-template-rows: 71px; grid-template-rows: 72px;
align-items: center; align-items: center;
column-gap: 0.5rem; column-gap: 0.5rem;
max-width: 1600px; max-width: 1440px;
margin-inline: auto; margin-inline: auto;
padding-inline: 0.75rem; padding-inline: 0.75rem;
transition: grid-template-rows 0.28s ease;
} }
.tempo-logo-link { .tempo-logo-link {
grid-area: 1 / 1; grid-area: 1 / 1;
@@ -24,6 +44,10 @@
width: 112px; width: 112px;
max-width: 100%; max-width: 100%;
border-radius: 0.25rem; border-radius: 0.25rem;
transition: opacity 0.2s ease;
}
.tempo-logo-link:hover {
opacity: 0.92;
} }
.tempo-header-logo { .tempo-header-logo {
width: 100%; width: 100%;
@@ -45,28 +69,34 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 0.4rem; gap: 0.35rem;
width: 100%; width: 100%;
min-height: 44px; min-height: 40px;
padding: 0.5rem 0.75rem; padding: 0.375rem 0.625rem;
border: 0;
border-radius: 0.5rem; border-radius: 0.5rem;
background: transparent;
color: #e2e8f0; color: #e2e8f0;
font-size: 1rem; font: inherit;
line-height: 1.5; font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600; font-weight: 600;
white-space: nowrap; white-space: nowrap;
cursor: pointer;
appearance: none;
transition: transition:
color 0.2s, color 0.2s ease,
background 0.2s; background-color 0.2s ease,
box-shadow 0.2s ease;
} }
.tempo-nav-trigger:hover, .tempo-nav-trigger:hover,
.tempo-nav-trigger[data-state='open'] { .tempo-nav-trigger[data-state='open'] {
background: #ffffff0d; background: rgba(255, 255, 255, 0.08);
color: #fff; color: #fff;
} }
.tempo-nav-trigger[data-current-group] { .tempo-nav-trigger[data-current-group] {
color: #fff; color: #fff;
background: #ffffff08; background: rgba(255, 255, 255, 0.05);
box-shadow: inset 0 -2px #ed1c24; box-shadow: inset 0 -2px #ed1c24;
} }
.tempo-nav-trigger > svg { .tempo-nav-trigger > svg {
@@ -93,14 +123,18 @@
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.4rem; gap: 0.4rem;
min-height: 44px; min-height: 40px;
padding: 0.4rem; padding: 0.35rem 0.4rem;
border-radius: 0.5rem; border-radius: 0.5rem;
color: #e2e8f0; color: #e2e8f0;
font-size: 0.8125rem; font-size: 0.8125rem;
transition:
background-color 0.2s ease,
color 0.2s ease;
} }
.tempo-utility-button:hover { .tempo-utility-button:hover {
background: #ffffff10; background: rgba(255, 255, 255, 0.08);
color: #fff;
} }
.tempo-header-actions { .tempo-header-actions {
grid-area: 1 / 2; grid-area: 1 / 2;
@@ -112,22 +146,23 @@
.tempo-login-button { .tempo-login-button {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.45rem;
min-height: 44px; min-height: 40px;
padding: 0.5rem 0.625rem; padding: 0.4rem 0.625rem;
border: 1px solid #ffffff40; border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: 0.5rem; border-radius: 0.5rem;
color: #fff; color: #fff;
font-size: 0.875rem; font-size: 0.8125rem;
font-weight: 600; font-weight: 600;
white-space: nowrap; white-space: nowrap;
transition: transition:
background 0.2s, background-color 0.2s ease,
border-color 0.2s; border-color 0.2s ease,
color 0.2s ease;
} }
.tempo-login-button:hover { .tempo-login-button:hover {
background: #ffffff10; background: rgba(255, 255, 255, 0.08);
border-color: #ffffff80; border-color: rgba(255, 255, 255, 0.4);
} }
.tempo-login-button > span { .tempo-login-button > span {
max-width: clamp(2rem, calc(100vw - 18rem), 6rem); max-width: clamp(2rem, calc(100vw - 18rem), 6rem);
@@ -137,14 +172,17 @@
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 44px; width: 40px;
height: 44px; height: 40px;
flex-shrink: 0; flex-shrink: 0;
border-radius: 0.5rem; border-radius: 0.5rem;
color: #e2e8f0; color: #e2e8f0;
transition:
background-color 0.2s ease,
color 0.2s ease;
} }
.tempo-panel-summary:hover { .tempo-panel-summary:hover {
background: #ffffff10; background: rgba(255, 255, 255, 0.08);
color: #fff; color: #fff;
} }
.tempo-panel-count { .tempo-panel-count {
@@ -166,10 +204,10 @@
grid-area: 4 / 1 / auto / -1; grid-area: 4 / 1 / auto / -1;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 0.5rem; gap: 0.45rem;
min-height: 44px; min-height: 40px;
margin-bottom: 1rem; margin-bottom: 0.875rem;
padding: 0.5rem 0.875rem; padding: 0.45rem 0.8rem;
border: 1px solid #ed1c24; border: 1px solid #ed1c24;
border-radius: 0.5rem; border-radius: 0.5rem;
background: #ed1c24; background: #ed1c24;
@@ -177,26 +215,34 @@
font-size: 0.8125rem; font-size: 0.8125rem;
font-weight: 600; font-weight: 600;
white-space: nowrap; white-space: nowrap;
transition: background 0.2s; transition:
background-color 0.2s ease,
border-color 0.2s ease,
transform 0.2s ease;
} }
.tempo-interest-button:hover { .tempo-interest-button:hover {
background: #c9151c; background: #c9151c;
border-color: #c9151c;
} }
.tempo-header-toggle { .tempo-header-toggle {
grid-area: 1 / 3; grid-area: 1 / 3;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 44px; width: 40px;
height: 44px; height: 40px;
border: 1px solid #ffffff33; border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 0.5rem; border-radius: 0.5rem;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
transition:
background-color 0.2s ease,
border-color 0.2s ease;
} }
.tempo-header-toggle:hover, .tempo-header-toggle:hover,
.tempo-header-toggle[aria-expanded='true'] { .tempo-header-toggle[aria-expanded='true'] {
background: #ffffff10; background: rgba(255, 255, 255, 0.08);
border-color: rgba(255, 255, 255, 0.32);
} }
.tempo-header[data-expanded] .tempo-primary-navigation { .tempo-header[data-expanded] .tempo-primary-navigation {
display: block; display: block;
@@ -221,7 +267,7 @@
.tempo-header-inner { .tempo-header-inner {
grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-columns: minmax(0, 1fr) auto auto auto;
column-gap: 0.75rem; column-gap: 0.75rem;
padding-inline: 1.5rem; padding-inline: 1.25rem;
} }
.tempo-logo-link { .tempo-logo-link {
width: 132px; width: 132px;
@@ -237,13 +283,13 @@
} }
@media (min-width: 1280px) { @media (min-width: 1280px) {
.tempo-header-inner { .tempo-header-inner {
grid-template-rows: minmax(71px, auto); grid-template-rows: minmax(72px, auto);
grid-template-columns: auto minmax(0, 1fr) auto auto auto; grid-template-columns: auto minmax(0, 1fr) auto auto auto;
column-gap: 0.25rem; column-gap: 0.375rem;
padding-inline: 1.25rem; padding-inline: 1.25rem;
} }
.tempo-logo-link { .tempo-logo-link {
width: 100px; width: 120px;
} }
.tempo-login-button > span { .tempo-login-button > span {
max-width: 3rem; max-width: 3rem;
@@ -260,13 +306,14 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
gap: 0; gap: 0.125rem;
} }
.tempo-nav-trigger { .tempo-nav-trigger {
justify-content: center; justify-content: center;
padding-inline: 0.25rem; min-height: 40px;
font-size: 1.125rem; padding: 0.375rem 0.5rem;
letter-spacing: 0.025em; font-size: 0.9375rem;
letter-spacing: 0.01em;
} }
.tempo-header-extras, .tempo-header-extras,
.tempo-header[data-expanded] .tempo-header-extras { .tempo-header[data-expanded] .tempo-header-extras {
@@ -274,7 +321,7 @@
grid-area: 1 / 3; grid-area: 1 / 3;
padding: 0 0.5rem 0 0; padding: 0 0.5rem 0 0;
border: 0; border: 0;
border-right: 1px solid #ffffff1a; border-right: 1px solid rgba(255, 255, 255, 0.1);
} }
.tempo-header-utilities { .tempo-header-utilities {
flex-wrap: nowrap; flex-wrap: nowrap;
@@ -291,12 +338,12 @@
} }
@media (min-width: 1440px) { @media (min-width: 1440px) {
.tempo-header-inner { .tempo-header-inner {
column-gap: 0.75rem; column-gap: 0.5rem;
padding-inline: 2rem; padding-inline: 1.5rem;
} }
.tempo-nav-trigger { .tempo-nav-trigger {
padding-inline: 0.375rem; padding-inline: 0.625rem;
font-size: 1.125rem; font-size: 1rem;
} }
.tempo-logo-link { .tempo-logo-link {
width: 132px; width: 132px;
@@ -316,7 +363,7 @@
column-gap: 1rem; column-gap: 1rem;
} }
.tempo-nav-trigger { .tempo-nav-trigger {
padding-inline: 0.75rem; padding-inline: 0.875rem;
} }
.tempo-login-button > span { .tempo-login-button > span {
max-width: 6rem; max-width: 6rem;
@@ -9,6 +9,7 @@ export default function CountrySelect({
label = 'País', label = 'País',
required = false, required = false,
error, error,
className,
}: { }: {
countries: Country[]; countries: Country[];
value: string; value: string;
@@ -19,6 +20,7 @@ export default function CountrySelect({
required?: boolean; required?: boolean;
allowLegacyValue?: boolean; allowLegacyValue?: boolean;
error?: string; error?: string;
className?: string;
}) { }) {
return ( return (
<CatalogueChoiceSelect <CatalogueChoiceSelect
@@ -34,6 +36,7 @@ export default function CountrySelect({
disabled={disabled} disabled={disabled}
required={required} required={required}
error={error} error={error}
className={className}
/> />
); );
} }
+52 -69
View File
@@ -88,11 +88,19 @@ export function PortalGroupedMenu() {
const currentItem = currentNavigationItem(groups, url); const currentItem = currentNavigationItem(groups, url);
const [loggingOut, setLoggingOut] = useState(false); const [loggingOut, setLoggingOut] = useState(false);
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
const [scrolled, setScrolled] = useState(false);
const navigationId = useId(); const navigationId = useId();
const toolsId = useId(); const toolsId = useId();
const interestId = useId(); const interestId = useId();
const toggle = useRef<HTMLButtonElement>(null); const toggle = useRef<HTMLButtonElement>(null);
const isHome = url.split('?')[0] === '/';
useEffect(() => router.on('navigate', () => setExpanded(false)), []); useEffect(() => router.on('navigate', () => setExpanded(false)), []);
useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > 30);
onScroll();
window.addEventListener('scroll', onScroll, { passive: true });
return () => window.removeEventListener('scroll', onScroll);
}, []);
const items = (children: PortalNavItem[]) => const items = (children: PortalNavItem[]) =>
children.map((item) => children.map((item) =>
item.children ? ( item.children ? (
@@ -150,12 +158,15 @@ export function PortalGroupedMenu() {
'administration', 'administration',
].includes(group.id), ].includes(group.id),
); );
const workGroup = groups.find((group) => group.id === 'work');
const institutionalCurrent = url.split('?')[0] === '/contacto'; const institutionalCurrent = url.split('?')[0] === '/contacto';
return ( return (
<header <header
className="tempo-header" className="tempo-header"
lang={language} lang={language}
data-expanded={expanded || undefined} data-expanded={expanded || undefined}
data-scrolled={scrolled || undefined}
data-home={isHome || undefined}
onKeyDown={(event) => { onKeyDown={(event) => {
if ( if (
event.key === 'Escape' && event.key === 'Escape' &&
@@ -265,76 +276,48 @@ export function PortalGroupedMenu() {
</Link> </Link>
</li> </li>
<li> <li>
<DropdownMenu modal={false}> <a
<DropdownMenuTrigger href="https://revista.tempo.co.mz/"
className="tempo-nav-trigger" target="_blank"
data-current-group={ rel="noopener noreferrer"
institutionalCurrent || className="tempo-nav-trigger"
current === 'work' || aria-label={`${t('Revista Tempo')} — ${t('Abre num novo separador')}`}
undefined >
} {t('Revista Tempo')}
> <ArrowUpRight size={14} aria-hidden="true" />
Mais </a>
<ChevronDown size={14} aria-hidden="true" />
</DropdownMenuTrigger>
<DropdownMenuContent
align="start"
sideOffset={12}
collisionPadding={12}
className="tempo-dropdown max-h-[75vh] w-64 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
>
<DropdownMenuItem
asChild
className="tempo-menu-item"
>
<a
href="https://revista.tempo.co.mz/"
target="_blank"
rel="noopener noreferrer"
aria-label={`${t('Revista Tempo')} — ${t('Abre num novo separador')}`}
>
{t('Revista Tempo')}
<ArrowUpRight
size={14}
aria-hidden="true"
/>
</a>
</DropdownMenuItem>
{[['/contacto', 'Contacto']].map(
([href, label]) => (
<DropdownMenuItem
key={href}
asChild
className="tempo-menu-item"
>
<Link
href={href}
aria-current={
url.split('?')[0] ===
href
? 'page'
: undefined
}
>
{t(label)}
</Link>
</DropdownMenuItem>
),
)}
{groups
.filter((group) => group.id === 'work')
.map((group) => (
<Fragment key={group.id}>
<DropdownMenuSeparator />
<DropdownMenuLabel>
{t(group.label)}
</DropdownMenuLabel>
{items(group.children ?? [])}
</Fragment>
))}
</DropdownMenuContent>
</DropdownMenu>
</li> </li>
{workGroup?.children?.length ? (
<li>
<DropdownMenu modal={false}>
<DropdownMenuTrigger
className="tempo-nav-trigger"
data-current-group={
institutionalCurrent ||
current === 'work' ||
undefined
}
>
{t('Mais')}
<ChevronDown
size={14}
aria-hidden="true"
/>
</DropdownMenuTrigger>
<DropdownMenuContent
align="start"
sideOffset={12}
collisionPadding={12}
className="tempo-dropdown max-h-[75vh] w-64 max-w-[calc(100vw-1.5rem)] overflow-y-auto p-2"
>
<DropdownMenuLabel>
{t(workGroup.label)}
</DropdownMenuLabel>
{items(workGroup.children ?? [])}
</DropdownMenuContent>
</DropdownMenu>
</li>
) : null}
</ul> </ul>
</nav> </nav>
<div id={toolsId} className="tempo-header-extras"> <div id={toolsId} className="tempo-header-extras">
+2 -2
View File
@@ -198,11 +198,11 @@ export default function PortalHero({
))} ))}
</div> </div>
<div <div
className="absolute inset-0 -z-10 bg-linear-to-r from-black/75 via-black/65 to-black/60" className="absolute inset-0 -z-10 bg-linear-to-r from-black/38 via-black/22 to-black/28"
aria-hidden="true" aria-hidden="true"
/> />
<div <div
className="absolute inset-x-0 bottom-0 -z-10 h-48 bg-linear-to-t from-black/65 to-transparent" className="absolute inset-x-0 bottom-0 -z-10 h-48 bg-linear-to-t from-black/32 to-transparent"
aria-hidden="true" aria-hidden="true"
/> />
+20 -12
View File
@@ -1,6 +1,6 @@
import PortalProductIdentity from '@/components/portal-product-identity'; import PortalProductIdentity from '@/components/portal-product-identity';
import { Link, usePage } from '@inertiajs/react'; import { Link, usePage } from '@inertiajs/react';
import { ChevronRight, Mail, MapPin, Phone } from 'lucide-react'; import { ChevronRight, Mail, MapPin, MessageSquare, Phone } from 'lucide-react';
import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand'; import { TempoSocialLinks, useTempoUi } from '@/components/tempo-brand';
const navigation = [ const navigation = [
@@ -19,8 +19,8 @@ export function TempoFooter() {
className="tempo-footer border-t border-white/5" className="tempo-footer border-t border-white/5"
lang={language} lang={language}
> >
<div className="mx-auto grid max-w-7xl grid-cols-1 gap-6 px-6 py-6 md:grid-cols-2 lg:grid-cols-5 lg:gap-8 lg:px-12"> <div className="mx-auto grid max-w-7xl grid-cols-1 gap-12 px-6 py-10 md:grid-cols-2 lg:grid-cols-5 lg:gap-16 lg:px-12">
<div className="space-y-4"> <div className="space-y-8">
<Link <Link
href="/" href="/"
aria-label="InvesteMoz — início" aria-label="InvesteMoz — início"
@@ -43,9 +43,9 @@ export function TempoFooter() {
</address> </address>
</div> </div>
</div> </div>
<div className="space-y-4"> <div className="space-y-8">
<h2 className="tempo-footer-heading">{t('Contactos')}</h2> <h2 className="tempo-footer-heading">{t('Contactos')}</h2>
<div className="space-y-2"> <div className="space-y-5">
{[ {[
['+258868010880', '+258 86 801 0880'], ['+258868010880', '+258 86 801 0880'],
['+258833219644', '+258 83 321 9644'], ['+258833219644', '+258 83 321 9644'],
@@ -79,11 +79,19 @@ export function TempoFooter() {
t('Apoio ao investidor')} t('Apoio ao investidor')}
</strong> </strong>
</a> </a>
<Link href="/contacto" className="tempo-contact-link">
<span className="tempo-contact-icon">
<MessageSquare size={16} aria-hidden="true" />
</span>
<strong className="text-sm font-medium">
{t('Contacto')}
</strong>
</Link>
</div> </div>
</div> </div>
<nav aria-label="Navegação do rodapé" className="space-y-4"> <nav aria-label="Navegação do rodapé" className="space-y-8">
<h2 className="tempo-footer-heading">{t('Navegação')}</h2> <h2 className="tempo-footer-heading">{t('Navegação')}</h2>
<ul className="space-y-2"> <ul className="space-y-4">
{navigation.map(([href, label]) => ( {navigation.map(([href, label]) => (
<li key={href}> <li key={href}>
<Link href={href} className="tempo-footer-link"> <Link href={href} className="tempo-footer-link">
@@ -97,9 +105,9 @@ export function TempoFooter() {
))} ))}
</ul> </ul>
</nav> </nav>
<nav aria-label="Informação legal" className="space-y-4"> <nav aria-label="Informação legal" className="space-y-8">
<h2 className="tempo-footer-heading">Legal</h2> <h2 className="tempo-footer-heading">Legal</h2>
<ul className="space-y-2"> <ul className="space-y-4">
{[ {[
[ [
'politica-de-privacidade', 'politica-de-privacidade',
@@ -122,7 +130,7 @@ export function TempoFooter() {
))} ))}
</ul> </ul>
</nav> </nav>
<div className="space-y-4"> <div className="space-y-8">
<h2 className="tempo-footer-heading">Social</h2> <h2 className="tempo-footer-heading">Social</h2>
<p className="text-xs leading-relaxed font-medium text-slate-300"> <p className="text-xs leading-relaxed font-medium text-slate-300">
{t( {t(
@@ -132,8 +140,8 @@ export function TempoFooter() {
<TempoSocialLinks footer /> <TempoSocialLinks footer />
</div> </div>
</div> </div>
<div className="border-t border-white/10 py-1.5"> <div className="border-t border-white/5 bg-black/40 py-2">
<div className="mx-auto flex max-w-7xl flex-col items-center justify-between gap-1 px-6 text-center text-[10px] tracking-[0.1em] text-slate-400 md:flex-row md:text-left md:text-[11px]"> <div className="mx-auto flex max-w-7xl flex-col items-center justify-between gap-6 px-6 text-center text-[10px] tracking-[0.2em] text-white md:flex-row md:text-left md:text-xs">
<p> <p>
© {new Date().getFullYear()}{' '} © {new Date().getFullYear()}{' '}
<span className="text-[#ed1c24]">Tempo</span>.{' '} <span className="text-[#ed1c24]">Tempo</span>.{' '}
@@ -132,6 +132,9 @@ function PortalNavigationContent({ children }: { children: ReactNode }) {
<PortalMenu primary /> <PortalMenu primary />
</div> </div>
} }
{!printable && path !== '/' && (
<div className="h-[72px]" aria-hidden="true" />
)}
{path !== '/' && ( {path !== '/' && (
<nav <nav
aria-label={t('Caminho de navegação')} aria-label={t('Caminho de navegação')}
+306 -241
View File
@@ -96,23 +96,31 @@ function QueryStatus({
function TopBar({ function TopBar({
onNavigate, onNavigate,
requestCount, requestCount,
hideBrand = false,
}: { }: {
onNavigate: (view: View) => void; onNavigate: (view: View) => void;
requestCount: number; requestCount: number;
hideBrand?: boolean;
}) { }) {
return ( return (
<nav <nav
aria-label="Navegação das manifestações" aria-label="Navegação das manifestações"
className="sticky top-0 z-30 border-b border-slate-200 bg-white/95 backdrop-blur" className="sticky top-0 z-30 border-b border-slate-200 bg-white/95 backdrop-blur"
> >
<div className="mx-auto flex max-w-6xl flex-wrap items-center justify-between gap-3 px-5 py-4"> <div
<button className={`mx-auto flex max-w-6xl flex-wrap items-center gap-3 px-5 py-4 ${hideBrand ? 'justify-end' : 'justify-between'}`}
onClick={() => onNavigate('home')} >
className="flex items-baseline gap-1 font-black tracking-tight text-slate-900" {!hideBrand && (
> <button
<span className="text-lg">INVESTE</span> onClick={() => onNavigate('home')}
<span className="text-lg text-emerald-700">Moçambique</span> className="flex items-baseline gap-1 font-black tracking-tight text-slate-900"
</button> >
<span className="text-lg">INVESTE</span>
<span className="text-lg text-emerald-700">
Moçambique
</span>
</button>
)}
<div className="flex items-center gap-3 text-xs text-slate-500"> <div className="flex items-center gap-3 text-xs text-slate-500">
<a href="/investidor/manifestacoes" className="underline"> <a href="/investidor/manifestacoes" className="underline">
@@ -123,12 +131,14 @@ function TopBar({
recebido recebido
{requestCount === 1 ? '' : 's'} {requestCount === 1 ? '' : 's'}
</span> </span>
<button {!hideBrand && (
onClick={() => onNavigate('interest')} <button
className="rounded-lg bg-slate-900 px-4 py-2 text-sm font-bold text-white hover:bg-slate-700" onClick={() => onNavigate('interest')}
> className="rounded-lg bg-slate-900 px-4 py-2 text-sm font-bold text-white hover:bg-slate-700"
Manifestar interesse >
</button> Manifestar interesse
</button>
)}
</div> </div>
</div> </div>
</nav> </nav>
@@ -528,6 +538,9 @@ function OpportunityDetail({
); );
} }
const interestControlClass =
'w-full rounded-xl border border-slate-300 bg-white px-3.5 py-3 text-sm text-slate-900 shadow-sm placeholder:text-slate-400 hover:border-slate-400 focus:border-[#ed1c24] focus:outline-none focus:ring-4 focus:ring-[#ed1c24]/10';
function InterestForm({ function InterestForm({
preselected, preselected,
onSubmitted, onSubmitted,
@@ -660,217 +673,260 @@ function InterestForm({
} }
return ( return (
<section className="mx-auto max-w-xl px-5 py-12"> <section className="mx-auto max-w-4xl px-5 py-10 sm:py-14">
<h1 className="text-3xl font-black text-slate-900"> <div className="overflow-hidden rounded-3xl bg-slate-50 p-5 shadow-xl ring-1 ring-black/5 sm:p-8 lg:p-10">
Manifestar interesse <div className="text-center">
</h1> <h1 className="text-2xl font-bold text-slate-950 sm:text-3xl">
<p className="mt-2 text-slate-600"> Manifestar interesse
Preencha os dados abaixo para que a equipa do portal possa </h1>
analisar o seu interesse e entrar em contacto. <p className="mt-2 text-slate-600">
</p> Preencha os dados abaixo para que a equipa do portal
possa analisar o seu interesse e entrar em contacto.
{preselected && (
<div className="mt-5 rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-900">
Oportunidade seleccionada:{' '}
<strong>{preselected.title}</strong> (
{preselected.reference})
</div>
)}
<form onSubmit={handleSubmit} className="mt-6">
{submitError && (
<p
role="alert"
className="mb-5 rounded-lg bg-red-50 p-3 text-sm text-red-700"
>
{submitError}
</p> </p>
</div>
{preselected && (
<div className="mt-5 rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-900">
Oportunidade seleccionada:{' '}
<strong>{preselected.title}</strong> (
{preselected.reference})
</div>
)} )}
<fieldset disabled={submitting} className="space-y-5">
<Field label="Nome completo" error={errors.name} required>
<input
className="input"
value={form.name}
onChange={(e) => update('name', e.target.value)}
/>
</Field>
<Field label="Email" error={errors.email} required> <form onSubmit={handleSubmit} className="mt-6">
<input {submitError && (
type="email" <p
className="input" role="alert"
value={form.email} className="mb-5 rounded-lg bg-red-50 p-3 text-sm text-red-700"
onChange={(e) => update('email', e.target.value)}
/>
</Field>
<Field label="Telefone" error={errors.phone}>
<input
className="input"
value={form.phone}
onChange={(e) => update('phone', e.target.value)}
/>
</Field>
<Field
label="Tipo de investidor"
error={errors.investorType}
required
>
<select
className="input"
value={form.investorType}
onChange={(e) =>
update('investorType', e.target.value)
}
> >
<option value="">Seleccione</option> {submitError}
<option value="individual">
Investidor individual
</option>
<option value="empresa">Empresa</option>
<option value="fundo">Fundo de investimento</option>
<option value="entidade_publica">
Entidade pública
</option>
<option value="outro">Outro</option>
</select>
</Field>
<Field label="País" error={errors.country}>
<CountrySelect
countries={countries}
label="País do requerente"
value={form.country}
onChange={(value) => update('country', value)}
required
allowLegacyValue
/>
</Field>
<Field
label="País de origem do pedido (opcional)"
error={errors.declared_origin_country_code}
>
<CountrySelect
countries={countries}
label="País de origem do pedido (opcional)"
value={form.declared_origin_country_code ?? ''}
onChange={(value) =>
update('declared_origin_country_code', value)
}
/>
<p className="text-sm">
País de onde apresenta este pedido. Pode ser
diferente do país do requerente.
</p>
</Field>
<Field
label="Sector de interesse"
error={errors.sectorInterest}
required
>
<select
className="input"
value={form.sectorInterest}
onChange={(e) =>
update('sectorInterest', e.target.value)
}
>
<option value="">Seleccione</option>
{form.sectorInterest &&
!sectors.some(
(sector) =>
sector.name === form.sectorInterest,
) && (
<option value={form.sectorInterest}>
{form.sectorInterest}
</option>
)}
{sectors
.flatMap((s) => [
s,
...(s.specializations ?? []).map(
(child) => ({
...s,
slug: child.slug,
name: child.name,
specializations: [],
}),
),
])
.map((s) => (
<option key={s.slug} value={s.name}>
{s.name}
</option>
))}
</select>
</Field>
<Field
label="Faixa de investimento"
error={errors.investmentRange}
>
<select
className="input"
value={form.investmentRange}
onChange={(e) =>
update('investmentRange', e.target.value)
}
>
<option value="">Seleccione</option>
<option value="ate-100000">Até USD 100.000</option>
<option value="100000-500000">
USD 100.000 – 500.000
</option>
<option value="500000-1000000">
USD 500.000 – 1.000.000
</option>
<option value="acima-1000000">
Acima de USD 1.000.000
</option>
</select>
</Field>
<Field label="Mensagem" error={errors.message} required>
<textarea
rows={4}
className="input"
value={form.message}
onChange={(e) => update('message', e.target.value)}
placeholder="Descreva o seu interesse ou a informação pretendida."
/>
</Field>
<label className="flex items-start gap-3 text-sm text-slate-600">
<input
type="checkbox"
checked={form.privacyConsent}
onChange={(e) =>
update('privacyConsent', e.target.checked)
}
className="mt-1"
/>
Aceito que os meus dados sejam usados para efeitos de
contacto e análise da manifestação de interesse.
</label>
{errors.privacyConsent && (
<p className="text-sm text-red-600">
{errors.privacyConsent}
</p> </p>
)} )}
<fieldset
<button disabled={submitting}
type="submit" className="grid gap-5 sm:grid-cols-2"
className="w-full rounded-lg bg-slate-900 py-3 font-bold text-white hover:bg-slate-700"
> >
{submitting <Field
? 'A enviar...' label="Nome completo"
: 'Enviar manifestação de interesse'} error={errors.name}
</button> required
</fieldset> >
</form> <input
className={interestControlClass}
value={form.name}
onChange={(e) => update('name', e.target.value)}
/>
</Field>
<Field label="Email" error={errors.email} required>
<input
type="email"
className={interestControlClass}
value={form.email}
onChange={(e) =>
update('email', e.target.value)
}
/>
</Field>
<Field label="Telefone" error={errors.phone}>
<input
className={interestControlClass}
type="tel"
value={form.phone}
onChange={(e) =>
update('phone', e.target.value)
}
/>
</Field>
<Field
label="Tipo de investidor"
error={errors.investorType}
required
>
<select
className={interestControlClass}
value={form.investorType}
onChange={(e) =>
update('investorType', e.target.value)
}
>
<option value="">Seleccione</option>
<option value="individual">
Investidor individual
</option>
<option value="empresa">Empresa</option>
<option value="fundo">
Fundo de investimento
</option>
<option value="entidade_publica">
Entidade pública
</option>
<option value="outro">Outro</option>
</select>
</Field>
<Field
label="País"
error={errors.country}
required
htmlFor="interest-country"
>
<CountrySelect
countries={countries}
label="País do requerente"
id="interest-country"
className={interestControlClass}
value={form.country}
onChange={(value) => update('country', value)}
required
allowLegacyValue
/>
</Field>
<Field
label="País de origem do pedido (opcional)"
htmlFor="interest-origin-country"
error={errors.declared_origin_country_code}
>
<CountrySelect
countries={countries}
label="País de origem do pedido (opcional)"
id="interest-origin-country"
className={interestControlClass}
value={form.declared_origin_country_code ?? ''}
onChange={(value) =>
update(
'declared_origin_country_code',
value,
)
}
/>
<p className="mt-2 text-sm font-normal text-slate-600">
País de onde apresenta este pedido. Pode ser
diferente do país do requerente.
</p>
</Field>
<Field
label="Sector de interesse"
error={errors.sectorInterest}
required
>
<select
className={interestControlClass}
value={form.sectorInterest}
onChange={(e) =>
update('sectorInterest', e.target.value)
}
>
<option value="">Seleccione</option>
{form.sectorInterest &&
!sectors.some(
(sector) =>
sector.name === form.sectorInterest,
) && (
<option value={form.sectorInterest}>
{form.sectorInterest}
</option>
)}
{sectors
.flatMap((s) => [
s,
...(s.specializations ?? []).map(
(child) => ({
...s,
slug: child.slug,
name: child.name,
specializations: [],
}),
),
])
.map((s) => (
<option key={s.slug} value={s.name}>
{s.name}
</option>
))}
</select>
</Field>
<Field
label="Faixa de investimento"
error={errors.investmentRange}
>
<select
className={interestControlClass}
value={form.investmentRange}
onChange={(e) =>
update('investmentRange', e.target.value)
}
>
<option value="">Seleccione</option>
<option value="ate-100000">
Até USD 100.000
</option>
<option value="100000-500000">
USD 100.000 – 500.000
</option>
<option value="500000-1000000">
USD 500.000 – 1.000.000
</option>
<option value="acima-1000000">
Acima de USD 1.000.000
</option>
</select>
</Field>
<Field
label="Mensagem"
error={errors.message}
required
className="sm:col-span-2"
>
<textarea
rows={4}
className={interestControlClass}
value={form.message}
onChange={(e) =>
update('message', e.target.value)
}
placeholder="Descreva o seu interesse ou a informação pretendida."
/>
</Field>
<label className="flex items-start gap-3 rounded-xl border border-slate-200 bg-white p-4 text-sm leading-6 text-slate-700 sm:col-span-2">
<input
type="checkbox"
checked={form.privacyConsent}
onChange={(e) =>
update('privacyConsent', e.target.checked)
}
className="mt-1.5 accent-[#ed1c24]"
/>
Aceito que os meus dados sejam usados para efeitos
de contacto e análise da manifestação de interesse.
</label>
{errors.privacyConsent && (
<p
role="alert"
className="text-sm text-red-600 sm:col-span-2"
>
{errors.privacyConsent}
</p>
)}
<button
type="submit"
className="w-full rounded-xl bg-[#ed1c24] px-5 py-3 font-bold text-white transition-colors hover:bg-[#c8171e] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ed1c24] disabled:opacity-60 sm:col-span-2"
>
{submitting
? 'A enviar...'
: 'Enviar manifestação de interesse'}
</button>
</fieldset>
</form>
</div>
</section> </section>
); );
} }
@@ -880,22 +936,41 @@ function Field({
required, required,
error, error,
children, children,
htmlFor,
className,
}: { }: {
label: string; label: string;
required?: boolean; required?: boolean;
error?: string; error?: string;
children: ReactNode; children: ReactNode;
htmlFor?: string;
className?: string;
}) { }) {
return ( return (
<div> <div className={className}>
<label className="block text-sm font-semibold text-slate-700"> {htmlFor ? (
<span className="mb-1 block"> <label
htmlFor={htmlFor}
className="mb-1.5 block text-xs font-bold text-slate-800"
>
{label}{' '} {label}{' '}
{required && <span className="text-red-600">*</span>} {required && <span className="text-red-600">*</span>}
</span> </label>
{children} ) : (
</label> <label className="block text-xs font-bold text-slate-800">
{error && <p className="mt-1 text-sm text-red-600">{error}</p>} <span className="mb-1.5 block">
{label}{' '}
{required && <span className="text-red-600">*</span>}
</span>
{children}
</label>
)}
{htmlFor && children}
{error && (
<p role="alert" className="mt-1 text-sm text-red-600">
{error}
</p>
)}
</div> </div>
); );
} }
@@ -983,9 +1058,13 @@ export default function PortalInvestidorApp({
return ( return (
<SectorContext.Provider value={sectors}> <SectorContext.Provider value={sectors}>
<div className="min-h-screen bg-slate-50 font-sans text-slate-900"> <div className="min-h-screen bg-background font-sans text-slate-900">
{view !== 'home' && ( {view !== 'home' && (
<TopBar onNavigate={navigate} requestCount={requestCount} /> <TopBar
onNavigate={navigate}
requestCount={requestCount}
hideBrand={view === 'interest'}
/>
)} )}
<PortalMenu /> <PortalMenu />
<main> <main>
@@ -1234,20 +1313,6 @@ export default function PortalInvestidorApp({
)} )}
</main> </main>
<Footer /> <Footer />
<style>{`
.input {
width: 100%;
border: 1px solid #e2e8f0;
border-radius: 0.5rem;
padding: 0.6rem 0.75rem;
font-size: 0.9rem;
}
.input:focus {
outline: none;
box-shadow: 0 0 0 2px #10b981;
}
`}</style>
</div> </div>
</SectorContext.Provider> </SectorContext.Provider>
); );
+1 -1
View File
@@ -114,7 +114,7 @@ export function Frame({
flash?: { success?: string; warning?: string }; flash?: { success?: string; warning?: string };
}>().props; }>().props;
return ( return (
<div className="min-h-screen bg-slate-50 text-slate-900"> <div className="min-h-screen bg-background text-slate-900">
<Head title={title} /> <Head title={title} />
<PortalMenu /> <PortalMenu />
<main <main
+1 -1
View File
@@ -14,7 +14,7 @@ export default function ManagementAccess({
const action = const action =
'inline-flex rounded-lg bg-slate-900 px-5 py-3 font-medium text-white'; 'inline-flex rounded-lg bg-slate-900 px-5 py-3 font-medium text-white';
return ( return (
<main className="min-h-screen bg-slate-50 px-5 py-12 text-slate-900"> <main className="min-h-screen bg-background px-5 py-12 text-slate-900">
<Head title="Acesso à gestão" /> <Head title="Acesso à gestão" />
<div className="mx-auto max-w-2xl space-y-6"> <div className="mx-auto max-w-2xl space-y-6">
<Link href="/" className="text-emerald-700 underline"> <Link href="/" className="text-emerald-700 underline">
+1 -1
View File
@@ -16,7 +16,7 @@ export default function DocumentPage({
articleUrl?: string | null; articleUrl?: string | null;
}) { }) {
return ( return (
<div className="min-h-screen bg-slate-50 text-slate-900"> <div className="min-h-screen bg-background text-slate-900">
<Head title={resource.title} /> <Head title={resource.title} />
<PortalMenu /> <PortalMenu />
<main className="mx-auto max-w-4xl space-y-6 px-5 py-10"> <main className="mx-auto max-w-4xl space-y-6 px-5 py-10">
+1 -1
View File
@@ -78,7 +78,7 @@ export default function FiscalForms({
// Other tax preparation may still contain unsaved edits. // Other tax preparation may still contain unsaved edits.
} }
return ( return (
<div className="min-h-screen bg-slate-50 text-slate-900"> <div className="min-h-screen bg-background text-slate-900">
<Head title="Preencher formulário fiscal" /> <Head title="Preencher formulário fiscal" />
<div className="print:hidden"> <div className="print:hidden">
<PortalMenu /> <PortalMenu />
@@ -4,7 +4,7 @@ import { Head } from '@inertiajs/react';
export default function InvestmentContexts() { export default function InvestmentContexts() {
return ( return (
<div className="min-h-screen bg-slate-50 text-slate-900"> <div className="min-h-screen bg-background text-slate-900">
<Head title="Contextos de investimento" /> <Head title="Contextos de investimento" />
<main className="mx-auto max-w-6xl min-w-0 space-y-6 px-5 py-10"> <main className="mx-auto max-w-6xl min-w-0 space-y-6 px-5 py-10">
<h1 className="text-3xl font-bold text-[#ed1c24]"> <h1 className="text-3xl font-bold text-[#ed1c24]">
+1 -1
View File
@@ -335,7 +335,7 @@ export default function Search({
const highlight = useMemo(() => buildHighlightRegex(query), [query]); const highlight = useMemo(() => buildHighlightRegex(query), [query]);
return ( return (
<main className="min-h-[65vh] bg-slate-50 text-[#101820]"> <main className="min-h-[65vh] bg-background text-[#101820]">
<Head title="Pesquisa" /> <Head title="Pesquisa" />
<section className="relative overflow-hidden bg-[#101820] text-white"> <section className="relative overflow-hidden bg-[#101820] text-white">
<div <div
+1 -1
View File
@@ -591,7 +591,7 @@ export default function Services(p: Props) {
formTypes.includes(resource.document_type), formTypes.includes(resource.document_type),
) ?? -1; ) ?? -1;
return ( return (
<div className="min-h-screen bg-slate-50 text-slate-900"> <div className="min-h-screen bg-background text-slate-900">
<Head title={title} /> <Head title={title} />
<PortalMenu /> <PortalMenu />
<main className="mx-auto max-w-6xl min-w-0 space-y-8 overflow-x-clip px-5 py-10"> <main className="mx-auto max-w-6xl min-w-0 space-y-8 overflow-x-clip px-5 py-10">
+1 -1
View File
@@ -10,7 +10,7 @@ export default function Welcome() {
return ( return (
<> <>
<Head title="Welcome" /> <Head title="Welcome" />
<div className="flex min-h-screen flex-col items-center bg-[#FDFDFC] p-6 text-[#1b1b18] lg:justify-center lg:p-8 dark:bg-[#0a0a0a]"> <div className="flex min-h-screen flex-col items-center bg-background p-6 text-[#1b1b18] lg:justify-center lg:p-8">
<header className="mb-6 w-full max-w-[335px] text-sm not-has-[nav]:hidden lg:max-w-4xl"> <header className="mb-6 w-full max-w-[335px] text-sm not-has-[nav]:hidden lg:max-w-4xl">
<nav className="flex items-center justify-end gap-4"> <nav className="flex items-center justify-end gap-4">
{auth.user ? ( {auth.user ? (
+3 -3
View File
@@ -19,14 +19,14 @@
})(); })();
</script> </script>
{{-- Inline style to set the HTML background color based on our theme in app.css --}} {{-- Cor de fundo geral definida para o portal --}}
<style> <style>
html { html {
background-color: oklch(1 0 0); background-color: #d8e2db;
} }
html.dark { html.dark {
background-color: oklch(0.145 0 0); background-color: #0d302a;
} }
</style> </style>
+5 -5
View File
@@ -225,7 +225,7 @@ class PortalServicesTest extends TestCase
$this->assertDatabaseCount('portal_resource_links', 20); $this->assertDatabaseCount('portal_resource_links', 20);
} }
public function test_public_document_lists_paginate_five_results_and_preserve_filters(): void public function test_public_document_lists_paginate_three_results_and_preserve_filters(): void
{ {
Storage::fake('local'); Storage::fake('local');
$this->withoutMiddleware(\Illuminate\Routing\Middleware\ThrottleRequests::class); $this->withoutMiddleware(\Illuminate\Routing\Middleware\ThrottleRequests::class);
@@ -254,14 +254,14 @@ class PortalServicesTest extends TestCase
auth()->logout(); auth()->logout();
foreach (['documentos', 'legislacao'] as $path) { foreach (['documentos', 'legislacao'] as $path) {
foreach ([1 => [5, 1, 5], 2 => [5, 6, 10], 3 => [1, 11, 11]] as $number => [$count, $from, $to]) { foreach ([1 => [3, 1, 3], 2 => [3, 4, 6], 3 => [3, 7, 9], 4 => [2, 10, 11]] as $number => [$count, $from, $to]) {
$this->get('/'.$path.'?topic=Investimento&page='.$number)->assertOk()->assertInertia(fn (Assert $page) => $page $this->get('/'.$path.'?topic=Investimento&page='.$number)->assertOk()->assertInertia(fn (Assert $page) => $page
->has('resources.data', $count)->where('resources.total', 11) ->has('resources.data', $count)->where('resources.total', 11)
->where('resources.current_page', $number)->where('resources.last_page', 3) ->where('resources.current_page', $number)->where('resources.last_page', 4)
->where('resources.from', $from)->where('resources.to', $to) ->where('resources.from', $from)->where('resources.to', $to)
->where('resources.data.0.title', sprintf('Pagination QA %02d', $from)) ->where('resources.data.0.title', sprintf('Pagination QA %02d', $from))
->where('resources.prev_page_url', fn ($url) => $number === 1 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number - 1))) ->where('resources.prev_page_url', fn ($url) => $number === 1 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number - 1)))
->where('resources.next_page_url', fn ($url) => $number === 3 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1)))); ->where('resources.next_page_url', fn ($url) => $number === 4 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1))));
} }
$this->get('/'.$path.'?q=Pagination%20QA%2001')->assertOk()->assertInertia(fn (Assert $page) => $page $this->get('/'.$path.'?q=Pagination%20QA%2001')->assertOk()->assertInertia(fn (Assert $page) => $page
->has('resources.data', 1)->where('resources.total', 1)->where('resources.data.0.title', 'Pagination QA 01')); ->has('resources.data', 1)->where('resources.total', 1)->where('resources.data.0.title', 'Pagination QA 01'));
@@ -349,7 +349,7 @@ class PortalServicesTest extends TestCase
'target_key' => 'fiscal.iva.lei_13_2016_rectification_2017', 'review_status' => 'pending', 'applicability' => 'evidence']); 'target_key' => 'fiscal.iva.lei_13_2016_rectification_2017', 'review_status' => 'pending', 'applicability' => 'evidence']);
$this->assertDatabaseHas('audit_events', ['source_system' => 'portal-services', 'entity_type' => 'portal_resources', $this->assertDatabaseHas('audit_events', ['source_system' => 'portal-services', 'entity_type' => 'portal_resources',
'actor_user_id' => $manager->id, 'action' => 'published_under_user_authorization']); 'actor_user_id' => $manager->id, 'action' => 'published_under_user_authorization']);
$this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 4)); $this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 3)->where('resources.total', 4));
$this->get('/documentos?q=22%2F2022')->assertInertia(fn (Assert $page) => $page $this->get('/documentos?q=22%2F2022')->assertInertia(fn (Assert $page) => $page
->has('resources.data', 1)->where('resources.data.0.id', $resourceIds[0])); ->has('resources.data', 1)->where('resources.data.0.id', $resourceIds[0]));
$this->get('/documentos?category=Guia&document_type=legislation')->assertInertia(fn (Assert $page) => $page $this->get('/documentos?category=Guia&document_type=legislation')->assertInertia(fn (Assert $page) => $page
@@ -313,7 +313,7 @@ void test('monthly unit schedules must match the horizon and contain valid quant
}, },
], ],
}), }),
/Quantidade/, /Previs\u00e3o de Vendas \/ Unidades do produto 1, m\u00eas 1: .*tr\u00eas casas decimais/,
); );
assert.throws( assert.throws(
() => () =>
@@ -327,7 +327,7 @@ void test('monthly unit schedules must match the horizon and contain valid quant
}, },
], ],
}), }),
/Quantidade/, /Previs\u00e3o de Vendas \/ Unidades do produto 1, m\u00eas 1: .*tr\u00eas casas decimais/,
); );
}); });
@@ -412,7 +412,7 @@ void test('monthly money schedules cover the horizon and reject invalid amounts'
}, },
], ],
}), }),
/não negativo/, /Este valor n\u00e3o pode ser negativo\./,
); );
assert.throws( assert.throws(
() => () =>
@@ -503,7 +503,7 @@ void test('monthly operating schedules require full horizon, exact cents and cur
periods: 1, periods: 1,
monthlyPayrollExpenseByPeriod: ['-1'], monthlyPayrollExpenseByPeriod: ['-1'],
}), }),
/não negativo/, /Este valor n\u00e3o pode ser negativo\./,
); );
const restored = restoreBusinessPlanSnapshot( const restored = restoreBusinessPlanSnapshot(
serializeBusinessPlanSnapshot({ serializeBusinessPlanSnapshot({
@@ -611,7 +611,7 @@ void test('missing currency, products, invalid numbers and invalid horizons are
assert.throws( assert.throws(
() => () =>
forecastBusinessPlan({ ...assumptions, monthlyCollections: '-10' }), forecastBusinessPlan({ ...assumptions, monthlyCollections: '-10' }),
/não negativo/, /Este valor n\u00e3o pode ser negativo\./,
); );
assert.throws( assert.throws(
() => forecastBusinessPlan({ ...assumptions, periods: 61 }), () => forecastBusinessPlan({ ...assumptions, periods: 61 }),
@@ -1067,7 +1067,7 @@ void test('scheduled collection percentage keeps unpaid invoices in receivables
salesCollectionLagMonths: 0, salesCollectionLagMonths: 0,
salesCollectionPercent: '100.01', salesCollectionPercent: '100.01',
}), }),
/entre 0 e 100/, /Introduza uma percentagem entre 0% e 100%\./,
); );
}); });
@@ -1126,7 +1126,7 @@ void test('sales recovery applies only to overdue invoices and never exceeds ope
salesCollectionLagMonths: 0, salesCollectionLagMonths: 0,
salesRecoverySchedule: [{ month: 1, percent: '100.01' }], salesRecoverySchedule: [{ month: 1, percent: '100.01' }],
}), }),
/entre 0 e 100/, /Introduza uma percentagem entre 0% e 100%\./,
); );
assert.throws( assert.throws(
() => () =>
@@ -1,3 +1,4 @@
import * as issuePresentation from '../../resources/js/lib/financial-issue-presentation.ts';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import test from 'node:test'; import test from 'node:test';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -78,6 +79,20 @@ function editor(initialSnapshot) {
? { SimulationAnnualExample: () => null } ? { SimulationAnnualExample: () => null }
: undefined) ?? : undefined) ??
{ {
'./warning-limits-editor': { WarningLimitsEditor: () => null },
'@/components/supplier-advances': {
SupplierAdvancesEditor: () => null,
},
'@/components/period-investments': {
PeriodInvestmentsEditor: () => null,
},
'@/components/financial-day-terms': {
FinancialDayTerms: () => null,
},
'@/components/startup-asset-requirements': {
StartupAssetRequirements: () => null,
},
'@/lib/financial-issue-presentation': issuePresentation,
react: hooks, react: hooks,
'@/components/currency-select': { CurrencySelect: () => null }, '@/components/currency-select': { CurrencySelect: () => null },
'@/lib/business-financial-plan': business, '@/lib/business-financial-plan': business,
@@ -1,3 +1,4 @@
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -21,7 +22,11 @@ function load(file, mocks = {}) {
).outputText; ).outputText;
const module = { exports: {} }; const module = { exports: {} };
compileFunction(output, ['require', 'module', 'exports'])( compileFunction(output, ['require', 'module', 'exports'])(
(name) => mocks[name] ?? require(name), (name) =>
mocks[name] ??
(name === '@/lib/public-presentation'
? publicPresentation
: require(name)),
module, module,
module.exports, module.exports,
); );
@@ -1,3 +1,4 @@
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -20,7 +21,11 @@ function load(file, mocks) {
).outputText; ).outputText;
const module = { exports: {} }; const module = { exports: {} };
compileFunction(output, ['require', 'module', 'exports'])( compileFunction(output, ['require', 'module', 'exports'])(
(name) => mocks[name] ?? require(name), (name) =>
mocks[name] ??
(name === '@/lib/public-presentation'
? publicPresentation
: require(name)),
module, module,
module.exports, module.exports,
); );
+6 -1
View File
@@ -1,3 +1,4 @@
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -28,7 +29,11 @@ function load(file, mocks) {
).outputText; ).outputText;
const module = { exports: {} }; const module = { exports: {} };
compileFunction(output, ['require', 'module', 'exports'])( compileFunction(output, ['require', 'module', 'exports'])(
(name) => mocks[name] ?? require(name), (name) =>
mocks[name] ??
(name === '@/lib/public-presentation'
? publicPresentation
: require(name)),
module, module,
module.exports, module.exports,
); );
@@ -165,7 +165,11 @@ void test('real table component presents one issue panel while retaining every t
const html = renderToStaticMarkup( const html = renderToStaticMarkup(
React.createElement(module.exports.InvestmentReportTables, { tables }), React.createElement(module.exports.InvestmentReportTables, { tables }),
); );
assert.equal(html.split(message).length - 1, 1); assert.equal(
html.replace(/ data-correction-message="[^"]*"/g, '').split(message)
.length - 1,
1,
);
assert.equal( assert.equal(
(html.match(/aria-label="Dados financeiros a corrigir"/g) ?? []).length, (html.match(/aria-label="Dados financeiros a corrigir"/g) ?? []).length,
1, 1,
@@ -199,7 +203,11 @@ void test('print and Word present the same capital correction only once, without
report.sections.find((s) => s.id === 'finance').tables, report.sections.find((s) => s.id === 'finance').tables,
)[0].message; )[0].message;
const html = await createProjectDossierPrintHtml(report, []); const html = await createProjectDossierPrintHtml(report, []);
assert.equal(html.split(message).length - 1, 1); assert.equal(
html.replace(/ data-correction-message="[^"]*"/g, '').split(message)
.length - 1,
1,
);
const blob = await generateProjectDossierDocx(report, []), const blob = await generateProjectDossierDocx(report, []),
zip = await JSZip.loadAsync( zip = await JSZip.loadAsync(
blob instanceof Blob ? await blob.arrayBuffer() : blob, blob instanceof Blob ? await blob.arrayBuffer() : blob,
+51 -9
View File
@@ -7,14 +7,53 @@ import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server'; import { renderToStaticMarkup } from 'react-dom/server';
import ts from 'typescript'; import ts from 'typescript';
import * as forms from '../../resources/js/lib/fiscal-form-preparation.ts'; import * as forms from '../../resources/js/lib/fiscal-form-preparation.ts';
const require=createRequire(import.meta.url); const require = createRequire(import.meta.url);
const source=fs.readFileSync(new URL('../../resources/js/pages/portal/fiscal-forms.tsx',import.meta.url),'utf8'); const source = fs.readFileSync(
const compiled=ts.transpileModule(source,{compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2022,jsx:ts.JsxEmit.ReactJSX}}).outputText; new URL(
const module={exports:{}}; '../../resources/js/pages/portal/fiscal-forms.tsx',
new Function('require','module','exports',compiled)(name=>name==='@inertiajs/react'?{Head:()=>null,Link:({href,children,...props})=>React.createElement('a',{href,...props},children),router:{on:()=>()=>{}}}:name==='@/components/portal-menu'?{PortalMenu:()=>null}:name==='@/lib/fiscal-form-preparation'?forms:require(name),module,module.exports); import.meta.url,
test('fiscal entry renders labelled editable fields and a guided preparation rather than legislation',()=>{ ),
const html=renderToStaticMarkup(React.createElement(module.exports.default)); 'utf8',
for(const label of ['Identificação e período','Nome ou designação social','NUIT','Período — ano e mês','Conferir e guardar','Guardar ficheiro para continuar','Recuperar ficheiro guardado','Confirmar recuperação']) { );
const compiled = ts.transpileModule(source, {
compilerOptions: {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ES2022,
jsx: ts.JsxEmit.ReactJSX,
},
}).outputText;
const module = { exports: {} };
new Function('require', 'module', 'exports', compiled)(
(name) =>
name === '@inertiajs/react'
? {
Head: () => null,
Link: ({ href, children, ...props }) =>
React.createElement('a', { href, ...props }, children),
router: { on: () => () => {} },
}
: name === '@/components/portal-menu'
? { PortalMenu: () => null }
: name === '@/lib/fiscal-form-preparation'
? forms
: require(name),
module,
module.exports,
);
test('fiscal entry renders labelled editable fields and a guided preparation rather than legislation', () => {
const html = renderToStaticMarkup(
React.createElement(module.exports.default),
);
for (const label of [
'Identificação e período',
'Nome ou designação social',
'NUIT',
'Período — ano e mês',
'Conferir e guardar',
'Guardar ficheiro para continuar',
'Recuperar ficheiro guardado',
'Confirmar recuperação',
]) {
// Confirmation appears only after a compatible file is selected. // Confirmation appears only after a compatible file is selected.
if (label !== 'Confirmar recuperação') if (label !== 'Confirmar recuperação')
assert.ok(html.includes(label), label); assert.ok(html.includes(label), label);
@@ -29,7 +68,10 @@ void test('IRPC entry opens the requested form directly and keeps its partial co
React.createElement(module.exports.default, { initialTax: 'irpc' }), React.createElement(module.exports.default, { initialTax: 'irpc' }),
); );
assert.match(html, /IRPC — Modelo 22/); assert.match(html, /IRPC — Modelo 22/);
assert.match(html, /L8 permanece parcial/); assert.match(
html,
/não há apuramento automático nem confirmação de elegibilidade/,
);
assert.match(html, /303 — Dupla tributação económica/); assert.match(html, /303 — Dupla tributação económica/);
assert.match(html, /304 — Dupla tributação internacional/); assert.match(html, /304 — Dupla tributação internacional/);
assert.match(html, /Não utilize a mesma parcela/); assert.match(html, /Não utilize a mesma parcela/);
@@ -0,0 +1,16 @@
{
"records": {
"moza": {
"id": "53119370-3dcc-4488-b469-80ffcd24ece2"
},
"bci": {
"id": "9ba03e9c-850a-415b-8caa-a7092aa8db25"
},
"standard-bank": {
"id": "1b5f6e6b-4c3e-477a-a847-74803719f8fd"
},
"ac-microbanco": {
"id": "e6c7c1b7-cbf0-4c69-ad4e-0d02f18fa136"
}
}
}
@@ -182,10 +182,7 @@ test('B06 empty results omit institution alternatives and real result links keep
0, 0,
); );
const fixture = JSON.parse( const fixture = JSON.parse(
fs.readFileSync( fs.readFileSync('tests/frontend/fixtures/funding-b03-b06.json', 'utf8'),
'outputs/funding-b03-b06-20261120/fixture.json',
'utf8',
),
); );
const originals = JSON.parse( const originals = JSON.parse(
fs.readFileSync( fs.readFileSync(
@@ -1,3 +1,4 @@
import * as fieldCorrections from '../../resources/js/lib/field-corrections.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -72,6 +73,10 @@ function load(name) {
); );
return module.exports.default; return module.exports.default;
} }
mocks['@/lib/field-corrections'] = fieldCorrections;
mocks['@/components/portal-corrections'] = {
default: load('components/portal-corrections.tsx'),
};
const PortalNavigation = load('layouts/portal-navigation.tsx'), const PortalNavigation = load('layouts/portal-navigation.tsx'),
AppHeaderLayout = load('layouts/app/app-header-layout.tsx'); AppHeaderLayout = load('layouts/app/app-header-layout.tsx');
mocks['@/layouts/app/app-header-layout'] = { default: AppHeaderLayout }; mocks['@/layouts/app/app-header-layout'] = { default: AppHeaderLayout };
@@ -1,3 +1,4 @@
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -46,7 +47,9 @@ compileFunction(
return { TerritoryFields: () => null }; return { TerritoryFields: () => null };
if (name === '../management/shared' || name === './shared') if (name === '../management/shared' || name === './shared')
return shared; return shared;
return require(name); return name === '@/lib/public-presentation'
? publicPresentation
: require(name);
}, },
module, module,
module.exports, module.exports,
+10 -5
View File
@@ -27,7 +27,10 @@ function load(file, mocks = {}) {
return { return {
Link: ({ children, ...props }) => Link: ({ children, ...props }) =>
React.createElement('a', props, children), React.createElement('a', props, children),
usePage: () => ({ url: '/sectores/test', props: { auth: { user: { id: 1 } } } }), usePage: () => ({
url: '/sectores/test',
props: { auth: { user: { id: 1 } } },
}),
}; };
if (id.startsWith('.') || id.startsWith('@/')) { if (id.startsWith('.') || id.startsWith('@/')) {
const base = id.startsWith('@/') const base = id.startsWith('@/')
@@ -111,7 +114,10 @@ test('demographic comparison retains four saved places and requires a province b
test('the real preparation editor opens an own idea with its budget and no mandatory advert or duplicate reference selector', () => { test('the real preparation editor opens an own idea with its budget and no mandatory advert or duplicate reference selector', () => {
const Empty = () => null; const Empty = () => null;
const Editor = load('pages/investor-path/context.tsx', { const Editor = load('pages/investor-path/context.tsx', {
'@/components/investment-step-help': { HelpAtStep: Empty, InvestmentHelpGuide: ({ children }) => children }, '@/components/investment-step-help': {
HelpAtStep: Empty,
InvestmentHelpGuide: ({ children }) => children,
},
'@/pages/investment/shared': { '@/pages/investment/shared': {
Frame: ({ children }) => Frame: ({ children }) =>
React.createElement('main', null, children), React.createElement('main', null, children),
@@ -413,11 +419,10 @@ test('demography shows original latest total, period, projection and decision wa
], ],
}; };
const html = render('components/demographic-evidence.tsx', { evidence }); const html = render('components/demographic-evidence.tsx', { evidence });
assert.match(html, /1 234/); assert.match(html, /1[\u00a0\u202f ]234/);
assert.match(html, /não demonstram procura ou rentabilidade/); assert.match(html, /não demonstram procura ou rentabilidade/);
assert.match(html, /Projecção/); assert.match(html, /Projecção/);
assert.match(html, /SHA256/); assert.doesNotMatch(html, /SHA256|QA\.xlsx|123abc/);
assert.ok(html.indexOf('SHA256') > html.indexOf('<summary'));
assert.doesNotMatch(html, /<details[^>]*\bopen/); assert.doesNotMatch(html, /<details[^>]*\bopen/);
}); });
test('cluster analysis omits empty field blocks but keeps documented evidence and uncertainty', () => { test('cluster analysis omits empty field blocks but keeps documented evidence and uncertainty', () => {
+4 -1
View File
@@ -1,3 +1,4 @@
import * as publicPresentation from '../../resources/js/lib/public-presentation.ts';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -65,7 +66,9 @@ function harness() {
}), }),
), ),
} }
: require(name), : name === '@/lib/public-presentation'
? publicPresentation
: require(name),
module, module,
module.exports, module.exports,
); );
+17 -3
View File
@@ -88,18 +88,32 @@ test('D1: one startup diagnostic across real local and report components; standa
), ),
); );
assert.ok(error.includes('caixa requerida')); assert.ok(error.includes('caixa requerida'));
assert.equal(render().split(error).length - 1, 1); assert.equal(
render()
.replace(/ data-correction-message="[^"]*"/g, '')
.replace(/ data-correction-message="[^"]*"/g, '')
.split(error).length - 1,
1,
);
assert.equal( assert.equal(
renderToStaticMarkup( renderToStaticMarkup(
React.createElement(StartupAssetRequirements, { React.createElement(StartupAssetRequirements, {
plan, plan,
onChange() {}, onChange() {},
}), }),
).split(error).length - 1, )
.replace(/ data-correction-message="[^"]*"/g, '')
.split(error).length - 1,
1, 1,
); );
plan.reportAssumptions.startupExpenses = 'invalid'; plan.reportAssumptions.startupExpenses = 'invalid';
assert.equal(render().split(error).length - 1, 1); assert.equal(
render()
.replace(/ data-correction-message="[^"]*"/g, '')
.replace(/ data-correction-message="[^"]*"/g, '')
.split(error).length - 1,
1,
);
plan.reportSource = 'annual_example'; plan.reportSource = 'annual_example';
assert.equal(presentation.forecastErrorShownInReport(plan, error), false); assert.equal(presentation.forecastErrorShownInReport(plan, error), false);
plan.startupAssetRequirements.cashRequired = '0'; plan.startupAssetRequirements.cashRequired = '0';