Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,42 @@ export function AdminMessagingOverview({
/>

<h3 className="mb-2 text-lg font-semibold">Top Senders</h3>
{/* See AdminPaymentPanel: the well needs a padded parent around the
scroller, not on it (#430). The comment lives ABOVE the ternary —
a `{comment}` between `? (` and its element is two root nodes and a
syntax error, which is exactly what it was a moment ago. */}
{(trends.top_senders ?? []).length > 0 ? (
<div className="overflow-x-auto">
<table className="table-sm table" data-testid="top-senders-table">
<thead>
<tr>
<th>User</th>
<th className="text-right">Messages</th>
</tr>
</thead>
<tbody>
{(trends.top_senders ?? []).map((s) => (
<tr key={s.user_id}>
<td>
<div className="font-medium">
{s.display_name ?? s.username ?? 'N/A'}
</div>
{s.username && s.display_name && (
<div className="text-base-content text-xs">
@{s.username}
</div>
)}
</td>
<td className="text-right font-mono">{s.messages}</td>
<div className="sh-well rounded-lg p-2">
<div className="overflow-x-auto">
<table
className="table-sm table"
data-testid="top-senders-table"
>
<thead>
<tr>
<th>User</th>
<th className="text-right">Messages</th>
</tr>
))}
</tbody>
</table>
</thead>
<tbody>
{(trends.top_senders ?? []).map((s) => (
<tr key={s.user_id}>
<td>
<div className="font-medium">
{s.display_name ?? s.username ?? 'N/A'}
</div>
{s.username && s.display_name && (
<div className="text-base-content text-xs">
@{s.username}
</div>
)}
</td>
<td className="text-right font-mono">{s.messages}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
) : (
<p
Expand Down
91 changes: 47 additions & 44 deletions src/components/organisms/AdminPaymentPanel/AdminPaymentPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,52 +213,55 @@ export function AdminPaymentPanel({
testId="payment-trend-chart"
/>

<div className="overflow-x-auto">
<table className="table">
<thead>
<tr>
<th>Provider</th>
<th>Succeeded</th>
<th>Failed</th>
<th>Refunded</th>
<th>Revenue</th>
<th>Health</th>
</tr>
</thead>
<tbody>
{(trends.provider_breakdown ?? []).map((p) => {
const flagged = failureShare(p) > FAILURE_FLAG_THRESHOLD;
return (
<tr key={p.provider}>
<td className="font-medium">{p.provider}</td>
<td>{p.succeeded}</td>
<td>{p.failed}</td>
<td>{p.refunded}</td>
<td>{formatCents(p.revenue_cents)}</td>
<td>
{flagged ? (
<span className="badge badge-error">
Elevated failures
</span>
) : (
<span className="badge badge-success">OK</span>
)}
</td>
</tr>
);
})}
{(trends.provider_breakdown ?? []).length === 0 && (
{/* The scroller is WRAPPED, not replaced (#430). `sh-well` paints an
inset shadow BELOW its children, so it needs a padded parent — put it
on the `overflow-x-auto` div itself and the shadow is clipped by the
scroller and hidden under the table. */}
<div className="sh-well rounded-lg p-2">
<div className="overflow-x-auto">
<table className="table">
<thead>
<tr>
<td
colSpan={6}
className="text-base-content text-center"
>
No activity in this range
</td>
<th>Provider</th>
<th>Succeeded</th>
<th>Failed</th>
<th>Refunded</th>
<th>Revenue</th>
<th>Health</th>
</tr>
)}
</tbody>
</table>
</thead>
<tbody>
{(trends.provider_breakdown ?? []).map((p) => {
const flagged = failureShare(p) > FAILURE_FLAG_THRESHOLD;
return (
<tr key={p.provider}>
<td className="font-medium">{p.provider}</td>
<td>{p.succeeded}</td>
<td>{p.failed}</td>
<td>{p.refunded}</td>
<td>{formatCents(p.revenue_cents)}</td>
<td>
{flagged ? (
<span className="badge badge-error">
Elevated failures
</span>
) : (
<span className="badge badge-success">OK</span>
)}
</td>
</tr>
);
})}
{(trends.provider_breakdown ?? []).length === 0 && (
<tr>
<td colSpan={6} className="text-base-content text-center">
No activity in this range
</td>
</tr>
)}
</tbody>
</table>
</div>
</div>
</section>
)}
Expand Down
Loading