Files
errors.bitreport.pt/admin-ui/components/IncidentNotes.tsx
1sonhadorandPaperclip b0b733d5e1 feat(BIT-247): consolidate error reporting repo from OTT
Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc,
docker-compose, and deployment docs into the dedicated repository. Paths updated
for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout.

Co-Authored-By: Paperclip <[email protected]>
2026-03-22 18:20:27 +00:00

46 lines
1.2 KiB
TypeScript

"use client";
import { useEffect, useId, useState } from "react";
const _storageKey = (id: string) => `er-incident-notes:${id}`;
export function IncidentNotes({ incidentId }: { incidentId: string }) {
const _id = useId();
const [value, setValue] = useState("");
useEffect(() => {
if (typeof window === "undefined") {
return;
}
const _stored = window.sessionStorage.getItem(_storageKey(incidentId));
setValue(_stored ?? "");
}, [incidentId]);
useEffect(() => {
if (typeof window === "undefined") {
return;
}
window.sessionStorage.setItem(_storageKey(incidentId), value);
}, [incidentId, value]);
return (
<div>
<label className="form-label" htmlFor={_id}>
Notas do operador
</label>
<textarea
id={_id}
className="form-control font-monospace small"
rows={5}
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Rascunho local (sessionStorage). A persistência no servidor chega com a API admin (BIT-179)."
/>
<p className="form-text mb-0">
Estas notas não são enviadas ao servidor nesta fase — apenas para acompanhamento na sessão do
browser.
</p>
</div>
);
}