Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | 1x 422x 170x 170x 170x 170x 1x 6x 6x 6x 5x 116x 116x 116x 116x 116x 116x 116x 116x 116x 3x 3x 3x 3x 2x 1x 3x 116x 1x 1x 1x 1x 19x 2x 2x 2x 1x 4x 330x 24x 54x 54x 54x 54x 54x 1x 1x 1x 1x 1x 1x 1x 11x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 11x 11x 11x 11x 11x 10x 10x 11x 11x 1x 11x 28x 6x 28x 6x 4x 4x 4x 8x 4x 4x 4x 8x 28x 2x 2x 2x 2x 1x 1x 1x 1x 1x 2x 2x 28x 1x 1x 16x 1x 16x 16x 1x 1x 60x 40x | "use client";
import { fetchApi } from "@/lib/api";
import {
MEASURES,
MEASURE_LABELS,
type Finding,
type InformationRequest,
type Measure,
} from "@/lib/supervision";
import { useDemoPersona } from "@/lib/use-demo-persona";
import { useSession } from "next-auth/react";
import { useCallback, useEffect, useState } from "react";
import Link from "next/link";
import { Gavel, AlertCircle, ShieldCheck, Clock } from "lucide-react";
import { IS_STATIC } from "@/lib/static-export";
import { T, useT } from "@/lib/i18n/translate";
/**
* Supervision, Regulation (EU) 2025/327 Art. 63: the access body records a
* finding of non-compliance against a data user or holder, the party states
* its views within four weeks (63(2)), the body takes a measure (63(3)) and
* publishes it (57(1)(j)(iv)); and the body asks a party for information
* (63(1)), which is answered on record. The access body works here; a data
* user or holder sees what concerns it and answers. Issue #206, M4.
*/
interface Party {
id: string;
name: string;
type: string | null;
}
interface Permit {
permitId: string | null;
applicant: string | null;
applicantDid: string | null;
outcome: string;
datasetTitle: string | null;
datasetId: string | null;
}
function shortDate(iso: string | null | undefined): string {
return iso ? iso.slice(0, 10) : "—";
}
function StatusBadge({ status }: { status: string }) {
const t = useT("access");
const cls =
status === "CLOSED" || status === "ANSWERED"
? "bg-(--badge-inactive-bg) text-(--badge-inactive-text) border-(--badge-inactive-border)"
: status === "VIEWS_RECEIVED"
? "bg-(--badge-active-bg) text-(--badge-active-text) border-(--badge-active-border)"
: "bg-(--role-hdab-bg) text-(--role-hdab-text) border-(--role-hdab-border)";
const words: Record<string, string> = {
OPEN: "open, views awaited",
VIEWS_RECEIVED: "views received",
CLOSED: "closed",
ANSWERED: "answered",
};
return (
<span
className={`inline-flex items-center gap-1 text-xs font-medium px-2 py-0.5 rounded-sm border whitespace-nowrap ${cls}`}
data-testid="supervision-status"
>
{status === "OPEN" ? <Clock size={12} /> : <ShieldCheck size={12} />}
{words[status] ? t(words[status]) : status.toLowerCase()}
</span>
);
}
const inputCls =
"rounded-sm border border-(--border) bg-(--surface) px-2 py-1 w-full";
async function postJson(path: string, body: unknown) {
const r = await fetchApi(path, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
const data = (await r.json().catch(() => ({}))) as Record<string, unknown>;
if (!r.ok) throw new Error(String(data.error ?? `HTTP ${r.status}`));
return data;
}
function FindingCard({
f,
isBody,
onChanged,
}: {
f: Finding;
isBody: boolean;
onChanged: () => Promise<void>;
}) {
const t = useT("access");
const [views, setViews] = useState("");
const [measure, setMeasure] = useState<Measure>("WARNING");
const [note, setNote] = useState("");
const [exclusionMonths, setExclusionMonths] = useState(12);
const [fineEur, setFineEur] = useState(10000);
const [busy, setBusy] = useState(false);
const [msg, setMsg] = useState<string | null>(null);
const run = async (fn: () => Promise<string>) => {
setBusy(true);
setMsg(null);
try {
setMsg(await fn());
await onChanged();
} catch (e) {
setMsg(e instanceof Error ? e.message : String(e));
} finally {
setBusy(false);
}
};
return (
<article
className="rounded-lg border border-(--border) bg-(--surface) p-4 text-sm"
data-testid="finding-card"
data-finding-id={f.findingId}
>
<div className="flex flex-wrap items-start justify-between gap-2">
<div>
<div className="font-semibold text-(--text-primary)">
{f.partyName ?? f.party}
{f.permitId ? (
<span className="font-normal text-(--text-secondary)">
{" "}
· {f.permitId}
</span>
) : null}
</div>
<div className="text-xs text-(--text-secondary) font-mono">
{f.findingId}
</div>
</div>
<StatusBadge status={f.status} />
</div>
<p className="mt-2">{f.description}</p>
<dl className="mt-2 grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-1 text-xs">
<div>
<dt className="inline text-(--text-secondary)">{t("Notified")} </dt>
<dd className="inline">{shortDate(f.notifiedAt)}</dd>
</div>
<div data-testid="finding-respond-by">
<dt className="inline text-(--text-secondary)">
{t("Views by (Art. 63(2))")}{" "}
</dt>
<dd className="inline">
{shortDate(f.respondBy)}
{typeof f.daysToRespond === "number"
? ` (${t("{days} days", { days: f.daysToRespond })})`
: ""}
</dd>
</div>
{f.gdprBreach && (
<div className="md:col-span-2 text-(--danger-text)">
{t(
"Suspected GDPR breach; the supervisory authority has been informed (Art. 63).",
)}
</div>
)}
{f.views && (
<div className="md:col-span-2">
<dt className="inline text-(--text-secondary)">
{t("Views of the party ({date})", {
date: shortDate(f.respondedAt),
})}{" "}
</dt>
<dd className="inline">{f.views}</dd>
</div>
)}
{f.status === "CLOSED" && (
<div className="md:col-span-2" data-testid="finding-measure">
<dt className="inline text-(--text-secondary)">
{t("Measure ({date})", { date: shortDate(f.closedAt) })}{" "}
</dt>
<dd className="inline">
{MEASURE_LABELS[(f.measure ?? "NONE") as Measure]
? t(MEASURE_LABELS[(f.measure ?? "NONE") as Measure])
: f.measure}
{f.measure === "EXCLUSION" && f.exclusionMonths
? `, ${t("{months} months", { months: f.exclusionMonths })}`
: ""}
{f.measure === "FINE" && f.fineEur
? `, ${f.fineEur.toLocaleString("en-GB")} EUR`
: ""}
{f.measureNote ? ` · ${f.measureNote}` : ""}
</dd>
</div>
)}
</dl>
{!isBody && f.status === "OPEN" && !IS_STATIC && (
<form
className="mt-3 rounded-lg border border-(--border) bg-(--bg) p-3 space-y-2 text-xs"
onSubmit={(e) => {
e.preventDefault();
void run(async () => {
await postJson("/api/compliance/findings/respond", {
findingId: f.findingId,
views,
});
return t("Your views are on record (Art. 63(2)).");
});
}}
aria-label={t("State your views")}
>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("State your views within four weeks")}
</span>
<textarea
id={`views-${f.findingId}`}
rows={2}
value={views}
onChange={(e) => setViews(e.target.value)}
className={inputCls}
/>
</label>
<button
type="submit"
disabled={busy || !views.trim()}
className="px-3 py-1.5 rounded-sm font-semibold bg-(--accent) text-white disabled:opacity-60"
>
{busy ? t("Sending…") : t("Send views")}
</button>
</form>
)}
{isBody && f.status !== "CLOSED" && !IS_STATIC && (
<form
className="mt-3 rounded-lg border border-(--border) bg-(--bg) p-3 space-y-2 text-xs"
onSubmit={(e) => {
e.preventDefault();
void run(async () => {
const r = await postJson("/api/compliance/findings/close", {
findingId: f.findingId,
measure,
note,
exclusionMonths,
fineEur,
});
return r.permitRevoked
? t(
"Closed; data permit {permit} revoked (Art. 63(3)); published under Art. 57(1)(j)(iv).",
{ permit: String(r.permitId) },
)
: measure === "NONE"
? t("Closed without a measure.")
: t(
"Closed; the measure is published under Art. 57(1)(j)(iv).",
);
});
}}
aria-label={t("Close the finding")}
>
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("Measure, Art. 63(3)")}
</span>
<select
id={`measure-${f.findingId}`}
value={measure}
onChange={(e) => setMeasure(e.target.value as Measure)}
className={inputCls}
>
{MEASURES.map((m) => (
<option key={m} value={m}>
{t(MEASURE_LABELS[m])}
</option>
))}
</select>
</label>
{measure === "EXCLUSION" && (
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("Exclusion, months (up to 60)")}
</span>
<input
type="number"
min={1}
max={60}
value={exclusionMonths}
onChange={(e) => setExclusionMonths(Number(e.target.value))}
className={inputCls}
/>
</label>
)}
{measure === "FINE" && (
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("Fine, EUR")}
</span>
<input
type="number"
min={0}
value={fineEur}
onChange={(e) => setFineEur(Number(e.target.value))}
className={inputCls}
/>
</label>
)}
</div>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("Reason (published with the measure, Art. 57(1)(j)(iv))")}
</span>
<textarea
id={`measure-note-${f.findingId}`}
rows={2}
value={note}
onChange={(e) => setNote(e.target.value)}
className={inputCls}
/>
</label>
<button
type="submit"
disabled={busy || (measure !== "NONE" && !note.trim())}
className="px-3 py-1.5 rounded-sm font-semibold border border-(--danger-text) text-(--danger-text) disabled:opacity-50"
>
{busy ? t("Closing…") : t("Close with this measure")}
</button>
</form>
)}
{msg && (
<p className="mt-2 text-xs text-(--text-primary)" role="status">
{msg}
</p>
)}
</article>
);
}
function InformationRequestCard({
r,
isBody,
onChanged,
}: {
r: InformationRequest;
isBody: boolean;
onChanged: () => Promise<void>;
}) {
const t = useT("access");
const [answer, setAnswer] = useState("");
const [busy, setBusy] = useState(false);
const [msg, setMsg] = useState<string | null>(null);
return (
<article
className="rounded-lg border border-(--border) bg-(--surface) p-4 text-sm"
data-testid="information-request-card"
data-request-id={r.requestId}
>
<div className="flex flex-wrap items-start justify-between gap-2">
<div>
<div className="font-semibold text-(--text-primary)">
{r.partyName ?? r.party}
{r.permitId ? (
<span className="font-normal text-(--text-secondary)">
{" "}
· {r.permitId}
</span>
) : null}
</div>
<div className="text-xs text-(--text-secondary) font-mono">
{r.requestId}
</div>
</div>
<StatusBadge status={r.status} />
</div>
<p className="mt-2">{r.question}</p>
<p className="mt-1 text-xs text-(--text-secondary)">
{t("Asked {asked} · answer by {by}", {
asked: shortDate(r.requestedAt),
by: shortDate(r.answerBy),
})}
{typeof r.daysToAnswer === "number"
? ` (${t("{days} days", { days: r.daysToAnswer })})`
: ""}
</p>
{r.answer && (
<p className="mt-2 text-xs" data-testid="information-answer">
<span className="text-(--text-secondary)">
{t("Answer ({date}):", { date: shortDate(r.answeredAt) })}{" "}
</span>
{r.answer}
</p>
)}
{!isBody && r.status === "OPEN" && !IS_STATIC && (
<form
className="mt-3 rounded-lg border border-(--border) bg-(--bg) p-3 space-y-2 text-xs"
onSubmit={(e) => {
e.preventDefault();
setBusy(true);
setMsg(null);
postJson("/api/compliance/information-requests/answer", {
requestId: r.requestId,
answer,
})
.then(async () => {
setMsg(t("Answer on record."));
await onChanged();
})
.catch((err: unknown) =>
setMsg(err instanceof Error ? err.message : String(err)),
)
.finally(() => setBusy(false));
}}
aria-label={t("Answer the request")}
>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">{t("Your answer")}</span>
<textarea
id={`answer-${r.requestId}`}
rows={2}
value={answer}
onChange={(e) => setAnswer(e.target.value)}
className={inputCls}
/>
</label>
<button
type="submit"
disabled={busy || !answer.trim()}
className="px-3 py-1.5 rounded-sm font-semibold bg-(--accent) text-white disabled:opacity-60"
>
{busy ? t("Sending…") : t("Send answer")}
</button>
</form>
)}
{/* Outside the form: once answered, the refreshed request closes the
form, and the confirmation went with it before anyone, or a screen
reader, could read it (2026-11-08, J998). */}
{msg && (
<p className="mt-2 text-xs text-(--text-primary)" role="status">
{msg}
</p>
)}
</article>
);
}
export default function SupervisionPage() {
const { data: session } = useSession();
const demoPersona = useDemoPersona();
const roles: readonly string[] = IS_STATIC
? demoPersona?.roles ?? []
: (session as { roles?: string[] } | null)?.roles ?? [];
const t = useT("access");
const isBody =
roles.includes("HDAB_AUTHORITY") || roles.includes("EDC_ADMIN");
const [findings, setFindings] = useState<Finding[]>([]);
const [requests, setRequests] = useState<InformationRequest[]>([]);
const [parties, setParties] = useState<Party[]>([]);
const [permits, setPermits] = useState<Permit[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [partyDid, setPartyDid] = useState("did:web:pharmaco.de:research");
const [permitId, setPermitId] = useState("");
const [description, setDescription] = useState(
"Output left the secure processing environment with direct identifiers (Art. 61(2)).",
);
const [gdprBreach, setGdprBreach] = useState(true);
const [question, setQuestion] = useState(
"Which persons accessed the data under the permit in the last quarter, and which outputs left the environment?",
);
const [busy, setBusy] = useState<string | null>(null);
const [msg, setMsg] = useState<string | null>(null);
const load = useCallback(async () => {
try {
const [f, r] = await Promise.all([
fetchApi("/api/compliance/findings").then((x) => x.json()),
fetchApi("/api/compliance/information-requests").then((x) => x.json()),
]);
if (f?.error) throw new Error(f.detail || f.error);
Iif (r?.error) throw new Error(r.detail || r.error);
setFindings(f.findings ?? []);
setRequests(r.requests ?? []);
setError(null);
} catch (e) {
setError(e instanceof Error ? e.message : String(e));
} finally {
setLoading(false);
}
}, []);
useEffect(() => {
void load();
}, [load]);
useEffect(() => {
if (!isBody) return;
fetchApi("/api/compliance")
.then((x) => x.json())
.then((d) =>
setParties(
((d.consumers ?? []) as Party[]).filter(
(p) => p.type !== "HDAB" && !p.id.includes(":hdab"),
),
),
)
.catch(() => {});
fetchApi("/api/permits")
.then((x) => x.json())
.then((d) =>
setPermits(
((d.entries ?? []) as Permit[]).filter(
(e) => e.permitId && e.outcome === "permit issued",
),
),
)
.catch(() => {});
}, [isBody]);
const submit = async (kind: "finding" | "information") => {
setBusy(kind);
setMsg(null);
try {
if (kind === "finding") {
const r = await postJson("/api/compliance/findings", {
partyDid,
permitId: permitId || undefined,
description,
gdprBreach,
});
const vars = {
id: String(r.findingId),
party: String(r.partyName ?? partyDid),
date: shortDate(String(r.respondBy)),
};
setMsg(
gdprBreach
? t(
"Finding {id} recorded; {party} states its views by {date} (Art. 63(2)); the supervisory authority is informed.",
vars,
)
: t(
"Finding {id} recorded; {party} states its views by {date} (Art. 63(2)).",
vars,
),
);
} else {
const r = await postJson("/api/compliance/information-requests", {
partyDid,
permitId: permitId || undefined,
question,
});
setMsg(
t("Information request {id} sent; answer by {date}.", {
id: String(r.requestId),
date: shortDate(String(r.answerBy)),
}),
);
}
await load();
} catch (e) {
setMsg(e instanceof Error ? e.message : String(e));
} finally {
setBusy(null);
}
};
return (
<div className="min-h-screen bg-(--bg)">
<div className="max-w-5xl mx-auto px-6 py-10">
<div className="mb-8">
<h1 className="page-header flex items-center gap-2">
<Gavel size={28} />
{t("Supervision")}
</h1>
<p className="text-(--text-secondary) text-lg mt-1">
{t(
"Regulation (EU) 2025/327, Art. 63 · findings, views within four weeks, measures; requests for information",
)}
</p>
</div>
<div className="rounded-lg border border-(--border) bg-(--surface) p-4 mb-8 text-sm text-(--text-secondary) space-y-2">
<p>
<T
area="access"
tags={{
a: (
<Link
href="/permits"
className="font-bold text-(--accent) hover:underline"
/>
),
}}
>
{
"When a data user or holder fails to comply, the access body records a finding and the party has four weeks to state its views (Art. 63(2)). The body may then warn, revoke the permit, exclude the party from access for up to five years (Art. 63(3)) or fine it (Art. 64); the measure is published on the <a>public register</a> (Art. 57(1)(j)(iv)). Where a breach of the GDPR is suspected, the supervisory authority is informed. The body may also ask a party for information; the request and the answer are on record."
}
</T>
</p>
</div>
{isBody && (
<section className="mb-10 grid grid-cols-1 lg:grid-cols-2 gap-4">
<form
className="rounded-lg border border-(--border) bg-(--surface) p-4 space-y-3 text-xs"
onSubmit={(e) => {
e.preventDefault();
void submit("finding");
}}
aria-label={t("Record a finding")}
>
<h2 className="text-sm font-semibold text-(--text-primary)">
{t("Record a finding of non-compliance")}
</h2>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">{t("Party")}</span>
<select
id="finding-party"
value={partyDid}
onChange={(e) => setPartyDid(e.target.value)}
className={inputCls}
>
{parties.length === 0 && (
<option value={partyDid}>{partyDid}</option>
)}
{parties.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
</option>
))}
</select>
</label>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("Permit concerned, if any")}
</span>
<select
id="finding-permit"
value={permitId}
onChange={(e) => setPermitId(e.target.value)}
className={inputCls}
>
<option value="">{t("none")}</option>
{permits
.filter((p) => !partyDid || p.applicantDid === partyDid)
.map((p) => (
<option key={p.permitId ?? ""} value={p.permitId ?? ""}>
{p.permitId} · {p.datasetTitle ?? p.datasetId}
</option>
))}
</select>
</label>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">
{t("What was not complied with")}
</span>
<textarea
id="finding-description"
rows={2}
value={description}
onChange={(e) => setDescription(e.target.value)}
className={inputCls}
/>
</label>
<label className="flex items-start gap-2">
<input
id="finding-gdpr"
type="checkbox"
checked={gdprBreach}
onChange={(e) => setGdprBreach(e.target.checked)}
/>
<span>
{t(
"A breach of the GDPR is suspected; inform the supervisory authority",
)}
</span>
</label>
<button
type="submit"
disabled={busy !== null || IS_STATIC || !description.trim()}
className="px-3 py-1.5 rounded-sm font-semibold bg-(--accent) text-white disabled:opacity-60"
>
{busy === "finding" ? t("Recording…") : t("Record and notify")}
</button>
</form>
<form
className="rounded-lg border border-(--border) bg-(--surface) p-4 space-y-3 text-xs"
onSubmit={(e) => {
e.preventDefault();
void submit("information");
}}
aria-label={t("Request information")}
>
<h2 className="text-sm font-semibold text-(--text-primary)">
{t("Request information from a party")}
</h2>
<p className="text-(--text-secondary)">
{permitId
? t(
"Sent to the party selected on the left, about {permit}.",
{
permit: permitId,
},
)
: t("Sent to the party selected on the left.")}
</p>
<label className="flex flex-col gap-1">
<span className="text-(--text-secondary)">{t("Question")}</span>
<textarea
id="information-question"
rows={3}
value={question}
onChange={(e) => setQuestion(e.target.value)}
className={inputCls}
/>
</label>
<button
type="submit"
disabled={busy !== null || IS_STATIC || !question.trim()}
className="px-3 py-1.5 rounded-sm font-semibold border border-(--border) disabled:opacity-50"
>
{busy === "information" ? t("Sending…") : t("Send the request")}
</button>
</form>
{msg && (
<p
className="lg:col-span-2 text-xs text-(--text-primary)"
role="status"
>
{msg}
</p>
)}
</section>
)}
{loading ? (
<p className="text-(--text-secondary) text-sm">{t("Loading…")}</p>
) : error ? (
<div className="rounded-lg border border-(--border) bg-(--surface) p-4 text-sm flex items-start gap-2">
<AlertCircle size={16} className="mt-0.5" />
<span>{error}</span>
</div>
) : (
<>
<section className="mb-10">
<h2 className="text-sm font-semibold mb-3 text-(--text-primary)">
{isBody ? t("Findings") : t("Findings against you")} (
{findings.length})
</h2>
{findings.length === 0 ? (
<p className="text-(--text-secondary) text-sm">
{t("No finding")}
</p>
) : (
<div className="space-y-3">
{findings.map((f) => (
<FindingCard
key={f.findingId}
f={f}
isBody={isBody}
onChanged={load}
/>
))}
</div>
)}
</section>
<section>
<h2 className="text-sm font-semibold mb-3 text-(--text-primary)">
{isBody
? t("Requests for information")
: t("Requests asked of you")}{" "}
({requests.length})
</h2>
{requests.length === 0 ? (
<p className="text-(--text-secondary) text-sm">
{t("No request")}
</p>
) : (
<div className="space-y-3">
{requests.map((r) => (
<InformationRequestCard
key={r.requestId}
r={r}
isBody={isBody}
onChanged={load}
/>
))}
</div>
)}
</section>
</>
)}
</div>
</div>
);
}
|