42 lines
2.0 KiB
TypeScript
42 lines
2.0 KiB
TypeScript
import Link from "next/link";
|
||
import type { AgentTaskRow } from "@peppa/core";
|
||
import { Badge } from "@/components/ui/badge";
|
||
import { getT } from "@/lib/i18n";
|
||
|
||
/**
|
||
* PEP-197: for the superadmin — per project, tasks of people and of agents, how many of the
|
||
* agents' wait for a decision, and where agents made more than people. Money only in «Инженер».
|
||
*/
|
||
export async function AgentTaskSummary({ rows, engineer }: { rows: AgentTaskRow[]; engineer: boolean }) {
|
||
const t = await getT();
|
||
return (
|
||
<div className="overflow-x-auto rounded-lg border bg-card">
|
||
<table className="w-full min-w-[28rem] border-collapse text-sm">
|
||
<thead>
|
||
<tr className="text-left text-xs text-muted-foreground">
|
||
<th className="px-3 py-2 font-medium">{t("Проект")}</th>
|
||
<th className="px-3 py-2 font-medium">{t("Люди")}</th>
|
||
<th className="px-3 py-2 font-medium">{t("Фабрика")}</th>
|
||
<th className="px-3 py-2 font-medium">{t("Ждут решения")}</th>
|
||
{/* glossary-ignore: сумма показана только в режиме «Инженер» */}
|
||
{engineer && <th className="px-3 py-2 font-medium">{t("За неделю, $")}</th>}
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{rows.map((r) => (
|
||
<tr key={r.projectId} className="border-t">
|
||
<td className="px-3 py-2">
|
||
<Link href={`/p/${r.key}`}>{r.name}</Link> {r.agentsMoreThanHuman && <Badge variant="warn">{t("фабрика завела больше")}</Badge>}
|
||
</td>
|
||
<td className="px-3 py-2 tabular-nums">{r.human}</td>
|
||
<td className="px-3 py-2 tabular-nums">{r.agents}</td>
|
||
<td className="px-3 py-2 tabular-nums">{r.proposed}</td>
|
||
{engineer && <td className="px-3 py-2 tabular-nums">{r.agentCostWeek.toFixed(2)}</td>}
|
||
</tr>
|
||
))}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
);
|
||
}
|