diff --git a/web/src/components/Dashboard.jsx b/web/src/components/Dashboard.jsx index e9c969a..6342766 100644 --- a/web/src/components/Dashboard.jsx +++ b/web/src/components/Dashboard.jsx @@ -92,6 +92,21 @@ export default function Dashboard({ api, refreshRef }) { const minimax = (quota || []).find(p => p.name === 'minimax') const zai = (quota || []).find(p => p.name === 'zai') + const EXCLUDE_CMDS = ['ls', 'cd', 'pwd', 'clear', 'exit', 'history'] + + const topCmds = (() => { + const counts = {} + for (const c of recentCmds) { + const base = c.cmd.split(/\s+/)[0] + if (EXCLUDE_CMDS.includes(base) || !base) continue + counts[base] = (counts[base] || 0) + 1 + } + return Object.entries(counts) + .sort((a, b) => b[1] - a[1]) + .slice(0, 5) + .map(([cmd, count]) => ({ cmd, count })) + })() + return (
{/* CPU */} @@ -175,6 +190,16 @@ export default function Dashboard({ api, refreshRef }) {
Recent Commands
+ {topCmds.length > 0 && ( +
+ {topCmds.map((c, i) => ( +
navigator.clipboard.writeText(c.cmd)} title="Copier"> + {c.cmd} + {c.count}× +
+ ))} +
+ )}
{recentCmds.length === 0 && No history} {recentCmds.map((c, i) => ( diff --git a/web/src/styles/global.css b/web/src/styles/global.css index 219e53c..8bdb9e6 100644 --- a/web/src/styles/global.css +++ b/web/src/styles/global.css @@ -686,6 +686,17 @@ input::placeholder { color: var(--text-disabled); } flex: 1; min-width: 0; } +.dash-cmd-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; } +.dash-cmd-chip { + display: flex; align-items: center; gap: 6px; + padding: 6px 12px; border-radius: var(--radius); + background: var(--bg-surface); border: 1px solid var(--border); + cursor: pointer; transition: all 0.15s; +} +.dash-cmd-chip:hover { border-color: var(--accent-dim); background: var(--accent-bg); } +.dash-cmd-chip-name { font-size: 13px; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); } +.dash-cmd-chip-count { font-size: 10px; font-family: var(--font-mono); color: var(--accent); } + /* Services */ .dash-services { display: flex; flex-direction: column; gap: 6px; } .dash-svc-row {