.
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-04 15:10:29 +02:00
40 changed files with 1873 additions and 1688 deletions
+6 -1
View File
@@ -11,7 +11,7 @@ import SearchState from '@/components/search-state';
import { useInterestDraft } from '@/hooks/use-interest-draft';
import { createContext, useContext, useRef, useState } from 'react';
import { router } from '@inertiajs/react';
import { PortalMenu } from '@/layouts/portal-navigation';
import { PortalMenu } from '@/components/portal-menu';
import { ProvinceSelect } from '@/components/investment-territory';
import { MATURITY_LEVELS } from '@/lib/investment-maturity';
import CountrySelect, { type Country } from '@/components/country-select';
@@ -971,6 +971,11 @@ export default function PortalInvestidorApp({
router.get('/oportunidades');
}
function handleHeroSearch(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
router.get('/oportunidades', { q: heroQuery.trim() });
}
function handleView(opportunity: Opportunity) {
router.get('/oportunidades/' + encodeURIComponent(opportunity.slug));
}
+13 -11
View File
@@ -1,4 +1,5 @@
import { participationIdentity } from '@/lib/participation-identity';
import { useTempoUi } from '@/components/tempo-brand';
import { Form, Head, usePage } from '@inertiajs/react';
import InputError from '@/components/input-error';
import PasswordInput from '@/components/password-input';
@@ -24,11 +25,12 @@ type Props = {
};
export default function Login({ status, canResetPassword, qaAccount }: Props) {
const { t } = useTempoUi();
// A redirect from another page (e.g. MFA) creates a new Form with empty local errors.
const pageErrors = usePage<{ errors: { email?: string } }>().props.errors;
return (
<>
<Head title="Entrar" />
<Head title={t('Entrar')} />
{qaAccount && (
<aside
@@ -48,9 +50,9 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
{/* @chisel-passkeys */}
<PasskeyVerify
label="Entrar com chave de acesso"
loadingLabel="A autenticar…"
separator="Ou continuar com email"
label={t('Entrar com chave de acesso')}
loadingLabel={t('A autenticar…')}
separator={t('Ou continuar com email')}
/>
{/* @end-chisel-passkeys */}
@@ -85,7 +87,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
<div className="grid gap-2">
<div className="flex items-center">
<Label htmlFor="password">
Palavra-passe
{t('Palavra-passe')}
</Label>
{canResetPassword && (
<TextLink
@@ -93,7 +95,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
className="ml-auto text-sm"
tabIndex={5}
>
Esqueceu a palavra-passe?
{t('Esqueceu a palavra-passe?')}
</TextLink>
)}
</div>
@@ -103,7 +105,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
required
tabIndex={2}
autoComplete="current-password"
placeholder="Palavra-passe"
placeholder={t('Palavra-passe')}
/>
<InputError message={errors.password} />
</div>
@@ -115,7 +117,7 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
tabIndex={3}
/>
<Label htmlFor="remember">
Manter sessão iniciada
{t('Manter sessão iniciada')}
</Label>
</div>
@@ -127,15 +129,15 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
data-test="login-button"
>
{processing && <Spinner />}
Entrar
{t('Entrar')}
</Button>
</div>
{/* @chisel-registration */}
<div className="text-muted-foreground text-center text-sm">
Ainda não tem conta?{' '}
{t('Ainda não tem conta?')}{' '}
<TextLink href={register()} tabIndex={5}>
Criar conta
{t('Criar conta')}
</TextLink>
</div>
{/* @end-chisel-registration */}
+12 -10
View File
@@ -1,4 +1,5 @@
import { participationIdentity } from '@/lib/participation-identity';
import { useTempoUi } from '@/components/tempo-brand';
import { Form, Head } from '@inertiajs/react';
import InputError from '@/components/input-error';
import PasswordInput from '@/components/password-input';
@@ -15,9 +16,10 @@ type Props = {
};
export default function Register({ passwordRules }: Props) {
const { t } = useTempoUi();
return (
<>
<Head title="Criar conta" />
<Head title={t('Criar conta')} />
<Form
{...store.form()}
resetOnSuccess={['password', 'password_confirmation']}
@@ -28,7 +30,7 @@ export default function Register({ passwordRules }: Props) {
<>
<div className="grid gap-6">
<div className="grid gap-2">
<Label htmlFor="name">Nome</Label>
<Label htmlFor="name">{t('Nome')}</Label>
<Input
id="name"
defaultValue={participationIdentity().name}
@@ -37,7 +39,7 @@ export default function Register({ passwordRules }: Props) {
tabIndex={1}
autoComplete="name"
name="name"
placeholder="Nome completo"
placeholder={t('Nome completo')}
/>
<InputError
message={errors.name}
@@ -61,14 +63,14 @@ export default function Register({ passwordRules }: Props) {
</div>
<div className="grid gap-2">
<Label htmlFor="password">Palavra-passe</Label>
<Label htmlFor="password">{t('Palavra-passe')}</Label>
<PasswordInput
id="password"
required
tabIndex={3}
autoComplete="new-password"
name="password"
placeholder="Palavra-passe"
placeholder={t('Palavra-passe')}
passwordrules={passwordRules}
/>
<InputError message={errors.password} />
@@ -76,7 +78,7 @@ export default function Register({ passwordRules }: Props) {
<div className="grid gap-2">
<Label htmlFor="password_confirmation">
Confirmar palavra-passe
{t('Confirmar palavra-passe')}
</Label>
<PasswordInput
id="password_confirmation"
@@ -84,7 +86,7 @@ export default function Register({ passwordRules }: Props) {
tabIndex={4}
autoComplete="new-password"
name="password_confirmation"
placeholder="Confirmar palavra-passe"
placeholder={t('Confirmar palavra-passe')}
passwordrules={passwordRules}
/>
<InputError
@@ -99,14 +101,14 @@ export default function Register({ passwordRules }: Props) {
data-test="register-user-button"
>
{processing && <Spinner />}
Criar conta
{t('Criar conta')}
</Button>
</div>
<div className="text-muted-foreground text-center text-sm">
Já tem conta?{' '}
{t('Já tem conta?')}{' '}
<TextLink href={login()} tabIndex={6}>
Entrar
{t('Entrar')}
</TextLink>
</div>
</>
+1 -1
View File
@@ -1,6 +1,6 @@
import { Head, Link, usePage } from '@inertiajs/react';
import type { ReactNode } from 'react';
import { PortalMenu } from '@/layouts/portal-navigation';
import { PortalMenu } from '@/components/portal-menu';
import { cn } from '@/lib/utils';
import type { TerritorialSourceEvidence } from '@/components/territorial-source-evidence';
import type {
+1 -1
View File
@@ -1,5 +1,5 @@
import { Head, Link } from '@inertiajs/react';
import { PortalMenu } from '@/layouts/portal-navigation';
import { PortalMenu } from '@/components/portal-menu';
import EditorialReading, {
type EditorialArticle,
} from '@/components/editorial-reading';
+1 -1
View File
@@ -1,5 +1,5 @@
import { Head, Link } from '@inertiajs/react';
import { PortalMenu } from '@/layouts/portal-navigation';
import { PortalMenu } from '@/components/portal-menu';
import {
PublicDocumentContent,
type PublicDocument,
+1 -9
View File
@@ -1,15 +1,7 @@
import { Head, Link, router } from '@inertiajs/react';
import { useEffect, useState } from 'react';
import { PortalMenu } from '@/layouts/portal-navigation';
import {
fiscalForms,
fiscalFormFields,
fiscalPreparationIssues,
newFiscalPreparation,
readFiscalPreparation,
type FiscalFormKind,
type FiscalPreparation,
} from '@/lib/fiscal-form-preparation';
import { fiscalForms, fiscalFormFields, fiscalPreparationIssues, newFiscalPreparation, readFiscalPreparation, type FiscalFormKind, type FiscalPreparation } from '@/lib/fiscal-form-preparation';
const input =
'mt-1 block w-full rounded border border-slate-400 bg-white p-3 text-slate-900';
+54
View File
@@ -0,0 +1,54 @@
import { Head, Link } from '@inertiajs/react';
import { useEffect, useState } from 'react';
import { Search as SearchIcon } from 'lucide-react';
type Result = { title: string; description: string | null; url: string; category: string };
type Results = { data: Result[]; total: number; current_page: number; last_page: number; per_page: number; unavailable: string[] };
function pageNumbers(current: number, last: number): (number | string)[] {
const pages = [...new Set([1, last, ...Array.from({ length: 5 }, (_, i) => current - 2 + i)])]
.filter((page) => page >= 1 && page <= last).sort((a, b) => a - b);
return pages.flatMap((page, i) => i > 0 && page - pages[i - 1] > 1 ? [`gap-${page}`, page] : [page]);
}
export default function Search({ query, results }: { query: string; results: Results }) {
const [input, setInput] = useState(query);
useEffect(() => setInput(query), [query]);
const { data, total, current_page: current, last_page: last, per_page: perPage, unavailable } = results;
const pageUrl = (page: number) => `/pesquisa?${new URLSearchParams({ q: query, page: String(page) })}`;
const start = total ? (current - 1) * perPage + 1 : 0;
const end = Math.min(start + data.length - 1, total);
return <main className="min-h-[65vh] bg-white text-[#101820]">
<Head title="Pesquisa" />
<div className="border-b border-slate-200 bg-[#101820] text-white">
<div className="mx-auto max-w-5xl px-4 py-8 sm:px-6">
<h1 className="text-3xl font-bold tracking-tight">Pesquisa no InvesteMoz</h1>
<form action="/pesquisa" role="search" className="mt-5 flex max-w-3xl flex-col gap-2 sm:flex-row">
<label htmlFor="search-query" className="sr-only">Pesquisar no InvesteMoz</label>
<input id="search-query" type="search" name="q" value={input} onChange={(event) => setInput(event.target.value)} maxLength={120} className="min-h-12 min-w-0 flex-1 rounded-lg border border-slate-300 bg-white px-4 text-base text-[#101820] outline-none focus:ring-2 focus:ring-[#ed1c24]" placeholder="Oportunidades, documentos, sectores..." />
<button className="inline-flex min-h-12 items-center justify-center gap-2 rounded-lg bg-[#ed1c24] px-6 font-semibold text-white hover:bg-[#c9141b] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"><SearchIcon size={18} aria-hidden="true" />Pesquisar</button>
</form>
</div>
</div>
<div className="mx-auto max-w-5xl px-4 py-7 sm:px-6">
<p className="max-w-3xl text-sm leading-relaxed text-slate-600">Pesquise por palavras em qualquer ordem. Pode escrever com ou sem acentos. Os documentos são pesquisados pelos seus dados descritivos.</p>
{unavailable.length > 0 && <p role="alert" className="mt-4 rounded-lg border border-amber-400 bg-amber-50 p-3 text-sm">Não foi possível consultar: {unavailable.join(', ')}. Os restantes resultados continuam disponíveis; tente novamente mais tarde.</p>}
{query && <p className="mt-6 text-sm text-slate-600" aria-live="polite">{total > 0 ? `Resultados ${start}–${end} de ${total}` : 'Nenhum resultado nas fontes consultadas'} para “{query}”.</p>}
{query && total === 0 && <p className="mt-4 text-slate-600">Experimente outras palavras ou uma expressão mais curta.</p>}
<ol start={start || 1} className="mt-2 max-w-3xl divide-y divide-slate-200">
{data.map((item) => <li key={`${item.category}:${item.url}`} className="py-5">
<p className="mb-1 text-xs font-semibold uppercase tracking-wide text-slate-600">{item.category}</p>
<Link href={item.url} className="text-lg font-semibold text-[#b5121b] underline-offset-4 hover:underline focus-visible:rounded focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#ed1c24]">{item.title}</Link>
{item.description && <p className="mt-1 line-clamp-3 text-sm leading-relaxed text-slate-600">{item.description}</p>}
</li>)}
</ol>
{last > 1 && <nav className="mt-8 flex flex-wrap items-center gap-2" aria-label="Páginas de resultados">
{current > 1 && <Link href={pageUrl(current - 1)} rel="prev" className="rounded-md px-3 py-2 text-sm font-semibold text-[#b5121b] hover:bg-red-50">Anterior</Link>}
{pageNumbers(current, last).map((page) => typeof page === 'string' ? <span key={page} className="px-1 text-slate-500" aria-hidden="true">…</span> :
<Link key={page} href={pageUrl(page)} aria-label={`Página ${page}`} aria-current={page === current ? 'page' : undefined} className={page === current ? 'rounded-md bg-[#101820] px-3 py-2 text-sm font-bold text-white' : 'rounded-md px-3 py-2 text-sm font-semibold text-[#b5121b] hover:bg-red-50'}>{page}</Link>)}
{current < last && <Link href={pageUrl(current + 1)} rel="next" className="rounded-md px-3 py-2 text-sm font-semibold text-[#b5121b] hover:bg-red-50">Seguinte</Link>}
</nav>}
</div>
</main>;
}
+1 -1
View File
@@ -7,7 +7,7 @@ import {
} from '@/components/public-document-content';
import { Head, Link, useForm, usePage } from '@inertiajs/react';
import { useState } from 'react';
import { PortalMenu } from '@/layouts/portal-navigation';
import { PortalMenu } from '@/components/portal-menu';
import { newSubmissionKey } from '@/lib/portal-api';
import { ProvinceSelect } from '@/components/investment-territory';
import { SimulationForm } from '@/components/simulation-form';