From 490d2ea362c79ecc060d427e5b9f3bef34b44d1f Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 6 Oct 2026 19:18:07 +0800 Subject: [PATCH] =?UTF-8?q?gui:=20the=20tray=20panel's=20Allowances=20tab?= =?UTF-8?q?=20hides=20subscriptions=20and=20moves=20them,=20from=20an=20Ar?= =?UTF-8?q?range=20at=20its=20foot=20(H20=20on=20Discord:=20"=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=8F=E7=9A=84=E8=AF=A6=E6=83=85=E9=A1=B5=E8=83=BD?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E9=80=89=E6=8B=A9=E6=9F=90=E4=BA=9B=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=9C=89=E7=82=B9=E9=A2=9D=E5=BA=A6?= =?UTF-8?q?=E5=B9=B6=E4=B8=8D=E6=83=B3=E7=9C=8B=E5=88=B0=E6=88=96=E8=80=85?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=B0=83=E6=95=B4=E9=A1=BA=E5=BA=8F=EF=BC=8C?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E7=9A=84=E8=BF=98=E4=B8=8D=E8=A1=8C")=20?= =?UTF-8?q?=E2=80=94=20the=20panel's=20tab=20already=20followed=20the=20Us?= =?UTF-8?q?age=20page's=20order=20(usageOrder,=20byUsageOrder),=20but=20it?= =?UTF-8?q?=20could=20be=20set=20only=20by=20dragging=20a=20card's=20logo?= =?UTF-8?q?=20on=20the=20window's=20Usage=20page,=20which=20nothing=20in?= =?UTF-8?q?=20the=20panel=20said,=20and=20there=20was=20no=20way=20to=20le?= =?UTF-8?q?ave=20a=20subscription=20out=20of=20the=20panel=20at=20all.=20T?= =?UTF-8?q?he=20tab's=20foot=20now=20has=20Arrange,=20and=20"{n}=20hidden"?= =?UTF-8?q?=20beside=20it=20when=20some=20are:=20Arrange=20lists=20a=20row?= =?UTF-8?q?=20a=20subscription=20(balances=20too)=20in=20the=20shared=20or?= =?UTF-8?q?der,=20its=20logo=20the=20handle=20(a=20drag,=20or=20Alt+arrows?= =?UTF-8?q?;=20the=20grip=20by=20it=20on=20hover=20only,=20as=20on=20the?= =?UTF-8?q?=20Usage=20page)=20and=20a=20Hide/Show=20pill,=20under=20a=20no?= =?UTF-8?q?te=20that=20hiding=20is=20the=20panel's=20only=20and=20the=20or?= =?UTF-8?q?der=20is=20the=20Usage=20page's=20too;=20Done=20draws=20the=20c?= =?UTF-8?q?ards=20again.=20What's=20hidden=20is=20kept=20in=20magpie's=20s?= =?UTF-8?q?ettings=20(settings.PanelUsageHidden,=20panelUsageHidden),=20no?= =?UTF-8?q?t=20the=20browser:=20routing,=20caps,=20the=20Usage=20page=20an?= =?UTF-8?q?d=20the=20menu=20bar's=20cells=20still=20have=20it,=20and=20a?= =?UTF-8?q?=20menu=20bar=20cell=20for=20a=20hidden=20subscription=20still?= =?UTF-8?q?=20opens=20its=20card=20(panelPeek)=20until=20the=20panel=20is?= =?UTF-8?q?=20put=20away=20or=20the=20tab=20left.=20POST=20/api/usage/arra?= =?UTF-8?q?nge=20takes=20order=20and=20panelHidden=20and=20changes=20only?= =?UTF-8?q?=20the=20one=20it=20is=20sent=20(both=20were=20whole-order=20be?= =?UTF-8?q?fore;=20an=20order=20alone=20still=20works),=20and=20the=20Sett?= =?UTF-8?q?ings=20save=20keeps=20panelUsageHidden=20as=20it=20does=20usage?= =?UTF-8?q?Order.=20Saves=20draw=20at=20once=20and=20are=20put=20back=20wi?= =?UTF-8?q?th=20the=20error=20if=20they=20fail;=20no=20click=20moves=20the?= =?UTF-8?q?=20page=20(the=20view's=20scroll=20is=20kept=20across=20the=20r?= =?UTF-8?q?edraw);=20no=20native=20select,=20no=20left-border=20stripe.=20?= =?UTF-8?q?Which=20allowances=20the=20menu=20bar=20shows=20beside=20its=20?= =?UTF-8?q?icon=20stays=20Settings'=20pick=20(trayUsages).=20New=20t()=20s?= =?UTF-8?q?trings=20have=20zh,=20ja=20and=20de.=20TestUsageArrangePanelHid?= =?UTF-8?q?den=20(each=20field=20set=20and=20cleared=20on=20its=20own,=20a?= =?UTF-8?q?=20Settings=20save=20between)=20passes=20-race=20-count=3D20,?= =?UTF-8?q?=20TestSettingsSaveKeepsWhatItDoesNotSend's=20fixture=20names?= =?UTF-8?q?=20the=20field.=20panel-arrange.test.cjs=20(440px:=20the=20hidd?= =?UTF-8?q?en=20card=20left=20out=20and=20counted,=20Arrange=20keeping=20t?= =?UTF-8?q?he=20reader's=20scroll,=20the=20rows=20and=20note,=20the=20hove?= =?UTF-8?q?r-only=20grip,=20no=20stripe,=20no=20sideways=20overflow,=20Sho?= =?UTF-8?q?w/Hide=20posting=20panelHidden=20without=20a=20scroll=20and=20a?= =?UTF-8?q?=20failed=20save=20put=20back,=20Alt+arrow=20and=20a=20drag=20p?= =?UTF-8?q?osting=20the=20order,=20Done's=20cards=20in=20it,=20a=20menu=20?= =?UTF-8?q?bar=20cell=20opening=20a=20hidden=20card=20until=20the=20panel?= =?UTF-8?q?=20hides,=20the=20Usage=20page=20keeping=20the=20hidden=20card)?= =?UTF-8?q?=20passes=20on=20Chromium=20and=20WebKit=20in=20en,=20zh,=20ja?= =?UTF-8?q?=20and=20de;=20click-scroll,=20gui-ja,=20gui-de,=20i18n-keys,?= =?UTF-8?q?=20panel-fold,=20panel-usage,=20quota-*,=20routing-quota-left,?= =?UTF-8?q?=20tray-cell-click,=20tray-inuse,=20tray-logos,=20tray-usages,?= =?UTF-8?q?=20usage-accounts(-fold),=20usage-arrange,=20usage-fold,=20usag?= =?UTF-8?q?e-quota-head,=20usage-card-refresh,=20usage-stale-answer,=20usa?= =?UTF-8?q?ge-remote-cards,=20api-key-usage,=20claude-usage-asked=20and=20?= =?UTF-8?q?usage-checkin=20pass=20on=20both.=20go=20test=20-tags=20nogui?= =?UTF-8?q?=20./internal/...=20under=20a=20temp=20HOME,=20go=20vet,=20gofm?= =?UTF-8?q?t=20-l,=20linux=20(nogui)=20and=20windows=20builds=20pass.=20No?= =?UTF-8?q?t=20tried=20in=20the=20real=20tray=20panel=20on=20a=20Mac.=20do?= =?UTF-8?q?cs/reference.md=20and=20docs/subsystems/gui-shell.md=20say=20it?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/reference.md | 10 ++ docs/subsystems/gui-shell.md | 1 + internal/gui/api.go | 18 ++- internal/gui/assets/app.css | 21 +++ internal/gui/assets/app.js | 119 ++++++++++++++- internal/gui/assets/i18n.js | 15 ++ internal/gui/settings_keep_test.go | 1 + internal/gui/tests/README.md | 12 ++ internal/gui/tests/panel-arrange.test.cjs | 177 ++++++++++++++++++++++ internal/gui/usage_arrange_test.go | 51 +++++++ internal/settings/settings.go | 6 + 11 files changed, 426 insertions(+), 5 deletions(-) create mode 100644 internal/gui/tests/panel-arrange.test.cjs create mode 100644 internal/gui/usage_arrange_test.go diff --git a/docs/reference.md b/docs/reference.md index 1b12a8d8..02a789da 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -882,6 +882,16 @@ It changes the gateway's routing only, never the account Codex is signed in to. The credits an account holds show beside its windows in `magpie quota`, `magpie accounts`, the Usage page and the menu bar panel. +The Usage page's cards and the menu bar panel's *Allowances* tab are in one +order: drag a card's logo on the Usage page (or Alt+arrow keys on it), or +press *Arrange* at the foot of the panel's tab and move the rows there. The +same *Arrange* hides a subscription from the panel's tab (*Hide*, *Show* +puts it back), and the tab's foot says how many are hidden. Hiding is the +panel's only: routing, caps, the Usage page and the menu bar's own cells +still have it, and a menu bar cell for it still opens its card. Both are +kept in magpie's settings (`usageOrder`, `panelUsageHidden`). Which +allowances the menu bar itself shows beside its icon is picked in Settings. + The *Gateway* tab in the app has this as copy buttons and ready-made snippets (shell, curl, Python, Node) for each API, the list of model ids, and the recent calls; `MAGPIE_DEBUG=1` logs every call to the terminal. diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 1f045d55..0ad3360a 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -32,6 +32,7 @@ three. - Every user-visible string has zh, ja and de translations with the same placeholders. `gui-ja.test.cjs` and `gui-de.test.cjs` fail on a missing one. - A click never moves the page. Code scrolls a view only with the reader's event in hand (`scrollOnPurpose`); `click-scroll.test.cjs` guards this. - There are no native `