/* ============================================
ANALYTICS & AUDIT — Query volume + user feedback
============================================ */
function AnalyticsScreen({ onNavigate }) {
// 30-day query volume data
const queryData = [
142, 168, 154, 189, 203, 87, 92,
218, 234, 261, 245, 278, 102, 118,
289, 312, 298, 334, 356, 142, 156,
378, 402, 421, 398, 442, 188, 201,
458, 487,
];
const max = Math.max(...queryData);
const W = 800, H = 220, P = 30;
const stepX = (W - P * 2) / (queryData.length - 1);
const points = queryData.map((v, i) => `${P + i * stepX},${H - P - (v / max) * (H - P * 2)}`).join(" ");
return (
<>
Analytics & Audit
Last 30 days · 7,842 total queries · 96.3% citation-grounded
{["7d", "30d", "90d", "12m"].map(p => (
))}
{/* KPI strip */}
} accent="var(--navy-700)" />
} />
} />
} accent="var(--status-ok)" />
{/* Query Volume chart */}
Queries
7d avg
}>
{/* Top domains */}
{[
{ label: "CNC & Machining", v: 2810, pct: 35.8 },
{ label: "Electrical & PLC", v: 1820, pct: 23.2 },
{ label: "Hydraulics", v: 1124, pct: 14.3 },
{ label: "Safety & SOP", v: 892, pct: 11.4 },
{ label: "Pneumatics", v: 624, pct: 8.0 },
{ label: "Other", v: 572, pct: 7.3 },
].map(d => (
{d.label}
{d.v.toLocaleString()} · {d.pct}%
))}
{/* Top documents */}
| Document | Cites | Trend |
{[
["CNC-Mazak-INTEGREX-i400 Maintenance", 1842, "↑ 12%"],
["Siemens S7-1500 PLC Programming", 1204, "↑ 8%"],
["Bosch Rexroth Hydraulic Systems Vol. III", 892, "→ 0%"],
["Plant Safety SOP — LOTO", 624, "↑ 22%"],
["ABB ACS580 VFD Programming", 412, "↓ 4%"],
].map(([n, c, t], i) => (
|
{n}
|
{c.toLocaleString()} |
{t} |
))}
{/* Feedback log */}
Helpful: 88.2%
Not helpful: 11.8%
} bodyFlush>
|
Timestamp |
User |
Query |
Cited Document |
Latency |
{[
{ up: true, t: "14:23:18", u: "r.pratama", q: "Spindle bearing replacement on INTEGREX i400", doc: "DOC-CNC-204", lat: "1.04 s" },
{ up: true, t: "14:20:02", u: "a.santoso", q: "PLC error E-741 on conveyor line 7", doc: "DOC-ELEC-091", lat: "0.92 s" },
{ up: false, t: "14:17:55", u: "m.indrawan", q: "How long does hydraulic seal Q-712 take to replace?", doc: "DOC-HYD-018", lat: "1.41 s" },
{ up: true, t: "14:14:31", u: "s.permana", q: "VFD parameter set for ACS580 starter", doc: "DOC-ELEC-092", lat: "1.18 s" },
{ up: true, t: "14:11:08", u: "r.pratama", q: "Coolant concentration for tool steel grades", doc: "DOC-LUBE-007", lat: "0.84 s" },
{ up: false, t: "14:08:42", u: "h.wijaya", q: "Welding rod humidity storage spec for E7018", doc: "DOC-WELD-006", lat: "2.21 s" },
{ up: true, t: "14:05:11", u: "a.santoso", q: "LOTO procedure for grinding station 2", doc: "DOC-SAFETY-018", lat: "1.02 s" },
].map((f, i) => (
|
{f.up
?
: }
|
{f.t} |
{f.u} |
{f.q} |
{f.doc} |
{f.lat} |
))}
>
);
}
window.AnalyticsScreen = AnalyticsScreen;