| 1 | import type { Translator } from "../lib/i18n"; |
| 2 | import { mcpListAttribution, type McpListAttribution } from "../lib/mcpListAttribution"; |
| 3 | import type { Item } from "../lib/useController"; |
| 4 | |
| 5 | export function McpListLayers({ items, t }: { items?: Item[]; t: Translator }) { |
| 6 | const counts: McpListAttribution = mcpListAttribution(items ?? []); |
| 7 | const total = counts.sharedHost + counts.diskCache + counts.remote; |
| 8 | return ( |
| 9 | <section className="context-panel__section context-panel__mcp-list"> |
| 10 | <div className="context-panel__section-head"> |
| 11 | <h3>{t("context.mcpListTitle")}</h3> |
| 12 | </div> |
| 13 | {total === 0 ? ( |
| 14 | <p className="context-panel__mcp-empty">{t("context.mcpListEmpty")}</p> |
| 15 | ) : ( |
| 16 | <div className="context-panel__mcp-rows"> |
| 17 | <McpListRow label={t("context.mcpListSharedHost")} value={counts.sharedHost} /> |
| 18 | <McpListRow label={t("context.mcpListDiskCache")} value={counts.diskCache} /> |
| 19 | <McpListRow label={t("context.mcpListRemote")} value={counts.remote} /> |
| 20 | </div> |
| 21 | )} |
| 22 | </section> |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | function McpListRow({ label, value }: { label: string; value: number }) { |
| 27 | return ( |
| 28 | <div className="context-panel__mcp-row"> |
| 29 | <span>{label}</span> |
| 30 | <strong>{value}</strong> |
| 31 | </div> |
| 32 | ); |
| 33 | } |
| 34 |