A local-first multi-agent app development platform, built on PenguinHarness
feat(web): 默认中文与人民币、快捷指令可折叠、模型库去掉连接横幅、插件导入规则另起 dialog
lmlihengeaa818fa8828
diff --git a/packages/web/src/features/chat/draft-view.tsx b/packages/web/src/features/chat/draft-view.tsxindex 878e8f39..0344b24c 100644--- a/packages/web/src/features/chat/draft-view.tsx+++ b/packages/web/src/features/chat/draft-view.tsx@@ -917,11 +917,12 @@ export function DraftView({{/* The user's own saved prompts, the only folder left under the input card (seeshortcuts-folder.tsx): a click fills the composer with the prompt and the usersends it. Closed on arrival, so the new-chat screen is the brand, the input card- and the two ownership pills unless the reader asks for more. */}+ and the two ownership pills unless the reader asks for more — and its own header+ folds it back up. */}<div className="mt-6 space-y-1"><ShortcutsFolderopen={shortcutsOpen}- onOpen={() => setShortcutsOpen(true)}+ onToggle={() => setShortcutsOpen((open) => !open)}readComposerText={() => textRef.current}onFill={fillShortcut}/>diff --git a/packages/web/src/features/chat/folder-row.tsx b/packages/web/src/features/chat/folder-row.tsxindex 87a03f33..bf80aebd 100644--- a/packages/web/src/features/chat/folder-row.tsx+++ b/packages/web/src/features/chat/folder-row.tsx@@ -1,6 +1,7 @@/**- * The header row of the draft screen's folder of saved prompts: a tab, not a disclosure — the- * open folder stays open (clicking it is a no-op) and carries the body below it.+ * The header row of the draft screen's folder of saved prompts: a disclosure that toggles. It+ * was a tab once — open it and it stayed open — and the row's own chevron then promised a+ * collapse it did not have, so the click now flips the state it shows.*/import { Chevron, ICON_SIZE } from "@lmliheng/penguin-ui";@@ -9,7 +10,7 @@ export function FolderRow({glyph,label,count,- onOpen,+ onToggle,}: {open: boolean;/** 24x24 path for the folder's own mark — what the eye scans to pick a category. */@@ -17,13 +18,14 @@ export function FolderRow({label: string;/** Rows inside the folder, shown right of the name — a bare count, or `used/limit` where one applies. */count: number | string;- onOpen: () => void;+ /** Flip the folder: opening shows the body below, closing puts it away again. */+ onToggle: () => void;}) {return (<buttontype="button"aria-expanded={open}- onClick={onOpen}+ onClick={onToggle}className={`flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 ${open ? "bg-gray-100 dark:bg-gray-800/70" : "hover:bg-gray-100 dark:hover:bg-gray-800/70"}`}diff --git a/packages/web/src/features/chat/shortcuts-folder.tsx b/packages/web/src/features/chat/shortcuts-folder.tsxindex babe922b..4aacc65a 100644--- a/packages/web/src/features/chat/shortcuts-folder.tsx+++ b/packages/web/src/features/chat/shortcuts-folder.tsx@@ -46,9 +46,9 @@ import {import type { ShortcutDraft, UserShortcut } from "./user-shortcuts";/**- * Lightning bolt (lucide zap): the folder's mark. Not the bookmark it might suggest — the row- * itself already behaves bookmark-style (open once, then it stays open), so that glyph would- * name the mechanism instead of what this folder holds.+ * Lightning bolt (lucide zap): the folder's mark. A bookmark glyph would name the mechanism —+ * the rows inside are what get clicked to fill the composer — rather than what this folder+ * holds, and the header's own chevron already says open or shut.*/const SHORTCUTS_GLYPH ="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z";@@ -84,12 +84,13 @@ function RowAction({export function ShortcutsFolder({open,- onOpen,+ onToggle,readComposerText,onFill,}: {open: boolean;- onOpen: () => void;+ /** Flip the folder open or shut; the header row carries the chevron that shows which it is. */+ onToggle: () => void;/** The composer's current text, read at click time — a new shortcut starts from what was typed. */readComposerText: () => string;/** Hand the saved prompt to the composer. Pins no Skills; see user-shortcuts.ts. */@@ -152,7 +153,7 @@ export function ShortcutsFolder({glyph={SHORTCUTS_GLYPH}label={S.chat.shortcuts.folder}count={`${shortcuts.length}/${SHORTCUT_MAX_COUNT}`}- onOpen={onOpen}+ onToggle={onToggle}/>{open && (diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsxindex 88c10435..174d0cd6 100644--- a/packages/web/src/features/models/models-page.tsx+++ b/packages/web/src/features/models/models-page.tsx@@ -20,8 +20,9 @@* with that group pre-filled. The protocol follows group semantics: custom / user-defined* groups pick or detect it, a group that pins one (vLLM) hands it to every entry. The "get* model id / API key" external links sit next to the corresponding input's label in the- * dialogs, never in the header. A TokenDance banner above the groups offers its connect flow- * until the group holds a key. The group list ends with an "add group" action (user-defined+ * dialogs, never in the header. Nothing is pitched above the groups: a group carries its own+ * Connect action (with a status dot), and that is the one entry to authorizing it. The group+ * list ends with an "add group" action (user-defined* groups share custom's semantics; the group appears once the first model saves successfully —* groups are carried by the model entry's provider field, not persisted separately). The* header also holds an owner-only "sync presets" action next to the search box (union-merge@@ -163,7 +164,6 @@ import {import type { GroupHeaderAction } from "./group-header";import { GroupBalance } from "./group-balance";import { isPinned, usePinnedBalance } from "./balance";-import { TOKENDANCE_PROVIDER_ID, TokenDanceBanner } from "./tokendance-banner";/*** The authorization flows a group's Connect dialog can run, keyed by the flow named in that@@ -1188,10 +1188,6 @@ export function ModelsPage() {const oauthFlow = oauthFor === null ? undefined : providerInfo(oauthFor)?.bridgeAuth?.flow;const oauthKeyAuth = oauthFlow === undefined ? null : KEY_AUTH[oauthFlow];- /** TokenDance's rows, for the banner: shown while the group has models and none of them a key. */- const tokenDanceRows = rows?.filter((row) => row.provider === TOKENDANCE_PROVIDER_ID) ?? [];- const showTokenDanceBanner = tokenDanceRows.length > 0 && !groupKeyStored(tokenDanceRows);-/*** One of a group header's actions (group-header.ts decides which, and in what order). Every* button keeps an accessible name of "action group" and a title; on a narrow header the ones@@ -1414,17 +1410,6 @@ export function ModelsPage() {)}</PageHeader>- {/* Above every group, while the TokenDance group has models but no key: its own connect- flow, pitched as the way to skip setting keys by hand. */}- {isOwner && showTokenDanceBanner && (- <TokenDanceBanner- onConnect={() => {- keyLanded.current = false;- setOauthFor(TOKENDANCE_PROVIDER_ID);- }}- />- )}-{rows === null ? (<SkeletonList rows={4} />) : rows.length === 0 ? (diff --git a/packages/web/src/features/models/tokendance-banner.tsx b/packages/web/src/features/models/tokendance-banner.tsxdeleted file mode 100644index 09bc06e4..00000000--- a/packages/web/src/features/models/tokendance-banner.tsx+++ /dev/null@@ -1,90 +0,0 @@-/**- * The banner above every group on the models page: TokenDance's own connect flow, offered as the- * way to skip setting model keys by hand. The page shows it to the owner while the TokenDance- * group has models and no stored key; once dismissed it stays hidden in this browser.- *- * Its slow highlight sweep is the one decoration on the page, asked for by name, and it crosses- * the brand name only; the rest of the banner stands still. It is CSS only (`.banner-shimmer`- * in styles.css), and the word's resting state is plain ink, so the global reduced-motion rule- * leaves it plain.- */-import { useState } from "react";-import { providerInfo } from "@lmliheng/penguin-core/model-catalog";-import { Button, CloseButton, ICON_GAP, ProviderLogo } from "@lmliheng/penguin-ui";-import { S } from "../../lib/strings";--/** The group the banner connects: it is TokenDance's by name, so it names the group too. */-export const TOKENDANCE_PROVIDER_ID = "tokendance";--/**- * The banner's sentence split around the brand name, so the sweep can ride that word alone;- * null when a wording does not carry the name, which then shows plain.- */-export function splitBrand(text: string, brand: string): [before: string, after: string] | null {- const at = brand === "" ? -1 : text.indexOf(brand);- return at === -1 ? null : [text.slice(0, at), text.slice(at + brand.length)];-}--/** The localStorage key remembering the dismissal: a display preference of this browser. */-export const TOKENDANCE_BANNER_DISMISSED_KEY = "penguin.tokenDanceBannerDismissed";--/** Minimal storage surface; tests inject an in-memory one. */-export interface BannerStorage {- getItem(key: string): string | null;- setItem(key: string, value: string): void;-}--/** Storage that is missing or refuses to answer reads as "not dismissed": the banner shows. */-export function bannerDismissed(storage?: BannerStorage): boolean {- try {- return (storage ?? localStorage).getItem(TOKENDANCE_BANNER_DISMISSED_KEY) === "1";- } catch {- return false;- }-}--function rememberDismissal(): void {- try {- localStorage.setItem(TOKENDANCE_BANNER_DISMISSED_KEY, "1");- } catch {- // The banner still goes away for this page view; only the memory of it is lost.- }-}--export function TokenDanceBanner({ onConnect }: { onConnect: () => void }) {- const [dismissed, setDismissed] = useState(() => bannerDismissed());- if (dismissed) return null;- const brand = providerInfo(TOKENDANCE_PROVIDER_ID)?.label ?? "TokenDance";- const parts = splitBrand(S.models.tokenDanceBanner, brand);- return (- <div- className={`mb-3 flex items-center ${ICON_GAP.card} rounded-md border border-gray-200 bg-gray-100 py-2.5 pl-3.5 pr-2 dark:border-gray-800 dark:bg-gray-900`}- >- <ProviderLogo- provider="tokendance"- className="h-6 w-6 shrink-0 text-gray-900 dark:text-gray-100"- />- <p className="min-w-0 flex-1 text-sm text-gray-700 dark:text-gray-300">- {parts === null ? (- S.models.tokenDanceBanner- ) : (- <>- {parts[0]}- <span className="banner-shimmer">{brand}</span>- {parts[1]}- </>- )}- </p>- <Button size="sm" variant="primary" className="shrink-0" onClick={onConnect}>- {S.models.oauthKey}- </Button>- <CloseButton- className="shrink-0"- onClose={() => {- rememberDismissal();- setDismissed(true);- }}- />- </div>- );-}diff --git a/packages/web/src/features/plugins/plugin-import-dialog.tsx b/packages/web/src/features/plugins/plugin-import-dialog.tsxindex 0c2c51c8..ce84ae12 100644--- a/packages/web/src/features/plugins/plugin-import-dialog.tsx+++ b/packages/web/src/features/plugins/plugin-import-dialog.tsx@@ -17,12 +17,11 @@* name rule while it is typed, so a name the route would answer 400 for cannot reach the* submit button.*- * Both dialogs end with the same panel of rules (see PluginRules), in two lists: what the import- * takes — which sources, where the plugin root is found, the precedence the plugin NAME is- * decided by, the size caps, and what happens on a name collision — and what a plugin has to be,- * for whoever is about to publish one. It sits at the foot so the reader meets each rule just- * after the control it governs, and it is identical in both dialogs because it describes the- * shape a plugin has to arrive in rather than one source's mechanics.+ * The rules (see PluginRules) sit behind one link at the foot of each dialog instead of opening+ * under it: two numbered lists of prose, one about what an import takes and one about what a+ * plugin has to be, are reference material for whoever is about to publish one — not something+ * to read every time a plugin is installed, and as a panel it pushed the fields and the confirm+ * button off the screen. The link keeps them one click away, in the same two blocks.** Admin-only by the server's own rule: the plugin directory is a server-level resource shared* by every Project, so a member cannot write into it — the caller (plugins-page) renders this@@ -33,7 +32,10 @@ import type { ChangeEvent } from "react";import {Button,ConfirmModal,+ GlyphIcon,HiddenFileInput,+ ICONS,+ ICON_SIZE,Input,Modal,toastError,@@ -121,6 +123,43 @@ function RuleList({ title, rules }: { title: string; rules: readonly string[] }));}+/**+ * The same rules in a dialog of their own, opened by the link at the foot of each import dialog.+ * The body is the shared PluginRules panel verbatim, so the two surfaces cannot drift; only the+ * frame around it is new.+ */+function PluginRulesDialog({ open, onClose }: { open: boolean; onClose: () => void }) {+ return (+ <Modal+ open={open}+ title={S.plugins.rulesTitle}+ onClose={onClose}+ widthClass="sm:max-w-lg"+ footer={+ <Button size="sm" onClick={onClose}>+ {S.common.close}+ </Button>+ }+ >+ <PluginRules />+ </Modal>+ );+}++/** The opener: a text button where the panel used to sit, so the rules stay at the same foot. */+function RulesLink({ onClick }: { onClick: () => void }) {+ return (+ <Button+ variant="link"+ size="xs"+ leading={<GlyphIcon d={ICONS.helpCircle} size={ICON_SIZE.inlineGlyph} />}+ onClick={onClick}+ >+ {S.plugins.rulesLink}+ </Button>+ );+}+export function PluginImportActions({onImported,}: {@@ -138,6 +177,9 @@ export function PluginImportActions({const [downloadName, setDownloadName] = useState("");// The 409 confirmation, and the only state both flows share.const [pending, setPending] = useState<PendingOverwrite | null>(null);+ // The rules dialog is shared by both import dialogs: they describe one plugin shape, so a+ // single open flag keeps the two from stacking two copies of the same prose.+ const [rulesOpen, setRulesOpen] = useState(false);const uploadNameInvalid = pluginNameInvalid(uploadName);const downloadNameInvalid = pluginNameInvalid(downloadName);@@ -334,7 +376,7 @@ export function PluginImportActions({error={uploadNameInvalid ? S.plugins.pluginNameInvalid : undefined}autoComplete="off"/>- <PluginRules />+ <RulesLink onClick={() => setRulesOpen(true)} /></div></Modal>@@ -385,10 +427,15 @@ export function PluginImportActions({error={downloadNameInvalid ? S.plugins.pluginNameInvalid : undefined}autoComplete="off"/>- <PluginRules />+ <RulesLink onClick={() => setRulesOpen(true)} /></div></Modal>+ {/* The rules, one click from either dialog's foot. Above the overwrite confirmation in the+ DOM, because it is opened from a dialog that is still on screen and closes with ESC+ before that one does. */}+ <PluginRulesDialog open={rulesOpen} onClose={() => setRulesOpen(false)} />+{/* Overwrite confirmation: the dialog that asked stays underneath (its Cancel returns toit, file and name both intact), and confirm resends the same request withoverwrite: true. */}diff --git a/packages/web/src/lib/install-scope.ts b/packages/web/src/lib/install-scope.tsindex d651bbf3..7e28b43b 100644--- a/packages/web/src/lib/install-scope.ts+++ b/packages/web/src/lib/install-scope.ts@@ -337,12 +337,6 @@ export const KEY_RULES: readonly KeyRule[] = [scope: "browser",why: "That company mode's beta notice has been shown in this browser; it names nothing on the server, and a wipe is not a request to show it again.",},- {- kind: "exact",- key: "penguin.tokenDanceBannerDismissed",- scope: "browser",- why: "That the models page's TokenDance banner was dismissed in this browser; it names nothing on the server, and a wipe is not a request to show it again.",- },{kind: "exact",key: "penguin.lastOrgKey",diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.tsindex 7ee41552..af5a42df 100644--- a/packages/web/src/lib/strings-en.ts+++ b/packages/web/src/lib/strings-en.ts@@ -1600,8 +1600,6 @@ export const en: Strings = {/** Pin toggle before a balance: keeps it beside the user name in the sidebar, one at a time. */pinBalance: "Pin beside your name",unpinBalance: "Unpin",- /** The banner above every group: TokenDance's own connect flow, pitched as the way to skip keys. */- tokenDanceBanner: "Connect your TokenDance wallet — no model keys to set by hand",oauthTitle: (label: string): string => `Authorize a new ${label} API key`,oauthIntro: (label: string, n: number): string =>`A new API key will be created on your ${label} account and written to all ${n} models in this group, replacing the key they use now.`,@@ -2146,6 +2144,10 @@ export const en: Strings = {/** Client-side refusal of a picked zip over the decoded-archive cap; the file is dropped unread, so the server's own 413 never has to be earned. */importTooLarge: (mb: number): string =>`A plugin archive cannot exceed ${mb} MB \u2014 compress it and try again`,+ /** The link at the foot of both import dialogs that opens the rules; see rulesTitle. */+ rulesLink: "Import and authoring rules",+ /** The dialog those rules now live in, where they used to be printed under the dialogs. */+ rulesTitle: "Plugin import and authoring rules",/*** The import rules, shown as one numbered block at the foot of BOTH dialogs: they are the* shape a plugin has to arrive in, not the property of one source, and a reader who openeddiff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.tsindex fae83ad6..dfe0f629 100644--- a/packages/web/src/lib/strings.ts+++ b/packages/web/src/lib/strings.ts@@ -1654,8 +1654,6 @@ export const zh = {/** Pin toggle before a balance: keeps it beside the user name in the sidebar, one at a time. */pinBalance: "常驻到用户名旁",unpinBalance: "取消常驻",- /** The banner above every group: TokenDance's own connect flow, pitched as the way to skip keys. */- tokenDanceBanner: "连接 TokenDance 钱包,无需手动配置模型密钥",oauthTitle: (label: string): string => `从「${label}」授权新建 API key`,oauthIntro: (label: string, n: number): string =>`将在你的 ${label} 账户下新建一个 API key,并写入该分组下全部 ${n} 个模型,覆盖它们当前的 key。`,@@ -2187,6 +2185,10 @@ export const zh = {importDownloading: "下载中…",/** Client-side refusal of a picked zip over the decoded-archive cap; the file is dropped unread, so the server's own 413 never has to be earned. */importTooLarge: (mb: number): string => `插件包不能超过 ${mb} MB,请压缩后重试`,+ /** The link at the foot of both import dialogs that opens the rules; see rulesTitle. */+ rulesLink: "导入与编写规则",+ /** The dialog those rules now live in, where they used to be printed under the dialogs. */+ rulesTitle: "插件导入与编写规则",/*** The import rules, shown as one numbered block at the foot of BOTH dialogs: they are the* shape a plugin has to arrive in, not the property of one source, and a reader who openeddiff --git a/packages/web/src/state/locale.tsx b/packages/web/src/state/locale.tsxindex 7a534f09..3e8884b9 100644--- a/packages/web/src/state/locale.tsx+++ b/packages/web/src/state/locale.tsx@@ -4,6 +4,10 @@* then remounts the whole tree keyed on locale so every `S.x` read immediately reflects the* new language; the preference persists to localStorage. The shared UI package's accessibility* fallbacks (a close cross's name, a "Copied" announcement) are handed the same language here.+ *+ * With nothing stored the language is **zh**, not "follow the device": this product is written+ * for a Chinese-reading owner first, and an English device language is not evidence that its+ * reader wants the English dictionary. "system" stays as a choice the Appearance settings offer.*/import { createContext, useCallback, useContext, useEffect, useState } from "react";import type { ReactNode } from "react";@@ -42,10 +46,11 @@ function resolve(lang: LangPref): Locale {return lang === "system" ? systemLocale() : lang;}+/** No stored preference → zh (see this module's header); a stored one is honoured as-is. */function initialLang(): LangPref {const stored = localStorage.getItem(STORAGE_KEY);if (stored === "zh" || stored === "en" || stored === "system") return stored;- return "system";+ return "zh";}export function LocaleProvider({ children }: { children: ReactNode }) {diff --git a/packages/web/src/state/theme.tsx b/packages/web/src/state/theme.tsxindex b12bebe7..49f9aa9a 100644--- a/packages/web/src/state/theme.tsx+++ b/packages/web/src/state/theme.tsx@@ -109,8 +109,9 @@ function initialToolAliases(): boolean {return localStorage.getItem(TOOL_ALIASES_KEY) !== "0";}+/** No stored preference → CNY (this product bills a Chinese-reading owner first); a stored one is honoured as-is. */function initialCurrency(): Currency {- return localStorage.getItem(CURRENCY_KEY) === "CNY" ? "CNY" : "USD";+ return localStorage.getItem(CURRENCY_KEY) === "USD" ? "USD" : "CNY";}function systemDark(): boolean {diff --git a/packages/web/src/styles.css b/packages/web/src/styles.cssindex 2a24e5a0..cea6da2f 100644--- a/packages/web/src/styles.css+++ b/packages/web/src/styles.css@@ -351,42 +351,6 @@animation: browser-agent-ring 1.6s ease-in-out infinite;}-/* The models page's TokenDance banner (features/models/tokendance-banner.tsx): a slow highlight- sweeps across the brand name alone every 6 s — the page's single decoration, asked for by- name; the rest of the banner stands still. The word is painted by a gradient clipped to its- glyphs: its own ink on both sides of a narrow bright band, three times the word's width. The- band sweeps from before the word to past its end, and the word's own resting position shows- ink only, so under the global `animation: none` below it is plain text. */-@keyframes banner-shimmer {- 0% {- background-position: 100% 0;- }- 30%,- 100% {- background-position: 0% 0;- }-}-.banner-shimmer {- --banner-ink: var(--color-gray-700);- --banner-glow: var(--color-gray-300);- background-image: linear-gradient(- 100deg,- var(--banner-ink) 42%,- var(--banner-glow) 50%,- var(--banner-ink) 58%- );- background-size: 300% 100%;- background-position: 0% 0;- -webkit-background-clip: text;- background-clip: text;- color: transparent;- animation: banner-shimmer 6s ease-in-out infinite;-}-.dark .banner-shimmer {- --banner-ink: var(--color-gray-300);- --banner-glow: var(--color-white);-}-/* Login page circuit traces (login-circuit.tsx): pathLength=1 normalization, draw-in -> hold -> fade-outloop. Base state is fully hidden: the positive animation-delay wait keeps the first paint blank, andlines only start growing after load; once reduced-motion globally disables animation, the override belowdiff --git a/packages/web/test/model-balance.test.ts b/packages/web/test/model-balance.test.tsindex b4e109bf..022f48f5 100644--- a/packages/web/test/model-balance.test.ts+++ b/packages/web/test/model-balance.test.ts@@ -1,11 +1,8 @@/*** Group balances in the Web App: how an amount reads (balance.ts) — in the vendor's own figures* and in the display currency — what the header and the sidebar show for each state of a- * reading (group-balance.tsx), how the per-account pin is read back out of the free-form prefs,- * and the TokenDance banner: its per-browser dismissal, and a sweep that rides the brand name.+ * reading (group-balance.tsx), and how the per-account pin is read back out of the free-form prefs.*/-import { createElement } from "react";-import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it } from "vitest";import type { ModelBalanceResponse } from "@lmliheng/penguin-server/api";import {@@ -16,14 +13,7 @@ import {parsePinnedBalance,} from "../src/features/models/balance";import { balanceView } from "../src/features/models/group-balance";-import {- TOKENDANCE_BANNER_DISMISSED_KEY,- TokenDanceBanner,- bannerDismissed,- splitBrand,-} from "../src/features/models/tokendance-banner";-import { S, zh } from "../src/lib/strings";-import { en } from "../src/lib/strings-en";+import { S } from "../src/lib/strings";const reading: ModelBalanceResponse = {ok: true,@@ -146,44 +136,3 @@ describe("the pinned balance", () => {expect(isPinned(null, "p1", "tokendance")).toBe(false);});});--describe("the TokenDance banner's dismissal", () => {- it("is remembered per browser under its own key", () => {- const store = new Map<string, string>();- const storage = {- getItem: (key: string) => store.get(key) ?? null,- setItem: (key: string, value: string) => void store.set(key, value),- };- expect(bannerDismissed(storage)).toBe(false);- storage.setItem(TOKENDANCE_BANNER_DISMISSED_KEY, "1");- expect(bannerDismissed(storage)).toBe(true);- });-- it("a storage that refuses to answer shows the banner rather than failing", () => {- const broken = {- getItem: (): string | null => {- throw new Error("denied");- },- setItem: () => undefined,- };- expect(bannerDismissed(broken)).toBe(false);- });-});--describe("the TokenDance banner's sweep", () => {- it("rides the brand name alone, in both languages", () => {- for (const text of [zh.models.tokenDanceBanner, en.models.tokenDanceBanner]) {- const parts = splitBrand(text, "TokenDance");- expect(parts, text).not.toBeNull();- expect(`${parts![0]}TokenDance${parts![1]}`).toBe(text);- }- const html = renderToStaticMarkup(createElement(TokenDanceBanner, { onConnect: () => {} }));- expect(html.match(/banner-shimmer/g)).toHaveLength(1);- expect(html).toContain('<span class="banner-shimmer">TokenDance</span>');- });-- it("leaves a wording without the name plain", () => {- expect(splitBrand("Connect your wallet", "TokenDance")).toBeNull();- expect(splitBrand("TokenDance", "")).toBeNull();- });-});diff --git a/packages/web/test/plugin-import-rules.test.ts b/packages/web/test/plugin-import-rules.test.tsindex 421f6188..f7175084 100644--- a/packages/web/test/plugin-import-rules.test.ts+++ b/packages/web/test/plugin-import-rules.test.ts@@ -1,5 +1,6 @@/**- * The plugin rules panel (src/features/plugins/plugin-import-dialog.tsx).+ * The plugin rules panel (src/features/plugins/plugin-import-dialog.tsx), and the dialog it now+ * lives in rather than under the import dialogs' fields.** It states, at the point where an operator is naming a plugin, the rules the form cannot show.* Two of them carry the weight: leave the name empty and it comes from the SOURCE — and a GitHub@@ -71,7 +72,13 @@ describe("PluginRules", () => {expect(authoring).toContain("不要写死默认值");});- it("is rendered by both import dialogs, upload and download", () => {- expect(source.match(/<PluginRules \/>/g) ?? []).toHaveLength(2);+ it("hangs off a link in both import dialogs, and opens in a dialog of its own", () => {+ // One opener per import dialog: the rules are the same for both, so both must reach them.+ expect(+ source.match(/<RulesLink onClick=\{\(\) => setRulesOpen\(true\)\} \/>/g) ?? [],+ ).toHaveLength(2);+ // …and one panel, inside the dialog the openers open — not printed under the fields.+ expect(source.match(/<PluginRules \/>/g) ?? []).toHaveLength(1);+ expect(source).toContain("<PluginRulesDialog open={rulesOpen}");});});