diff --git a/packages/usage/README.md b/packages/usage/README.md index 7de131b..f1d0a6a 100644 --- a/packages/usage/README.md +++ b/packages/usage/README.md @@ -2,7 +2,7 @@ A page in [magpie](https://usemagpie.ai)'s window with your usage at a glance. It shows calls, errors, tokens and cost for today, 7 days or 30 days, and the models that took them. -Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/page-usage`. It then has a tab, **Usage glance**, under Plugins in the sidebar, in the app and in `magpie web`. +Install it from magpie's **Plugins › Discover**, or with `magpie plugin add @magpie-community/page-usage`. It then has a tab, **Usage glance** (titled in the window's language: 用量速览, 用量速覽, 使用量の概要, Nutzung im Überblick), under Plugins in the sidebar, in the app and in `magpie web`. ## What it reads @@ -30,4 +30,4 @@ The page saves the period (`today`, `7d`, `30d`) and the model sort (`tokens`, ` bun test packages/usage ``` -中文:在 magpie 窗口里加一个「Usage glance」页面,一眼看到今天、7 天或 30 天的调用、错误、token 和费用,以及用到的模型。它只读取声明过的 `usage:summary`,运行在无网络的沙盒 frame 里。 +中文:在 magpie 窗口里加一个「用量速览」页面,一眼看到今天、7 天或 30 天的调用、错误、token 和费用,以及用到的模型。它只读取声明过的 `usage:summary`,运行在无网络的沙盒 frame 里。 diff --git a/packages/usage/package.json b/packages/usage/package.json index ad893a7..e1703f1 100644 --- a/packages/usage/package.json +++ b/packages/usage/package.json @@ -1,13 +1,18 @@ { "name": "@magpie-community/page-usage", - "version": "0.1.0", + "version": "0.1.1", "description": "A page in magpie's window with your usage at a glance: calls, errors, tokens and cost for today, 7 or 30 days, and the models that took them", "files": ["page", "README.md"], "keywords": ["magpie", "magpie-page", "usage", "tokens", "cost"], "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/usage" }, "magpie": { - "page": { "title": "Usage glance", "file": "page/index.html", "icon": "page/icon.svg" }, + "page": { + "title": "Usage glance", + "titles": { "zh": "用量速览", "zh-TW": "用量速覽", "ja": "使用量の概要", "de": "Nutzung im Überblick" }, + "file": "page/index.html", + "icon": "page/icon.svg" + }, "permissions": ["usage:summary"], "options": { "period": "today", "sort": "tokens" } } diff --git a/packages/usage/page/style.css b/packages/usage/page/style.css index 69bbe14..15b8eda 100644 --- a/packages/usage/page/style.css +++ b/packages/usage/page/style.css @@ -19,7 +19,9 @@ h2 { font-size: 13px; font-weight: 600; margin: 0; } .seg button { font: inherit; color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 3px 10px; cursor: default; } .seg button[aria-selected="true"] { color: var(--fg); background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); } .seg.small button { padding: 2px 8px; font-size: 12px; } -.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 22px; } +/* four across, two by two when narrow: never a row with a hole in it */ +.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; } +@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } } .tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; } .tile .k { color: var(--muted); font-size: 12px; } .tile .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } diff --git a/packages/usage/usage.test.mjs b/packages/usage/usage.test.mjs index ad1d67d..2731c8f 100644 --- a/packages/usage/usage.test.mjs +++ b/packages/usage/usage.test.mjs @@ -37,7 +37,12 @@ test("asks for one read, usage:summary, and nothing else", () => { test("is a page magpie serves: its files in page/, scripts as files", () => { expect(pkg.main).toBeUndefined() expect(pkg.exports).toBeUndefined() - expect(pkg.magpie.page).toEqual({ title: "Usage glance", file: "page/index.html", icon: "page/icon.svg" }) + expect(pkg.magpie.page).toEqual({ + title: "Usage glance", + titles: { zh: "用量速览", "zh-TW": "用量速覽", ja: "使用量の概要", de: "Nutzung im Überblick" }, + file: "page/index.html", + icon: "page/icon.svg", + }) const html = read("index.html") expect(html).toContain('') // the policy runs no inline script