Big updates
This commit is contained in:
@@ -30,6 +30,7 @@ export function CallRow({ call, systemName, isAdmin }: Props) {
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [editText, setEditText] = useState("");
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [saveError, setSaveError] = useState<string | null>(null);
|
||||
const isActive = call.status === "active";
|
||||
const hasDetails = call.transcript || call.transcript_corrected || (call.tags && call.tags.length > 0) || call.incident_id;
|
||||
const displayTranscript = (!showOriginal && call.transcript_corrected) ? call.transcript_corrected : call.transcript;
|
||||
@@ -44,11 +45,12 @@ export function CallRow({ call, systemName, isAdmin }: Props) {
|
||||
async function saveEdit(e: React.MouseEvent) {
|
||||
e.stopPropagation();
|
||||
setSaving(true);
|
||||
setSaveError(null);
|
||||
try {
|
||||
await c2api.patchTranscript(call.call_id, editText);
|
||||
setEditing(false);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setSaveError(err instanceof Error ? err.message : "Save failed");
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
@@ -71,8 +73,8 @@ export function CallRow({ call, systemName, isAdmin }: Props) {
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-4 py-2 text-gray-400">{systemName ?? call.system_id ?? "—"}</td>
|
||||
<td className="px-4 py-2 text-gray-400">{call.node_id}</td>
|
||||
<td className="px-4 py-2 text-gray-400 hidden sm:table-cell">{systemName ?? call.system_id ?? "—"}</td>
|
||||
<td className="px-4 py-2 text-gray-400 hidden sm:table-cell">{call.node_id}</td>
|
||||
<td className="px-4 py-2">
|
||||
{isActive ? (
|
||||
<span className="text-orange-400 animate-pulse">● live</span>
|
||||
@@ -136,7 +138,7 @@ export function CallRow({ call, systemName, isAdmin }: Props) {
|
||||
rows={4}
|
||||
className="w-full bg-gray-800 border border-gray-600 rounded-lg px-3 py-2 text-xs text-gray-200 font-mono focus:outline-none focus:border-indigo-500 resize-none"
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<button
|
||||
onClick={saveEdit}
|
||||
disabled={saving}
|
||||
@@ -150,6 +152,9 @@ export function CallRow({ call, systemName, isAdmin }: Props) {
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
{saveError && (
|
||||
<span className="text-xs text-red-400 font-mono">{saveError}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : hasSegments ? (
|
||||
|
||||
Reference in New Issue
Block a user