fix: validate simulator dates and reconcile QA calculations reports and language
This commit is contained in:
@@ -12,9 +12,9 @@ export default function AppearanceToggleTab({
|
||||
const { appearance, updateAppearance } = useAppearance();
|
||||
|
||||
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
|
||||
{ value: 'light', icon: Sun, label: 'Light' },
|
||||
{ value: 'dark', icon: Moon, label: 'Dark' },
|
||||
{ value: 'system', icon: Monitor, label: 'System' },
|
||||
{ value: 'light', icon: Sun, label: 'Claro' },
|
||||
{ value: 'dark', icon: Moon, label: 'Escuro' },
|
||||
{ value: 'system', icon: Monitor, label: 'Sistema' },
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
@@ -23,14 +23,16 @@ export default function DeleteUser() {
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Delete account"
|
||||
description="Delete your account and all of its resources"
|
||||
title="Eliminar conta"
|
||||
description="Eliminar a sua conta e os recursos associados"
|
||||
/>
|
||||
<div className="space-y-4 rounded-lg border border-red-100 bg-red-50 p-4 dark:border-red-200/10 dark:bg-red-700/10">
|
||||
<div className="relative space-y-0.5 text-red-600 dark:text-red-100">
|
||||
<p className="font-medium">Warning</p>
|
||||
<p className="text-sm">
|
||||
Please proceed with caution, this cannot be undone.
|
||||
{' '}
|
||||
Esta operação é irreversível. Confirme os dados antes de
|
||||
continuar.{' '}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -40,18 +42,20 @@ export default function DeleteUser() {
|
||||
variant="destructive"
|
||||
data-test="delete-user-button"
|
||||
>
|
||||
Delete account
|
||||
{' '}
|
||||
Eliminar conta{' '}
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogTitle>
|
||||
Are you sure you want to delete your account?
|
||||
{' '}
|
||||
Pretende eliminar a sua conta?{' '}
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
Once your account is deleted, all of its resources
|
||||
and data will also be permanently deleted. Please
|
||||
enter your password to confirm you would like to
|
||||
permanently delete your account.
|
||||
{' '}
|
||||
Ao eliminar a conta, os recursos e dados associados
|
||||
também serão eliminados permanentemente. Introduza a
|
||||
sua palavra-passe para confirmar.{' '}
|
||||
</DialogDescription>
|
||||
|
||||
<Form
|
||||
@@ -70,14 +74,15 @@ export default function DeleteUser() {
|
||||
htmlFor="password"
|
||||
className="sr-only"
|
||||
>
|
||||
Password
|
||||
{' '}
|
||||
Palavra-passe{' '}
|
||||
</Label>
|
||||
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
ref={passwordInput}
|
||||
placeholder="Password"
|
||||
placeholder="Palavra-passe"
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
|
||||
@@ -92,7 +97,8 @@ export default function DeleteUser() {
|
||||
resetAndClearErrors()
|
||||
}
|
||||
>
|
||||
Cancel
|
||||
{' '}
|
||||
Cancelar{' '}
|
||||
</Button>
|
||||
</DialogClose>
|
||||
|
||||
@@ -105,7 +111,8 @@ export default function DeleteUser() {
|
||||
type="submit"
|
||||
data-test="confirm-delete-user-button"
|
||||
>
|
||||
Delete account
|
||||
{' '}
|
||||
Eliminar conta{' '}
|
||||
</button>
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -17,9 +17,10 @@ const EmptyState = () => {
|
||||
<div className="bg-muted mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl">
|
||||
<KeyRound className="text-muted-foreground h-7 w-7" />
|
||||
</div>
|
||||
<p className="font-medium">No passkeys yet</p>
|
||||
<p className="font-medium"> Ainda não existem chaves de acesso </p>
|
||||
<p className="text-muted-foreground mt-1 text-sm">
|
||||
Add a passkey to sign in without a password
|
||||
{' '}
|
||||
Adicione uma chave de acesso para entrar sem palavra-passe{' '}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
@@ -47,8 +48,8 @@ export default function ManagePasskeys(props: Props) {
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Passkeys"
|
||||
description="Manage your passkeys for passwordless sign-in"
|
||||
title="Chaves de acesso"
|
||||
description="Gerir as chaves de acesso para entrar sem palavra-passe"
|
||||
/>
|
||||
|
||||
<div className="border-border overflow-hidden rounded-lg border">
|
||||
|
||||
@@ -48,15 +48,15 @@ export default function ManageTwoFactor(props: Props) {
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Two-factor authentication"
|
||||
description="Manage your two-factor authentication settings"
|
||||
title="Autenticação de dois factores"
|
||||
description="Gerir a autenticação de dois factores"
|
||||
/>
|
||||
{twoFactorEnabled ? (
|
||||
<div className="flex flex-col items-start justify-start space-y-4">
|
||||
<p className="text-muted-foreground text-sm">
|
||||
You will be prompted for a secure, random pin during
|
||||
login, which you can retrieve from the TOTP-supported
|
||||
application on your phone.
|
||||
{' '}
|
||||
Ao entrar, será solicitado o código temporário da
|
||||
aplicação autenticadora do seu telefone.{' '}
|
||||
</p>
|
||||
|
||||
<div className="relative inline">
|
||||
@@ -67,7 +67,9 @@ export default function ManageTwoFactor(props: Props) {
|
||||
type="submit"
|
||||
disabled={processing}
|
||||
>
|
||||
Disable 2FA
|
||||
{' '}
|
||||
Desactivar autenticação de dois
|
||||
factores{' '}
|
||||
</Button>
|
||||
)}
|
||||
</Form>
|
||||
@@ -82,17 +84,16 @@ export default function ManageTwoFactor(props: Props) {
|
||||
) : (
|
||||
<div className="flex flex-col items-start justify-start space-y-4">
|
||||
<p className="text-muted-foreground text-sm">
|
||||
When you enable two-factor authentication, you will be
|
||||
prompted for a secure pin during login. This pin can be
|
||||
retrieved from a TOTP-supported application on your
|
||||
phone.
|
||||
{' '}
|
||||
Depois de activar a autenticação de dois factores, use o
|
||||
código temporário da aplicação autenticadora para
|
||||
entrar.{' '}
|
||||
</p>
|
||||
|
||||
<div>
|
||||
{hasSetupData ? (
|
||||
<Button onClick={() => setShowSetupModal(true)}>
|
||||
<ShieldCheck />
|
||||
Continue setup
|
||||
<ShieldCheck /> Continuar configuração{' '}
|
||||
</Button>
|
||||
) : (
|
||||
<Form
|
||||
@@ -101,7 +102,9 @@ export default function ManageTwoFactor(props: Props) {
|
||||
>
|
||||
{({ processing }) => (
|
||||
<Button type="submit" disabled={processing}>
|
||||
Enable 2FA
|
||||
{' '}
|
||||
Activar autenticação de dois
|
||||
factores{' '}
|
||||
</Button>
|
||||
)}
|
||||
</Form>
|
||||
|
||||
@@ -43,13 +43,14 @@ export default function PasskeyItem({ passkey, onDelete }: Props) {
|
||||
)}
|
||||
</div>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Added {passkey.created_at_diff}
|
||||
{' '}
|
||||
Adicionada em {passkey.created_at_diff}
|
||||
{passkey.last_used_at_diff && (
|
||||
<>
|
||||
<span className="text-muted-foreground/50 mx-1">
|
||||
/
|
||||
</span>
|
||||
Last used {passkey.last_used_at_diff}
|
||||
</span>{' '}
|
||||
Última utilização {passkey.last_used_at_diff}
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
@@ -64,19 +65,18 @@ export default function PasskeyItem({ passkey, onDelete }: Props) {
|
||||
className="text-destructive hover:bg-destructive/10 hover:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
<span className="sr-only">Remove</span>
|
||||
<span className="sr-only"> Remover </span>
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogTitle>Remove passkey</DialogTitle>
|
||||
<DialogTitle>Remover chave de acesso</DialogTitle>
|
||||
<DialogDescription>
|
||||
Are you sure you want to remove the "{passkey.name}"
|
||||
passkey? You will no longer be able to use it to sign
|
||||
in.
|
||||
Pretende remover a chave de acesso «{passkey.name}»?
|
||||
Deixará de poder usá-la para entrar.
|
||||
</DialogDescription>
|
||||
<DialogFooter className="gap-2">
|
||||
<DialogClose asChild>
|
||||
<Button variant="secondary">Cancel</Button>
|
||||
<Button variant="secondary"> Cancelar </Button>
|
||||
</DialogClose>
|
||||
<Button
|
||||
variant="destructive"
|
||||
|
||||
@@ -59,7 +59,8 @@ export default function PasskeyRegistration({ onSuccess }: Props) {
|
||||
if (!isSupported) {
|
||||
return (
|
||||
<div className="text-muted-foreground text-sm">
|
||||
Passkeys are not supported in this browser.
|
||||
{' '}
|
||||
Este navegador não suporta chaves de acesso.{' '}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -67,7 +68,8 @@ export default function PasskeyRegistration({ onSuccess }: Props) {
|
||||
if (!showForm) {
|
||||
return (
|
||||
<Button variant="outline" onClick={() => setShowForm(true)}>
|
||||
Add passkey
|
||||
{' '}
|
||||
Adicionar chave de acesso{' '}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -78,18 +80,19 @@ export default function PasskeyRegistration({ onSuccess }: Props) {
|
||||
className="border-border bg-muted/50 space-y-4 rounded-lg border p-4"
|
||||
>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="passkey-name">Passkey name</Label>
|
||||
<Label htmlFor="passkey-name"> Nome da chave de acesso </Label>
|
||||
<Input
|
||||
id="passkey-name"
|
||||
type="text"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
placeholder="e.g., MacBook Pro, iPhone"
|
||||
placeholder="Por exemplo, MacBook Pro ou iPhone"
|
||||
className="border-foreground/20 mt-1 block w-full"
|
||||
autoFocus
|
||||
/>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
A name helps you identify this passkey later.
|
||||
{' '}
|
||||
O nome permite identificar esta chave mais tarde.{' '}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -97,10 +100,11 @@ export default function PasskeyRegistration({ onSuccess }: Props) {
|
||||
|
||||
<div className="flex gap-2">
|
||||
<Button type="submit" disabled={isLoading || !name.trim()}>
|
||||
{isLoading ? 'Registering...' : 'Register passkey'}
|
||||
{isLoading ? 'Registering...' : 'Registar chave de acesso'}
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" onClick={handleCancel}>
|
||||
Cancel
|
||||
{' '}
|
||||
Cancelar{' '}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -51,8 +51,8 @@ export default function PasskeyVerify({
|
||||
>
|
||||
{isLoading ? <Spinner /> : <KeyRound className="h-4 w-4" />}
|
||||
{isLoading
|
||||
? (loadingLabel ?? 'Authenticating...')
|
||||
: (label ?? 'Sign in with a passkey')}
|
||||
? (loadingLabel ?? 'A autenticar…')
|
||||
: (label ?? 'Entrar com uma chave de acesso')}
|
||||
</Button>
|
||||
{error && (
|
||||
<InputError message={error} className="text-center" />
|
||||
@@ -65,7 +65,7 @@ export default function PasskeyVerify({
|
||||
</div>
|
||||
<div className="relative flex justify-center text-xs uppercase">
|
||||
<span className="bg-background text-muted-foreground px-2">
|
||||
{separator ?? 'Or continue with email'}
|
||||
{separator ?? 'Ou continuar com email'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -66,6 +66,7 @@ export function SimulationFiscalStatus({
|
||||
}) {
|
||||
const [parameters, setParameters] = useState<Parameter[]>([]);
|
||||
const [requestState, setRequestState] = useState('idle');
|
||||
const [retry, setRetry] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const apiComponent = component
|
||||
@@ -104,12 +105,14 @@ export function SimulationFiscalStatus({
|
||||
const payload = (await response.json()) as {
|
||||
parameters?: Parameter[];
|
||||
};
|
||||
if (abort.signal.aborted) return;
|
||||
setParameters(
|
||||
Array.isArray(payload.parameters) ? payload.parameters : [],
|
||||
);
|
||||
setRequestState('done');
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
if (abort.signal.aborted) return;
|
||||
if (
|
||||
error instanceof DOMException &&
|
||||
error.name === 'AbortError'
|
||||
@@ -125,6 +128,7 @@ export function SimulationFiscalStatus({
|
||||
periodStart,
|
||||
periodEnd,
|
||||
JSON.stringify(context ?? {}),
|
||||
retry,
|
||||
]);
|
||||
|
||||
const salaryViewMessages: Record<string, string> = {
|
||||
@@ -160,6 +164,16 @@ export function SimulationFiscalStatus({
|
||||
: `Período consultado: ${periodStart} a ${periodEnd}.`}
|
||||
</p>
|
||||
)}
|
||||
{requestState === 'error' &&
|
||||
scenarioMode === 'approved_parameters' && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setRetry((value) => value + 1)}
|
||||
className="rounded border border-amber-900 px-4 py-2 text-amber-950 underline focus-visible:outline-2 focus-visible:outline-offset-2"
|
||||
>
|
||||
Tentar novamente
|
||||
</button>
|
||||
)}
|
||||
{scenarioMode === 'custom_planning' && (
|
||||
<p role="note" className="text-sm">
|
||||
Modo de planeamento separado: pressupostos do utilizador,
|
||||
|
||||
@@ -864,6 +864,10 @@ export function SimulationForm() {
|
||||
const [isCalculating, setIsCalculating] = useState(false);
|
||||
const [hasSaveConflict, setHasSaveConflict] = useState(false);
|
||||
const [result, setResult] = useState<ApiSimulationExecutionV1 | null>(null);
|
||||
const [calculationStale, setCalculationStale] = useState(false);
|
||||
useEffect(() => {
|
||||
if (result) setCalculationStale(false);
|
||||
}, [result]);
|
||||
const arithmeticResult = useMemo(
|
||||
() => readArithmeticSnapshot(result?.result_snapshot),
|
||||
[result],
|
||||
@@ -1039,6 +1043,13 @@ export function SimulationForm() {
|
||||
: (simulationFieldGroups[current.id] ?? []);
|
||||
const fields = fieldsForCurrent.filter(
|
||||
(field) =>
|
||||
!(
|
||||
current.id === 'tax' &&
|
||||
draft.fiscal_scenario_mode === 'custom_planning' &&
|
||||
!['fiscal_scenario_mode', 'base', 'rate', 'reduction'].includes(
|
||||
field.key,
|
||||
)
|
||||
) &&
|
||||
(!field.showWhen || field.showWhen(draft)) &&
|
||||
!(
|
||||
draft.purpose === 'simulate_only' &&
|
||||
@@ -1943,7 +1954,8 @@ export function SimulationForm() {
|
||||
return next;
|
||||
});
|
||||
if (key === 'purpose') setStep(0);
|
||||
if (key !== 'purpose') setResult(null);
|
||||
if (result) setCalculationStale(true);
|
||||
setResult(null);
|
||||
}
|
||||
|
||||
async function clearDraft() {
|
||||
@@ -2274,6 +2286,18 @@ export function SimulationForm() {
|
||||
)
|
||||
setResult(simulation ?? null);
|
||||
if (canSavePersonalData) void loadSimulationHistory();
|
||||
if (simulation?.status === 'completed') {
|
||||
setSaveStatus(
|
||||
'Cálculo concluído. Reveja o resultado e os pressupostos.',
|
||||
);
|
||||
} else if (
|
||||
simulation?.status === 'failed' ||
|
||||
simulation?.status === 'cancelled'
|
||||
) {
|
||||
setSaveStatus(
|
||||
'O cálculo não foi concluído. Os dados introduzidos foram preservados.',
|
||||
);
|
||||
}
|
||||
sessionStorage.removeItem(idempotencyStorageKey);
|
||||
} catch (cause) {
|
||||
setServerError(
|
||||
@@ -2396,6 +2420,16 @@ export function SimulationForm() {
|
||||
aria-labelledby="simulator-step-title"
|
||||
aria-busy={!ready}
|
||||
>
|
||||
{calculationStale && (
|
||||
<p
|
||||
role="status"
|
||||
className="rounded border border-amber-700 bg-amber-50 p-3 text-amber-950"
|
||||
>
|
||||
As entradas foram alteradas. Calcule novamente antes de
|
||||
guardar ou exportar um novo resultado. Os resultados
|
||||
anteriores mantêm-se no histórico.
|
||||
</p>
|
||||
)}
|
||||
{!ready && (
|
||||
<p role="status">
|
||||
A recuperar o rascunho. Aguarde para editar.
|
||||
|
||||
@@ -56,12 +56,14 @@ export default function TwoFactorRecoveryCodes({
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex gap-3">
|
||||
<LockKeyhole className="size-4" aria-hidden="true" />
|
||||
2FA recovery codes
|
||||
<LockKeyhole className="size-4" aria-hidden="true" />{' '}
|
||||
Códigos de recuperação{' '}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Recovery codes let you regain access if you lose your 2FA
|
||||
device. Store them in a secure password manager.
|
||||
{' '}
|
||||
Os códigos de recuperação permitem recuperar o acesso se
|
||||
perder o dispositivo autenticador. Guarde-os num gestor de
|
||||
palavras-passe seguro.{' '}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -76,7 +78,8 @@ export default function TwoFactorRecoveryCodes({
|
||||
className="size-4"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{codesAreVisible ? 'Hide' : 'View'} recovery codes
|
||||
{codesAreVisible ? 'Ocultar' : 'Ver'} códigos de
|
||||
recuperação{' '}
|
||||
</Button>
|
||||
|
||||
{canRegenerateCodes && (
|
||||
@@ -92,7 +95,7 @@ export default function TwoFactorRecoveryCodes({
|
||||
disabled={processing}
|
||||
aria-describedby="regenerate-warning"
|
||||
>
|
||||
<RefreshCw /> Regenerate codes
|
||||
<RefreshCw /> Gerar novos códigos{' '}
|
||||
</Button>
|
||||
)}
|
||||
</Form>
|
||||
@@ -112,7 +115,7 @@ export default function TwoFactorRecoveryCodes({
|
||||
ref={codesSectionRef}
|
||||
className="bg-muted grid gap-1 rounded-lg p-4 font-mono text-sm"
|
||||
role="list"
|
||||
aria-label="Recovery codes"
|
||||
aria-label="Códigos de recuperação"
|
||||
>
|
||||
{recoveryCodesList.length ? (
|
||||
recoveryCodesList.map((code, index) => (
|
||||
@@ -127,7 +130,7 @@ export default function TwoFactorRecoveryCodes({
|
||||
) : (
|
||||
<div
|
||||
className="space-y-2"
|
||||
aria-label="Loading recovery codes"
|
||||
aria-label="A carregar os códigos de recuperação"
|
||||
>
|
||||
{Array.from(
|
||||
{ length: 8 },
|
||||
@@ -145,13 +148,15 @@ export default function TwoFactorRecoveryCodes({
|
||||
|
||||
<div className="text-muted-foreground text-xs select-none">
|
||||
<p id="regenerate-warning">
|
||||
Each recovery code can be used once to
|
||||
access your account and will be removed
|
||||
after use. If you need more, click{' '}
|
||||
{' '}
|
||||
Cada código permite uma única entrada e
|
||||
deixa de ser válido após a utilização.
|
||||
Para obter novos códigos, seleccione{' '}
|
||||
<span className="font-bold">
|
||||
Regenerate codes
|
||||
{' '}
|
||||
Gerar novos códigos{' '}
|
||||
</span>{' '}
|
||||
above.
|
||||
acima.{' '}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -104,7 +104,8 @@ function TwoFactorSetupStep({
|
||||
<div className="relative flex w-full items-center justify-center">
|
||||
<div className="bg-border absolute inset-0 top-1/2 h-px w-full" />
|
||||
<span className="bg-card relative px-2 py-1">
|
||||
or, enter the code manually
|
||||
{' '}
|
||||
ou introduza a chave manualmente{' '}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -210,7 +211,8 @@ function TwoFactorVerificationStep({
|
||||
onClick={onBack}
|
||||
disabled={processing}
|
||||
>
|
||||
Back
|
||||
{' '}
|
||||
Voltar{' '}
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
@@ -219,7 +221,8 @@ function TwoFactorVerificationStep({
|
||||
processing || code.length < OTP_MAX_LENGTH
|
||||
}
|
||||
>
|
||||
Confirm
|
||||
{' '}
|
||||
Confirmar{' '}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -262,27 +265,27 @@ export default function TwoFactorSetupModal({
|
||||
}>(() => {
|
||||
if (twoFactorEnabled) {
|
||||
return {
|
||||
title: 'Two-factor authentication enabled',
|
||||
title: 'Autenticação de dois factores activada',
|
||||
description:
|
||||
'Two-factor authentication is now enabled. Scan the QR code or enter the setup key in your authenticator app.',
|
||||
buttonText: 'Close',
|
||||
'A autenticação de dois factores está activada. Leia o código QR ou introduza a chave na aplicação autenticadora.',
|
||||
buttonText: 'Fechar',
|
||||
};
|
||||
}
|
||||
|
||||
if (showVerificationStep) {
|
||||
return {
|
||||
title: 'Verify authentication code',
|
||||
title: 'Confirmar código de autenticação',
|
||||
description:
|
||||
'Enter the 6-digit code from your authenticator app',
|
||||
buttonText: 'Continue',
|
||||
'Introduza o código de seis dígitos da aplicação autenticadora',
|
||||
buttonText: 'Continuar',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Enable two-factor authentication',
|
||||
title: 'Activar autenticação de dois factores',
|
||||
description:
|
||||
'To finish enabling two-factor authentication, scan the QR code or enter the setup key in your authenticator app',
|
||||
buttonText: 'Continue',
|
||||
'Para concluir a configuração, leia o código QR ou introduza a chave na aplicação autenticadora.',
|
||||
buttonText: 'Continuar',
|
||||
};
|
||||
}, [twoFactorEnabled, showVerificationStep]);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ function DialogContent({
|
||||
{children}
|
||||
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
||||
<XIcon />
|
||||
<span className="sr-only">Close</span>
|
||||
<span className="sr-only"> Fechar </span>
|
||||
</DialogPrimitive.Close>
|
||||
</DialogPrimitive.Content>
|
||||
</DialogPortal>
|
||||
|
||||
@@ -72,7 +72,7 @@ function SheetContent({
|
||||
{children}
|
||||
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
|
||||
<XIcon className="size-4" />
|
||||
<span className="sr-only">Close</span>
|
||||
<span className="sr-only"> Fechar </span>
|
||||
</SheetPrimitive.Close>
|
||||
</SheetPrimitive.Content>
|
||||
</SheetPortal>
|
||||
|
||||
@@ -40,8 +40,7 @@ export function UserMenuContent({ user }: Props) {
|
||||
prefetch
|
||||
onClick={cleanup}
|
||||
>
|
||||
<Settings className="mr-2" />
|
||||
Settings
|
||||
<Settings className="mr-2" /> Definições{' '}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
|
||||
@@ -55,7 +55,10 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => {
|
||||
|
||||
setQrCodeSvg(svg);
|
||||
} catch {
|
||||
setErrors((prev) => [...prev, 'Failed to fetch QR code']);
|
||||
setErrors((prev) => [
|
||||
...prev,
|
||||
'Não foi possível carregar o código QR.',
|
||||
]);
|
||||
setQrCodeSvg(null);
|
||||
}
|
||||
}, [submit]);
|
||||
@@ -68,7 +71,10 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => {
|
||||
|
||||
setManualSetupKey(key);
|
||||
} catch {
|
||||
setErrors((prev) => [...prev, 'Failed to fetch a setup key']);
|
||||
setErrors((prev) => [
|
||||
...prev,
|
||||
'Não foi possível carregar a chave de configuração.',
|
||||
]);
|
||||
setManualSetupKey(null);
|
||||
}
|
||||
}, [submit]);
|
||||
@@ -79,7 +85,10 @@ export const useTwoFactorAuth = (): UseTwoFactorAuthReturn => {
|
||||
const codes = (await submit(recoveryCodes())) as string[];
|
||||
setRecoveryCodesList(codes);
|
||||
} catch {
|
||||
setErrors((prev) => [...prev, 'Failed to fetch recovery codes']);
|
||||
setErrors((prev) => [
|
||||
...prev,
|
||||
'Não foi possível carregar os códigos de recuperação.',
|
||||
]);
|
||||
setRecoveryCodesList([]);
|
||||
}
|
||||
}, [submit]);
|
||||
|
||||
@@ -12,17 +12,17 @@ import type { NavItem } from '@/types';
|
||||
|
||||
const sidebarNavItems: NavItem[] = [
|
||||
{
|
||||
title: 'Profile',
|
||||
title: 'Perfil',
|
||||
href: edit(),
|
||||
icon: null,
|
||||
},
|
||||
{
|
||||
title: 'Security',
|
||||
title: 'Segurança',
|
||||
href: editSecurity(),
|
||||
icon: null,
|
||||
},
|
||||
{
|
||||
title: 'Appearance',
|
||||
title: 'Aparência',
|
||||
href: editAppearance(),
|
||||
icon: null,
|
||||
},
|
||||
@@ -34,15 +34,15 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<div className="px-4 py-6">
|
||||
<Heading
|
||||
title="Settings"
|
||||
description="Manage your profile and account settings"
|
||||
title="Definições"
|
||||
description="Gerir o perfil e as definições da conta"
|
||||
/>
|
||||
|
||||
<div className="flex flex-col lg:flex-row lg:space-x-12">
|
||||
<aside className="w-full max-w-xl lg:w-48">
|
||||
<nav
|
||||
className="flex flex-col space-y-1 space-x-0"
|
||||
aria-label="Settings"
|
||||
aria-label="Definições"
|
||||
>
|
||||
{sidebarNavItems.map((item, index) => (
|
||||
<Button
|
||||
|
||||
@@ -398,6 +398,15 @@ export async function generateProjectDossierDocx(
|
||||
];
|
||||
for (const section of model.sections) {
|
||||
if (section.id === 'annexes') {
|
||||
if (!attachments.some((item) => item.include)) {
|
||||
children.push(
|
||||
new Paragraph({
|
||||
text: 'Anexos: não foram seleccionados ficheiros.',
|
||||
spacing: { before: 80, after: 80 },
|
||||
}),
|
||||
);
|
||||
continue;
|
||||
}
|
||||
children.push(
|
||||
new Paragraph({
|
||||
text: section.title,
|
||||
@@ -447,7 +456,10 @@ export async function generateProjectDossierDocx(
|
||||
alignment: AlignmentType.RIGHT,
|
||||
children: [
|
||||
new TextRun({
|
||||
text: 'InvesteMoz · '+model.title.slice(0, 60)+' · privado · página ',
|
||||
text:
|
||||
'InvesteMoz · ' +
|
||||
model.title.slice(0, 60) +
|
||||
' · privado · página ',
|
||||
size: 18,
|
||||
}),
|
||||
new SimpleField('PAGE'),
|
||||
@@ -580,6 +592,13 @@ export async function createProjectDossierPrintHtml(
|
||||
): Promise<string> {
|
||||
const content: string[] = [];
|
||||
for (const section of model.sections) {
|
||||
if (
|
||||
section.id === 'annexes' &&
|
||||
!attachments.some((item) => item.include)
|
||||
) {
|
||||
content.push('<p>Anexos: não foram seleccionados ficheiros.</p>');
|
||||
continue;
|
||||
}
|
||||
content.push(`<section><h2>${escapeHtml(section.title)}</h2>`);
|
||||
for (const paragraph of section.paragraphs)
|
||||
content.push(`<p>${escapeHtml(paragraph)}</p>`);
|
||||
|
||||
@@ -111,29 +111,57 @@ function classification(origin: string): string {
|
||||
return 'Referência/estado indicado';
|
||||
}
|
||||
|
||||
export function formatDossierReportValue(field: string, value: string, currency = ''): string {
|
||||
export function formatDossierReportValue(
|
||||
field: string,
|
||||
value: string,
|
||||
currency = '',
|
||||
): string {
|
||||
if (field === 'Estado do plano detalhado') {
|
||||
return value.replace('Snapshot versionado disponível; usar também a exportação do plano financeiro', 'Plano guardado disponível; consulte também a exportação financeira');
|
||||
return value.replace(
|
||||
'Snapshot versionado disponível; usar também a exportação do plano financeiro',
|
||||
'Plano guardado disponível; consulte também a exportação financeira',
|
||||
);
|
||||
}
|
||||
if (field === 'Reconciliação do financiamento') {
|
||||
const states: Record<string, string> = { shortfall: 'Financiamento insuficiente', surplus: 'Fontes superiores aos usos previstos', balanced: 'Fontes e usos equilibrados', unknown: 'Informação insuficiente', incomplete: 'Informação insuficiente' };
|
||||
const states: Record<string, string> = {
|
||||
shortfall: 'Financiamento insuficiente',
|
||||
surplus: 'Fontes superiores aos usos previstos',
|
||||
balanced: 'Fontes e usos equilibrados',
|
||||
unknown: 'Informação insuficiente',
|
||||
incomplete: 'Informação insuficiente',
|
||||
};
|
||||
return states[value] ?? value;
|
||||
}
|
||||
if (/^Necessidade \d+$/.test(field)) {
|
||||
value = value.replace('; gap;', '; Competência em falta;').replace('; unknown;', '; Por confirmar;').replace('; available;', '; Disponível (declarado);');
|
||||
value = value
|
||||
.replace('; gap;', '; Competência em falta;')
|
||||
.replace('; unknown;', '; Por confirmar;')
|
||||
.replace('; available;', '; Disponível (declarado);');
|
||||
}
|
||||
if (/^Marco \d+$/.test(field)) {
|
||||
value = value.replace('; planned;', '; Planeado;').replace('; in_progress;', '; Em curso;').replace('; completed;', '; Concluído (declarado);');
|
||||
value = value
|
||||
.replace('; planned;', '; Planeado;')
|
||||
.replace('; in_progress;', '; Em curso;')
|
||||
.replace('; completed;', '; Concluído (declarado);');
|
||||
}
|
||||
if (/^(Necessidade|Marco) \d+$/.test(field)) {
|
||||
value = value.replace(/(custo|planeado|realizado): ([^;]*)(?=;|$)/g, (_, label: string, amount: string) => {
|
||||
const raw = amount.trim();
|
||||
return `${label}: ${raw ? (/^\d+(?:\.\d{1,2})?$/.test(raw) ? `${raw} ${currency || '(moeda não informada)'}` : raw) : 'Não informado'}`;
|
||||
}).replace(/prazo: (?=;|$)/g, 'prazo: Não informado');
|
||||
value = value
|
||||
.replace(
|
||||
/(custo|planeado|realizado): ([^;]*)(?=;|$)/g,
|
||||
(_, label: string, amount: string) => {
|
||||
const raw = amount.trim();
|
||||
return `${label}: ${raw ? (/^\d+(?:\.\d{1,2})?$/.test(raw) ? `${raw} ${currency || '(moeda não informada)'}` : raw) : 'Não informado'}`;
|
||||
},
|
||||
)
|
||||
.replace(/prazo: (?=;|$)/g, 'prazo: Não informado');
|
||||
}
|
||||
// Presentation only: group the decimal string without converting the amount
|
||||
// to a JavaScript float or changing the saved financial snapshot.
|
||||
return value.replace(/^(-?)(\d+)\.(\d{2}) ([A-Z]{3})$/, (_, sign: string, whole: string, cents: string, currency: string) => `${sign}${whole.replace(/\B(?=(\d{3})+(?!\d))/g, ' ')},${cents} ${currency}`);
|
||||
return value.replace(
|
||||
/^(-?)(\d+)\.(\d{2}) ([A-Z]{3})$/,
|
||||
(_, sign: string, whole: string, cents: string, currency: string) =>
|
||||
`${sign}${whole.replace(/\B(?=(\d{3})+(?!\d))/g, ' ')},${cents} ${currency}`,
|
||||
);
|
||||
}
|
||||
const rowSection: Record<string, DossierReportSectionId> = {
|
||||
Projecto: 'project',
|
||||
@@ -214,6 +242,32 @@ function makeSections(
|
||||
classification: 'Referência da revisão',
|
||||
},
|
||||
);
|
||||
const highlights = new Set([
|
||||
'Saldo operacional estimado',
|
||||
'Diferença por financiar',
|
||||
'Prestação do primeiro período',
|
||||
]);
|
||||
const budgetPeriod = rows.find(
|
||||
(row) => row[1] === 'Periodicidade do orçamento',
|
||||
)?.[2];
|
||||
for (const [, field, value, origin] of rows.slice(1)) {
|
||||
if (!highlights.has(field)) continue;
|
||||
summary.rows.push({
|
||||
field:
|
||||
field === 'Saldo operacional estimado' && budgetPeriod
|
||||
? `${field} — ${budgetPeriod}`
|
||||
: field,
|
||||
value: absent(
|
||||
formatDossierReportValue(
|
||||
field,
|
||||
value,
|
||||
text(draft, 'currency'),
|
||||
),
|
||||
),
|
||||
origin,
|
||||
classification: classification(origin),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const [sectionName, field, value, origin] of rows.slice(1)) {
|
||||
@@ -226,9 +280,14 @@ function makeSections(
|
||||
if (!section) continue;
|
||||
section.rows.push({
|
||||
field,
|
||||
value: absent(formatDossierReportValue(field, value, text(draft, 'currency'))),
|
||||
value: absent(
|
||||
formatDossierReportValue(field, value, text(draft, 'currency')),
|
||||
),
|
||||
origin,
|
||||
classification: value.trim() === '' ? 'Informação em falta' : classification(origin),
|
||||
classification:
|
||||
value.trim() === ''
|
||||
? 'Informação em falta'
|
||||
: classification(origin),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1544,6 +1544,10 @@ export function validateSimulationDraft(
|
||||
draft: SimulationDraft,
|
||||
sectionId: string,
|
||||
): Record<string, string> {
|
||||
// The separate arithmetic validator checks its three inputs. Fiscal
|
||||
// eligibility facts are not inputs of this planning-only calculation.
|
||||
if (sectionId === 'tax' && draft.fiscal_scenario_mode === 'custom_planning')
|
||||
return {};
|
||||
const errors: Record<string, string> = {};
|
||||
for (const field of simulationFieldGroups[sectionId] ?? []) {
|
||||
if (field.showWhen && !field.showWhen(draft)) continue;
|
||||
@@ -1594,6 +1598,15 @@ export function validateSimulationDraft(
|
||||
errors[field.key] =
|
||||
'Introduza um endereço de correio electrónico válido.';
|
||||
}
|
||||
if (
|
||||
sectionId === 'tax' &&
|
||||
draft.fiscal_scenario_mode === 'approved_parameters' &&
|
||||
draft.fiscal_periodicity === 'one_off' &&
|
||||
!getFiscalPeriodRange(draft)
|
||||
) {
|
||||
errors.fiscal_reference_date =
|
||||
'Introduza uma data válida da operação no ano fiscal seleccionado. Não foi usada uma data alternativa.';
|
||||
}
|
||||
if (
|
||||
sectionId === 'financial' &&
|
||||
[
|
||||
|
||||
@@ -12,7 +12,7 @@ import { email } from '@/routes/password';
|
||||
export default function ForgotPassword({ status }: { status?: string }) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Forgot password" />
|
||||
<Head title="Recuperar palavra-passe" />
|
||||
|
||||
{status && (
|
||||
<div className="mb-4 text-center text-sm font-medium text-green-600">
|
||||
@@ -25,7 +25,10 @@ export default function ForgotPassword({ status }: { status?: string }) {
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Label htmlFor="email">
|
||||
{' '}
|
||||
Endereço de correio electrónico{' '}
|
||||
</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
@@ -46,8 +49,8 @@ export default function ForgotPassword({ status }: { status?: string }) {
|
||||
>
|
||||
{processing && (
|
||||
<LoaderCircle className="h-4 w-4 animate-spin" />
|
||||
)}
|
||||
Email password reset link
|
||||
)}{' '}
|
||||
Enviar ligação de recuperação{' '}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
@@ -64,6 +67,7 @@ export default function ForgotPassword({ status }: { status?: string }) {
|
||||
}
|
||||
|
||||
ForgotPassword.layout = {
|
||||
title: 'Forgot password',
|
||||
description: 'Enter your email to receive a password reset link',
|
||||
title: 'Recuperar palavra-passe',
|
||||
description:
|
||||
'Indique o seu email para receber a ligação de recuperação da palavra-passe',
|
||||
};
|
||||
|
||||
@@ -39,15 +39,19 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
Ambiente QA — conta {qaAccount.id}
|
||||
</p>
|
||||
<p>
|
||||
Para os cenários A/B: {qaAccount.email}. Use a password
|
||||
e o autenticador desta conta. Outros perfis devem usar
|
||||
as respetivas contas sintéticas QA.
|
||||
Para os cenários A/B: {qaAccount.email}. Use a
|
||||
palavra-passe e o autenticador desta conta. Outros
|
||||
perfis devem usar as respetivas contas sintéticas QA.
|
||||
</p>
|
||||
</aside>
|
||||
)}
|
||||
|
||||
{/* @chisel-passkeys */}
|
||||
<PasskeyVerify label="Entrar com chave de acesso" loadingLabel="A autenticar…" separator="Ou continuar com email" />
|
||||
<PasskeyVerify
|
||||
label="Entrar com chave de acesso"
|
||||
loadingLabel="A autenticar…"
|
||||
separator="Ou continuar com email"
|
||||
/>
|
||||
{/* @end-chisel-passkeys */}
|
||||
|
||||
<Form
|
||||
@@ -68,7 +72,10 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
tabIndex={1}
|
||||
autoComplete="email"
|
||||
placeholder="email@example.com"
|
||||
defaultValue={qaAccount?.email ?? participationIdentity().email}
|
||||
defaultValue={
|
||||
qaAccount?.email ??
|
||||
participationIdentity().email
|
||||
}
|
||||
/>
|
||||
<InputError
|
||||
message={errors.email ?? pageErrors.email}
|
||||
@@ -77,7 +84,9 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center">
|
||||
<Label htmlFor="password">Palavra-passe</Label>
|
||||
<Label htmlFor="password">
|
||||
Palavra-passe
|
||||
</Label>
|
||||
{canResetPassword && (
|
||||
<TextLink
|
||||
href={request()}
|
||||
@@ -105,7 +114,9 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
name="remember"
|
||||
tabIndex={3}
|
||||
/>
|
||||
<Label htmlFor="remember">Manter sessão iniciada</Label>
|
||||
<Label htmlFor="remember">
|
||||
Manter sessão iniciada
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@@ -143,5 +154,6 @@ export default function Login({ status, canResetPassword, qaAccount }: Props) {
|
||||
|
||||
Login.layout = {
|
||||
title: 'Entrar na sua conta',
|
||||
description: 'Entre para continuar a operação que escolheu. Os dados preenchidos permanecem guardados neste navegador.',
|
||||
description:
|
||||
'Entre para continuar a operação que escolheu. Os dados preenchidos permanecem guardados neste navegador.',
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ type Props = {
|
||||
export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Reset password" />
|
||||
<Head title="Redefinir palavra-passe" />
|
||||
|
||||
<Form
|
||||
{...update.form()}
|
||||
@@ -43,14 +43,14 @@ export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Label htmlFor="password"> Palavra-passe </Label>
|
||||
<PasswordInput
|
||||
id="password"
|
||||
name="password"
|
||||
autoComplete="new-password"
|
||||
className="mt-1 block w-full"
|
||||
autoFocus
|
||||
placeholder="Password"
|
||||
placeholder="Palavra-passe"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError message={errors.password} />
|
||||
@@ -58,14 +58,15 @@ export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password_confirmation">
|
||||
Confirm password
|
||||
{' '}
|
||||
Confirmar palavra-passe{' '}
|
||||
</Label>
|
||||
<PasswordInput
|
||||
id="password_confirmation"
|
||||
name="password_confirmation"
|
||||
autoComplete="new-password"
|
||||
className="mt-1 block w-full"
|
||||
placeholder="Confirm password"
|
||||
placeholder="Confirmar palavra-passe"
|
||||
passwordrules={passwordRules}
|
||||
/>
|
||||
<InputError
|
||||
@@ -80,8 +81,8 @@ export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
disabled={processing}
|
||||
data-test="reset-password-button"
|
||||
>
|
||||
{processing && <Spinner />}
|
||||
Reset password
|
||||
{processing && <Spinner />} Redefinir
|
||||
palavra-passe{' '}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -91,6 +92,6 @@ export default function ResetPassword({ token, email, passwordRules }: Props) {
|
||||
}
|
||||
|
||||
ResetPassword.layout = {
|
||||
title: 'Reset password',
|
||||
description: 'Please enter your new password below',
|
||||
title: 'Redefinir palavra-passe',
|
||||
description: 'Introduza a nova palavra-passe',
|
||||
};
|
||||
|
||||
@@ -27,18 +27,18 @@ export default function TwoFactorChallenge({
|
||||
}>(() => {
|
||||
if (showRecoveryInput) {
|
||||
return {
|
||||
title: 'Recovery code',
|
||||
title: 'Código de recuperação',
|
||||
description:
|
||||
'Please confirm access to your account by entering one of your emergency recovery codes.',
|
||||
toggleText: 'login using an authentication code',
|
||||
'Confirme o acesso à conta com um dos seus códigos de recuperação.',
|
||||
toggleText: 'entrar com um código de autenticação',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: 'Authentication code',
|
||||
title: 'Código de autenticação',
|
||||
description:
|
||||
'Enter the authentication code provided by your authenticator application.',
|
||||
toggleText: 'login using a recovery code',
|
||||
'Introduza o código apresentado pela sua aplicação autenticadora.',
|
||||
toggleText: 'entrar com um código de recuperação',
|
||||
};
|
||||
}, [showRecoveryInput]);
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function TwoFactorChallenge({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Two-factor authentication" />
|
||||
<Head title="Autenticação de dois factores" />
|
||||
|
||||
{qaAccount && (
|
||||
<p
|
||||
@@ -81,7 +81,7 @@ export default function TwoFactorChallenge({
|
||||
<Input
|
||||
name="recovery_code"
|
||||
type="text"
|
||||
placeholder="Enter recovery code"
|
||||
placeholder="Introduza um código de recuperação"
|
||||
autoFocus={showRecoveryInput}
|
||||
required
|
||||
/>
|
||||
@@ -123,7 +123,8 @@ export default function TwoFactorChallenge({
|
||||
className="w-full"
|
||||
disabled={processing}
|
||||
>
|
||||
Continue
|
||||
{' '}
|
||||
Continuar{' '}
|
||||
</Button>
|
||||
|
||||
<div className="text-muted-foreground text-center text-sm">
|
||||
|
||||
@@ -9,12 +9,13 @@ import { send } from '@/routes/verification';
|
||||
export default function VerifyEmail({ status }: { status?: string }) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Email verification" />
|
||||
<Head title="Confirmação de email" />
|
||||
|
||||
{status === 'verification-link-sent' && (
|
||||
<div className="mb-4 text-center text-sm font-medium text-green-600">
|
||||
A new verification link has been sent to the email address
|
||||
you provided during registration.
|
||||
{' '}
|
||||
Foi enviada uma nova ligação de confirmação para o email
|
||||
indicado no registo.{' '}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -22,15 +23,16 @@ export default function VerifyEmail({ status }: { status?: string }) {
|
||||
{({ processing }) => (
|
||||
<>
|
||||
<Button disabled={processing} variant="secondary">
|
||||
{processing && <Spinner />}
|
||||
Resend verification email
|
||||
{processing && <Spinner />} Reenviar email de
|
||||
confirmação{' '}
|
||||
</Button>
|
||||
|
||||
<TextLink
|
||||
href={logout()}
|
||||
className="mx-auto block text-sm"
|
||||
>
|
||||
Log out
|
||||
{' '}
|
||||
Terminar sessão{' '}
|
||||
</TextLink>
|
||||
</>
|
||||
)}
|
||||
@@ -40,7 +42,6 @@ export default function VerifyEmail({ status }: { status?: string }) {
|
||||
}
|
||||
|
||||
VerifyEmail.layout = {
|
||||
title: 'Email verification',
|
||||
description:
|
||||
'Please verify your email address by clicking on the link we just emailed to you.',
|
||||
title: 'Confirmação de email',
|
||||
description: 'Confirme o seu email através da ligação que enviámos.',
|
||||
};
|
||||
|
||||
@@ -419,6 +419,9 @@ function PartnershipForm() {
|
||||
}
|
||||
|
||||
function Simulator() {
|
||||
const page = usePage<{ auth: { user: { id: number } | null } }>();
|
||||
const query = new URL(page.url, 'https://investmoz.invalid').searchParams;
|
||||
const scope = `${page.props.auth.user?.id ?? 'anonymous'}:${query.get('context') ?? ''}:${query.get('draft') ?? ''}`;
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
<p>
|
||||
@@ -428,7 +431,7 @@ function Simulator() {
|
||||
para rever mercado, localização, recursos, formalização e
|
||||
execução.
|
||||
</p>
|
||||
<SimulationForm />
|
||||
<SimulationForm key={scope} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ import { edit as editAppearance } from '@/routes/appearance';
|
||||
export default function Appearance() {
|
||||
return (
|
||||
<>
|
||||
<Head title="Appearance settings" />
|
||||
<Head title="Definições de aparência" />
|
||||
|
||||
<h1 className="sr-only">Appearance settings</h1>
|
||||
<h1 className="sr-only"> Definições de aparência </h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Appearance settings"
|
||||
description="Update the appearance settings for your account"
|
||||
title="Definições de aparência"
|
||||
description="Escolha a aparência da sua conta"
|
||||
/>
|
||||
<AppearanceTabs />
|
||||
</div>
|
||||
@@ -25,7 +25,7 @@ export default function Appearance() {
|
||||
Appearance.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Appearance settings',
|
||||
title: 'Definições de aparência',
|
||||
href: editAppearance(),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -34,15 +34,15 @@ export default function Profile(
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title="Profile settings" />
|
||||
<Head title="Definições do perfil" />
|
||||
|
||||
<h1 className="sr-only">Profile settings</h1>
|
||||
<h1 className="sr-only"> Definições do perfil </h1>
|
||||
|
||||
<div className="space-y-6">
|
||||
<Heading
|
||||
variant="small"
|
||||
title="Profile"
|
||||
description="Update your name and email address"
|
||||
title="Perfil"
|
||||
description="Actualize o seu nome e endereço de correio electrónico"
|
||||
/>
|
||||
|
||||
<Form
|
||||
@@ -55,7 +55,7 @@ export default function Profile(
|
||||
{({ processing, errors }) => (
|
||||
<>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="name">Name</Label>
|
||||
<Label htmlFor="name"> Nome </Label>
|
||||
|
||||
<Input
|
||||
id="name"
|
||||
@@ -64,7 +64,7 @@ export default function Profile(
|
||||
name="name"
|
||||
required
|
||||
autoComplete="name"
|
||||
placeholder="Full name"
|
||||
placeholder="Nome completo"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
@@ -74,7 +74,10 @@ export default function Profile(
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email address</Label>
|
||||
<Label htmlFor="email">
|
||||
{' '}
|
||||
Endereço de correio electrónico{' '}
|
||||
</Label>
|
||||
|
||||
<Input
|
||||
id="email"
|
||||
@@ -84,7 +87,7 @@ export default function Profile(
|
||||
name="email"
|
||||
required
|
||||
autoComplete="username"
|
||||
placeholder="Email address"
|
||||
placeholder="Endereço de correio electrónico"
|
||||
/>
|
||||
|
||||
<InputError
|
||||
@@ -98,22 +101,28 @@ export default function Profile(
|
||||
auth.user.email_verified_at === null && (
|
||||
<div>
|
||||
<p className="text-muted-foreground -mt-4 text-sm">
|
||||
Your email address is unverified.{' '}
|
||||
{' '}
|
||||
O seu endereço de correio
|
||||
electrónico ainda não foi
|
||||
confirmado.{' '}
|
||||
<Link
|
||||
href={send()}
|
||||
as="button"
|
||||
className="text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500"
|
||||
>
|
||||
Click here to re-send the
|
||||
verification email.
|
||||
{' '}
|
||||
Reenviar o email de
|
||||
confirmação.{' '}
|
||||
</Link>
|
||||
</p>
|
||||
|
||||
{status ===
|
||||
'verification-link-sent' && (
|
||||
<div className="mt-2 text-sm font-medium text-green-600">
|
||||
A new verification link has been
|
||||
sent to your email address.
|
||||
{' '}
|
||||
Foi enviada uma nova ligação de
|
||||
confirmação para o seu
|
||||
email.{' '}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -125,7 +134,8 @@ export default function Profile(
|
||||
disabled={processing}
|
||||
data-test="update-profile-button"
|
||||
>
|
||||
Save
|
||||
{' '}
|
||||
Guardar{' '}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
@@ -141,7 +151,7 @@ export default function Profile(
|
||||
Profile.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Profile settings',
|
||||
title: 'Definições do perfil',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -151,7 +151,7 @@ export default function Security(props: Props) {
|
||||
Security.layout = {
|
||||
breadcrumbs: [
|
||||
{
|
||||
title: 'Security settings',
|
||||
title: 'Definições de segurança',
|
||||
href: edit(),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user