agent-office: draw the Settings and picker chevrons as SVG (#740)
agent-office: the Settings button's chevron is an inline SVG that turns
over while the menu is open, and the Language, Scene and Quality pickers
draw the same chevron (appearance: none) in light and dark. .btn is
inline-flex so the chevron sits on the label's centre line, and an empty
Today token count no longer leaves a gap. Adapted by frederick-wang from
QingJ01/magpie-agent-office#4. Also re-stamps the page's asset
fingerprints, which were stale on main for model.js, scene.js,
scene3d.js and app.js since 0.3.0.
Run at the reviewed head 625619bb, on mote:
- HOME=<scratch> bun test packages/agent-office: 182 pass, 0 fail
(main 1ad712d9: 181 pass).
- bun packages/agent-office/scripts/stamp-page.mjs --check: 0
(main: 1, "stamps are stale"); every ?v= checked against sha256 of
its file.
- bun scripts/check.mjs agent-office: 0.
- Playwright 1.62.0, Chromium and WebKit, light and dark, 1200x760 @2x,
page served from the PR's files with a stub bridge: no page errors;
chevron centre 95.58px vs label 95.59px in both engines (main's
glyph: +1.0px Chromium, +1.1px WebKit); open menu turns it 180deg;
Today padding 16/16; every .btn still 36.3px tall. Screenshots looked
at, light and dark.
Not tried: inside the real magpie window (WKWebView/WebView2/WebKitGTK).
The three pickers are still native <select> elements (restyled, not
replaced); that is filed separately.
This commit is contained in:
@@ -288,6 +288,20 @@ test("words, in English and Chinese", () => {
|
||||
expect(M.duration(130e3, "en")).toBe("2m 10s")
|
||||
})
|
||||
|
||||
test("the Settings chevron and select dropdowns draw SVG chevrons, not the ⌄ character", () => {
|
||||
const html = read("index.html")
|
||||
const css = read("style.css")
|
||||
expect(html).not.toContain("⌄")
|
||||
expect(html).toMatch(/id="settingsBtn"[^>]*><span data-t="settings">Settings<\/span><svg class="chev" viewBox="0 0 10 6"/)
|
||||
expect(css).toMatch(/\.btn\s*\{[^}]*display:\s*inline-flex;[^}]*align-items:\s*center;[^}]*gap:\s*7px;/)
|
||||
expect(css).toContain(".today-tokens:empty { display: none; }")
|
||||
expect(css).toContain('.btn:hover .chev, #settingsBtn[aria-expanded="true"] .chev { opacity: .9; }')
|
||||
expect(css).toContain('#settingsBtn[aria-expanded="true"] .chev { transform: rotate(180deg); }')
|
||||
expect(css).toMatch(/\.lang-select\s*\{[^}]*appearance:\s*none;/)
|
||||
expect(css).toMatch(/\.lang-select\s*\{[^}]*viewBox='0 0 10 6'/)
|
||||
expect(css).toMatch(/prefers-reduced-motion:\s*reduce[\s\S]*\.chev/)
|
||||
})
|
||||
|
||||
// ---- the host part --------------------------------------------------------
|
||||
|
||||
test("the host part writes what it reads, and changes no request", async () => {
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Agent Office</title>
|
||||
<link rel="stylesheet" href="style.css?v=a820f2ad2469">
|
||||
<link rel="stylesheet" href="style.css?v=f600355d91db">
|
||||
<script src="_magpie/bridge.js"></script>
|
||||
<script src="agents.js?v=d958111cd669"></script>
|
||||
<script src="model.js?v=c9ecf328609f"></script>
|
||||
<script src="model.js?v=ba46364dfbb1"></script>
|
||||
<script src="icons.js?v=e918b44d46c2"></script>
|
||||
<script src="scene.js?v=b27c2e100f3a"></script>
|
||||
<script src="scene.js?v=097cc0a3eec6"></script>
|
||||
<script src="three.min.js?v=5b5a0ae404b6"></script>
|
||||
<script src="scene3d.js?v=f6a154f817d4"></script>
|
||||
<script src="app.js?v=6870203d5ce8" defer></script>
|
||||
<script src="scene3d.js?v=b666062a087d"></script>
|
||||
<script src="app.js?v=b681f2393c97" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<main class="card" id="card">
|
||||
@@ -44,7 +44,7 @@
|
||||
<button type="button" class="btn" id="sideBtn" aria-pressed="true"><span data-t="panel">Panel</span></button>
|
||||
<button type="button" class="btn" id="pip" data-t="pip">Picture in picture</button>
|
||||
<div class="menu-wrap">
|
||||
<button type="button" class="btn" id="settingsBtn" aria-haspopup="true" aria-expanded="false"><span data-t="settings">Settings</span> <span class="chev">⌄</span></button>
|
||||
<button type="button" class="btn" id="settingsBtn" aria-haspopup="true" aria-expanded="false"><span data-t="settings">Settings</span><svg class="chev" viewBox="0 0 10 6" width="10" height="6" aria-hidden="true"><path d="M1.25 1.25L5 4.75L8.75 1.25" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
|
||||
<div class="menu wide" id="settings" hidden>
|
||||
<label class="row"><input type="checkbox" id="optDemo"> <span data-t="demo">Sample agents</span></label>
|
||||
<label class="row"><input type="checkbox" id="optDone"> <span data-t="showDone">Show finished agents</span></label>
|
||||
|
||||
@@ -54,10 +54,12 @@ h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 21px;
|
||||
.seg.small { background: var(--card); border: 1px solid var(--line); }
|
||||
.seg.small button { padding: 3px 9px; font-size: 12px; }
|
||||
.seg.small button[aria-selected="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
|
||||
.btn { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 15px; font-size: 14px; cursor: pointer; }
|
||||
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 7px 15px; font-size: 14px; cursor: pointer; }
|
||||
.btn:hover { border-color: var(--muted); }
|
||||
.btn.on { background: #1f1f22; color: #fff; }
|
||||
.chev { font-size: 11px; opacity: .6; margin-left: 2px; }
|
||||
.chev { display: block; flex: none; opacity: .55; transition: transform .16s ease, opacity .16s ease; }
|
||||
.btn:hover .chev, #settingsBtn[aria-expanded="true"] .chev { opacity: .9; }
|
||||
#settingsBtn[aria-expanded="true"] .chev { transform: rotate(180deg); }
|
||||
.menu-wrap { position: relative; }
|
||||
.menu { position: fixed; right: auto; top: 0; z-index: 50; width: 260px; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .16); }
|
||||
.menu .row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
|
||||
@@ -171,6 +173,7 @@ footer { padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
|
||||
/* ---- workbench additions: grouped list, side rail, Today, transcript ---- */
|
||||
.menu.wide { width: 300px; max-height: min(72vh, 520px); overflow: auto; }
|
||||
.today-tokens { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
|
||||
.today-tokens:empty { display: none; }
|
||||
.today-panel { width: min(340px, calc(100vw - 36px)); max-height: min(70vh, 480px); overflow: auto; }
|
||||
.today-big { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
|
||||
.today-big div { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; }
|
||||
@@ -197,7 +200,9 @@ footer { padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.agent-filter .af input { margin: 0; accent-color: var(--accent); }
|
||||
.agent-filter .afn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.agent-filter .afc { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
|
||||
.lang-select { width: 100%; margin-top: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 13px; }
|
||||
.lang-select { width: 100%; margin-top: 6px; padding: 6px 28px 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' width='10' height='6'%3E%3Cpath d='M1.25 1.25L5 4.75L8.75 1.25' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 10px 6px; color: var(--fg); font: inherit; font-size: 13px; cursor: pointer; -webkit-appearance: none; appearance: none; }
|
||||
.lang-select:hover { border-color: var(--muted); }
|
||||
[data-theme="dark"] .lang-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' width='10' height='6'%3E%3Cpath d='M1.25 1.25L5 4.75L8.75 1.25' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
|
||||
|
||||
/* the list's three groups, as sticky-ish heading rows */
|
||||
tr.group td { background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 12px 14px 5px; border-bottom: 1px solid var(--line); }
|
||||
@@ -277,3 +282,7 @@ tr.group:hover td { background: var(--bg); }
|
||||
.pop .msg.assistant { background: rgba(16, 185, 129, .10); }
|
||||
.pop .pf { flex-wrap: wrap; }
|
||||
.pop .pm { flex: 1 1 120px; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.eyes i::after, .counts.alert .need i, .live i, .pop, .toast, .chev { animation: none !important; transition: none !important; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user