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]>
46 lines
1.2 KiB
TypeScript
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>
|
|
);
|
|
}
|