Spaces:
Running
Running
File size: 2,482 Bytes
0bb4dfa | 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 | import React from 'react';
/**
* Phase-by-phase summary of the conversation rendered as a table.
* Question on top, final group opinion under it, one row per
* participant with first / contribution / revised / final columns.
*
* Driven by the GET /api/chat/{id}/table endpoint - so this component
* just renders the JSON response.
*/
export default function ChatTableView({ data, onClose, onExportCsv }) {
if (!data) return null;
return (
<div className="ccai-table-overlay">
<div className="ccai-table-card">
<div className="ccai-table-header">
<h2>Conversation Summary Table</h2>
<div className="ccai-tab-spacer" />
<button
className="btn-sm btn-outline"
onClick={onExportCsv}
title="Export this table as CSV"
>
Export CSV
</button>
<button className="modal-close" onClick={onClose}>×</button>
</div>
<div className="ccai-table-body">
<div className="ccai-table-question">
<strong>Question:</strong>
<div>{data.question}</div>
</div>
<div className="ccai-table-final">
<strong>Final group opinion:</strong>
<div>
{data.final_report ? data.final_report : (
<em>No final report yet.</em>
)}
</div>
</div>
<div className="ccai-table-scroll">
<table className="ccai-table">
<thead>
<tr>
<th>Participant</th>
<th>First opinion</th>
<th>Conversation contribution</th>
<th>Revised opinion</th>
<th>Final opinion</th>
</tr>
</thead>
<tbody>
{(data.rows || []).map(row => (
<tr key={row.participant_id}>
<td className="ccai-table-name">
<div>{row.name}</div>
<small>{row.model_display}</small>
</td>
<td>{row.first_opinion}</td>
<td>{row.contribution_summary || <em>(no summary)</em>}</td>
<td>{row.revised_opinion}</td>
<td>{row.final_opinion}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
);
}
|