oportunidades 6
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 21:17:46 +02:00
parent 01405cbf8a
commit 20971d523f
126 changed files with 44362 additions and 3496 deletions
+36 -2
View File
@@ -1,5 +1,6 @@
import { Head, Link, useForm } from '@inertiajs/react';
import { Head, Link, router, useForm } from '@inertiajs/react';
import { useState } from 'react';
import type { LegacyArticle } from '@/pages/portal/legacy';
export type InvestmentContext = {
id: string;
@@ -10,15 +11,31 @@ export type InvestmentContext = {
export default function InvestmentContexts({
contexts,
contentSource,
}: {
contexts: InvestmentContext[];
contentSource?: LegacyArticle;
}) {
const [key] = useState(() => globalThis.crypto.randomUUID());
const form = useForm({ title: '', client_key: key, reuse_consent: false });
const form = useForm({
title: '',
client_key: key,
reuse_consent: false,
content_resource_id: contentSource?.id,
});
return (
<main className="mx-auto max-w-5xl space-y-6 p-4 md:p-8">
<Head title="Os meus investimentos" />
<h1 className="text-2xl font-semibold">Os meus investimentos</h1>
{contentSource && (
<p>
Preparar a partir de{' '}
<Link className="underline" href={contentSource.href}>
{contentSource.title}
</Link>
. A fonte e a versão serão guardadas no dossier escolhido.
</p>
)}
<p>
Prepare cada investimento no seu dossier. Pode trabalhar em
várias etapas em paralelo.
@@ -36,6 +53,23 @@ export default function InvestmentContexts({
Guardado em{' '}
{new Date(item.updated_at).toLocaleString('pt-MZ')}
</p>
{contentSource && (
<button
type="button"
className="mt-3 rounded border p-2"
onClick={() =>
router.post(
`/investimentos/${item.id}/conteudos`,
{
version: item.version,
resource_id: contentSource.id,
},
)
}
>
Continuar neste dossier com o artigo
</button>
)}
</li>
))}
</ul>
+41 -3
View File
@@ -31,6 +31,13 @@ type Path = {
next: { code: string; title: string; href: string; action: string } | null;
tools: Record<string, string | null>;
results: PathResult[];
content_sources: {
resource_id: number;
title: string;
return_href: string;
source_url: string;
metadata_version: number;
}[];
documents: {
id: string;
document_id: string;
@@ -349,12 +356,43 @@ export default function InvestmentPath(path: Path) {
);
}
return (
<main className="mx-auto max-w-6xl space-y-6 p-4 md:p-8">
<main className="mx-auto min-w-0 max-w-6xl space-y-6 p-4 [overflow-wrap:anywhere] [&_label]:min-w-0 [&_select]:min-w-0 [&_select]:max-w-full [&_input]:min-w-0 [&_input]:max-w-full md:p-8">
<Head title={path.case.title} />
<Link className="underline" href="/investimentos">
Os meus investimentos
</Link>
<h1 className="text-2xl font-semibold">{path.case.title}</h1>
{!!path.content_sources?.length && (
<section
className="space-y-2 rounded-xl border p-4"
aria-label="Fontes da ideia"
>
<h2 className="font-semibold">
Conteúdos associados à ideia
</h2>
<ul>
{path.content_sources.map((source) => (
<li
key={`${source.resource_id}-${source.metadata_version}`}
>
<Link
className="underline"
href={`${source.return_href}?context=${path.case.id}`}
>
{source.title}
</Link>{' '}
·{' '}
<Link
className="underline"
href={`/documentos/${source.resource_id}`}
>
Exemplar e origem
</Link>
</li>
))}
</ul>
</section>
)}
{flash?.success && <output>{flash.success}</output>}
{error && <p role="alert">{error}</p>}
<section className="rounded-xl border p-4">
@@ -580,7 +618,7 @@ export default function InvestmentPath(path: Path) {
</h2>
{path.canWrite && (
<form
className="grid gap-3"
className="grid min-w-0 gap-3 [&_label]:min-w-0 [&_select]:min-w-0 [&_select]:max-w-full [&_input]:min-w-0 [&_input]:max-w-full"
onSubmit={(event) => {
event.preventDefault();
task.transform((data) => ({
@@ -630,7 +668,7 @@ export default function InvestmentPath(path: Path) {
<input
required
type="datetime-local"
className="rounded border p-2"
className="w-full min-w-0 rounded border p-2"
value={task.data.due_at}
onChange={(e) =>
task.setData('due_at', e.target.value)