Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 移除移动端下载弹窗二维码的品牌折射边

Lizi2c3b3be731e5
diff --git a/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx b/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
index d54bc167ad..5cfdf5ef6c 100644
--- a/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
@@ -619,40 +619,34 @@ describe('MobileDownloadDialog', () => {
);
});
- it('keeps the brand edge inside its registered exception', () => {
- // §15.7 / §14.4 登记的窄范围例外只覆盖「品牌资产 + 纯 transform 的常驻旋转」。
- // 例外之外的两项(卡片阴影、指针 3D 倾斜)必须保持关闭。
+ it('keeps the QR card flat with no brand edge', () => {
+ // 二维码卡回到 DESIGN.md 的中性处理:没有品牌描边、没有阴影、没有指针 3D 倾斜,
+ // 也没有常驻动画(§14.4 红线);唯一动效是 linked ↔ onboarding 的尺寸补间。
expect(source).not.toMatch(/perspective\(|scale3d\(|onPointerMove|requestAnimationFrame/);
expect(source).not.toMatch(/mobile-download-qr-shadow/);
expect(globalStyles).not.toMatch(/--mobile-download-qr-shadow/);
expect(themeColors).not.toMatch(/mobile-download-qr-shadow/);
- // 红蓝只能来自官方 icon 资产,不自写品牌渐变/色值。
+ // 不自写品牌渐变/色值。
expect(source).not.toMatch(/linear-gradient|conic-gradient|#[0-9a-fA-F]{3,8}\b/);
- const cardRule = globalStyles.slice(
- globalStyles.indexOf('.mobile-download-qr-card {'),
- globalStyles.indexOf('.mobile-download-qr-edge {'),
+ // 折射边整层撤除:组件、keyframes、周期 token 都不该再留残骸。
+ expect(source).not.toMatch(/mobile-download-qr-edge/);
+ expect(globalStyles).not.toMatch(
+ /mobile-download-qr-edge|mobile-download-edge-turn|--mobile-download-edge-cycle/,
);
- expect(cardRule).not.toMatch(/box-shadow|animation:|transform:/);
+ // 官方 icon 只剩弹窗头部这一处(import + 一次使用)。
+ expect(source.match(/cindyIconUrl/g)).toHaveLength(2);
+
+ const cardStart = globalStyles.indexOf('.mobile-download-qr-card {');
+ const cardRule = globalStyles.slice(cardStart, globalStyles.indexOf('}', cardStart) + 1);
+ expect(cardRule).not.toMatch(/box-shadow|animation:|transform:|border/);
expect(cardRule).toMatch(
/transition:\s*\n\s*width var\(--motion-base\) var\(--motion-ease-move\),/,
);
expect(cardRule).toMatch(/height var\(--motion-base\) var\(--motion-ease-move\);/);
-
- // 常驻动画只能碰 transform(合成器层),且必须登记进 reduced-motion 白名单。
- const edgeStart = globalStyles.indexOf('.mobile-download-qr-edge {');
- const edgeRule = globalStyles.slice(
- edgeStart,
- globalStyles.indexOf('@media (prefers-reduced-motion: reduce)', edgeStart),
- );
- expect(edgeRule).toContain(
- 'animation: mobile-download-edge-turn var(--mobile-download-edge-cycle) linear infinite',
- );
- expect(edgeRule).not.toMatch(/filter:|backdrop-filter:|mask-image:|width:|height:/);
- expect(globalStyles).toMatch(/\.mobile-download-qr-edge\s*\{\s*animation: none;\s*transform:/);
});
- it('renders the brand edge behind the QR surface', () => {
+ it('renders the QR as the only image inside the card', async () => {
render(
<MobileDownloadDialog
open
@@ -664,9 +658,11 @@ describe('MobileDownloadDialog', () => {
/>,
);
+ await screen.findByAltText('sidebar.mobileDownload.qrAlt');
const card = screen.getByTestId('mobile-download-qr-card');
- const edge = card.querySelector('.mobile-download-qr-edge');
- expect(edge).toBeTruthy();
- expect(edge?.getAttribute('aria-hidden')).toBe('true');
+ expect(card.querySelector('.mobile-download-qr-edge')).toBeNull();
+ const images = card.querySelectorAll('img');
+ expect(images).toHaveLength(1);
+ expect(images[0]?.getAttribute('alt')).toBe('sidebar.mobileDownload.qrAlt');
});
});
diff --git a/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx b/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
index bd25104007..c18bc43876 100644
--- a/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
@@ -169,10 +169,9 @@ function platformLabel(platform: string | null): string {
/**
* Desktop promotion surface for the regional Cindy mobile download page.
- * The QR edge reuses the official app artwork, so its brand colors stay
- * coupled to the asset instead of introducing component-level color values
- * (registered exception: DESIGN.md §15.7 / §14.4). The card itself carries no
- * shadow and no pointer tilt.
+ * The QR card is a bare code: no brand edge, no border, no shadow and no
+ * pointer tilt — the only brand artwork left in the dialog is the header icon
+ * (DESIGN.md §15.7). Its only motion is the linked ↔ onboarding size tween.
*/
export function MobileDownloadDialog({
open,
@@ -437,7 +436,7 @@ export function MobileDownloadDialog({
data-compact={hasLinkedMobile ? 'true' : 'false'}
aria-label={t('sidebar.mobileDownload.openPage')}
className={cn(
- 'mobile-download-qr-card relative shrink-0 overflow-hidden rounded-xl',
+ 'mobile-download-qr-card shrink-0 overflow-hidden rounded-xl',
hasLinkedMobile ? 'h-[132px] w-[132px]' : 'h-[228px] w-[228px]',
'focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
'disabled:cursor-not-allowed disabled:opacity-60',
@@ -446,22 +445,10 @@ export function MobileDownloadDialog({
void openDownloadPage();
}}
>
- <span
- aria-hidden="true"
- className="mobile-download-qr-edge pointer-events-none absolute inset-[-45%]"
- >
- <img
- src={cindyIconUrl}
- alt=""
- className="h-full w-full select-none object-cover"
- draggable={false}
- />
- </span>
- {/* 2px:1px 时红蓝几乎看不见,3px 起就压成相框边了。 */}
<span
className={cn(
- 'absolute inset-[2px] flex items-center justify-center overflow-hidden',
- 'rounded-[10px] bg-[var(--confirm-bg)]',
+ 'flex h-full w-full items-center justify-center overflow-hidden',
+ 'rounded-xl bg-[var(--confirm-bg)]',
)}
aria-live="polite"
>
diff --git a/apps/desktop/src/renderer/styles/globals.css b/apps/desktop/src/renderer/styles/globals.css
index 53e3233bf8..f2e3325250 100644
--- a/apps/desktop/src/renderer/styles/globals.css
+++ b/apps/desktop/src/renderer/styles/globals.css
@@ -57,8 +57,6 @@
--motion-ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* 入场/展开 */
--motion-ease-in: cubic-bezier(0.4, 0, 1, 1); /* 退场 */
--motion-ease-move: cubic-bezier(0.4, 0, 0.2, 1); /* 位置/尺寸插值 */
- /* 移动端下载卡品牌边的旋转周期(§14.4 登记的第四类常驻动效)。 */
- --mobile-download-edge-cycle: 20s;
}
body {
@@ -197,38 +195,15 @@
}
}
-/* 移动端下载卡:官方 App icon 在 2px 裁切边缘内缓慢旋转,形成与卡片一体的
- 红蓝折射(DESIGN.md §15.7 / §14.4 登记的窄范围例外)。卡片本身不加阴影、
- 不做 3D 倾斜;除品牌边外,唯一动效是设备列表刷新驱动的尺寸补间。 */
-@keyframes mobile-download-edge-turn {
- from {
- transform: rotate(0deg) scale(1.45);
- }
- to {
- transform: rotate(360deg) scale(1.45);
- }
-}
-
+/* 移动端下载卡:只有二维码本身,不加品牌描边、阴影与 3D 倾斜(曾经登记在
+ DESIGN.md §14.4 / §15.7 的旋转折射边已按用户要求撤除)。唯一动效是设备
+ 列表刷新驱动的尺寸补间(132 ↔ 228)。 */
.mobile-download-qr-card {
transition:
width var(--motion-base) var(--motion-ease-move),
height var(--motion-base) var(--motion-ease-move);
}
-/* 只转 transform,不挂 filter/blur:滤镜会让这层每帧重新走一遍 GPU 滤镜通道,
- 而纯 transform 旋转能整层交给合成器,常驻动画不占 CPU。 */
-.mobile-download-qr-edge {
- animation: mobile-download-edge-turn var(--mobile-download-edge-cycle) linear infinite;
- will-change: transform;
-}
-
-@media (prefers-reduced-motion: reduce) {
- .mobile-download-qr-edge {
- animation: none;
- transform: rotate(18deg) scale(1.45);
- }
-}
-
/* 按 <html lang> 切换 CJK 字体栈 —— 同一汉字在中/日/韩字体中字形不同
(康熙体 vs 新字体 vs 한국체);不按 lang 区分会出现"日文界面里的汉字看起来像中文"。
useLocale.ts 在 setLocale 时把 lang 写到 <html>,:lang() 选择器自动接管。
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 0e3110ab53..1138399906 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -587,10 +587,7 @@ Global tokens live in `:root` of `apps/desktop/src/renderer/styles/globals.css`;
- **Form** (finalized over four/five review rounds, 2026-07-23): **true parabolic toss + vanish on landing** — all particles launch simultaneously from the segment center in a ~**100° fan** (±50° of straight up) at equal speed, **constant horizontal velocity + constant vertical gravity** (decelerating up, accelerating down past the apex), so perceived speed is consistent from burst to fall; wider-angle particles fly lower arcs, travel farther, land earlier — the scatter comes from physics, not scripting. The final stretch before the ground line ends in a **short fade**: landing is fine, but lingering after landing ("corpsing") or vanishing without a fade is forbidden; the ground line jitters randomly so landing points don't queue up.
- **Parameter red lines**: a one-shot celebration — simultaneous launch, no stagger delay; per-particle duration follows arc physics clamped to 0.9s–1.6s, total ≈1.6s (the number roll settles at 1.2s, then the last confetti falls a few tenths more; arc scale and rhythm are user-tuned, finalized 2026-07-23); ≤18 particles, 3–5px, torn down when done, never looping or persistent; particles are HTML elements animating only `transform` / `opacity` (compositor-only, engineering conventions §7; x/y split across two nested spans keeps horizontal velocity constant); colors come only from the four status-dot hue exemptions (done green / awaiting teal / thinking orange / error red), same values in both modes; must skip entirely under `prefers-reduced-motion`.
- **Scope boundary**: this one spot only. Confetti must not leak into task completion, send success, or anywhere else — those stay on the §14.4 baseline (a new exemption requires a new entry here). Implementation: `apps/desktop/src/renderer/components/status/QuotaResetConfetti.tsx`.
-- **Mobile-download QR brand edge** — the fourth sanctioned motion class and the only sanctioned *persistent* one (approved 2026-07-25), **only** for the QR card in `MobileDownloadDialog` (brand-surface registration: §15.7):
- - **Definition**: the official app icon sits scaled behind the QR card and is clipped to a 2px hairline edge; it turns a full circle every **20s** (`--mobile-download-edge-cycle`, linear, infinite), so the artwork's own red/blue drifts along the card edge. The dialog is a promotion surface for the mobile app — the slow drift is what marks the QR as "ours" without adding any component-authored color.
- - **Parameter red lines**: the animation touches **only `transform`** on an HTML wrapper (compositor-only, engineering conventions §7 — no `filter` / `backdrop-filter` / `mask-image`, nothing on SVG, no per-frame background work); one cycle length, linear, no easing games; registered in the `prefers-reduced-motion` whitelist in `globals.css`, where it degrades to a static angle. The card carries **no shadow and no pointer tilt** — both were evaluated and removed the same day; do not re-add them under this exception.
- - **Scope boundary**: this card only. Persistent motion elsewhere stays forbidden by the red lines above; a new persistent animation requires a new entry here. Implementation: `.mobile-download-qr-edge` in `globals.css`; contract test: `mobileDownloadDialog.test.tsx` → `keeps the brand edge inside its registered exception`.
+- **Retired: mobile-download QR brand edge** — a rotating app-icon edge on the `MobileDownloadDialog` QR card was briefly registered here as a fourth (persistent) motion class on 2026-07-25 and **removed the same day** at the user's request: read as a strange ring turning behind the code. There is **no sanctioned persistent decorative motion** — the red lines above hold without exception. The card is now a bare QR (no edge, no border, no shadow, no tilt); its only motion is the linked ↔ onboarding size tween. Do not re-add. Contract test: `mobileDownloadDialog.test.tsx` → `keeps the QR card flat with no brand edge`.
## 15. CINDY Skin Family(品牌化可选 family)
@@ -653,10 +650,10 @@ The splash wordmark is a separate asset pair (`assets/splash/wordmark.png`, whit
**Sanctioned brand surface — mobile download dialog (approved 2026-07-25).** The fourth surface allowed to carry brand artwork, alongside login / splash / new-session:
-- **Where**: `components/sidebar/MobileDownloadDialog.tsx` only — the dialog header icon (64px `resources/icon.png`) and the QR card's 2px edge, where the same asset is scaled behind the card and clipped to a hairline (1px reads as almost no color, 3px starts looking like a picture frame) so the artwork's own red/blue reads as the card's edge. This is a promotion surface for the mobile app, so showing the app's own icon is identification, not decoration.
-- **Constraints**: the color comes only from the official asset — no component-authored gradient or brand hex; the edge layer carries no `filter` / `backdrop-filter` / `mask-image`; its motion is governed by §14.4. The card itself stays flat: **no shadow and no pointer 3D tilt** (both were tried and removed 2026-07-25 — they are not part of this exception).
-- **Scope boundary**: this dialog only. Other working-UI surfaces keep the neutral treatment; a new brand surface needs a new entry here. Contract test: `mobileDownloadDialog.test.tsx` → `keeps the brand edge inside its registered exception`.
-- **Reference renders** (light theme, zh-CN, @2x — `assets/mobile-download-dialog/`): [local mode](assets/mobile-download-dialog/guest-local.webp) (QR only — no account, so no permission card) · [signed in, no linked mobile](assets/mobile-download-dialog/onboarding.webp) (228px QR + permission card) · [signed in, mobile linked](assets/mobile-download-dialog/linked.webp) (132px QR + device list). Re-shoot these when the dialog's layout changes.
+- **Where**: `components/sidebar/MobileDownloadDialog.tsx` only, and only the dialog header icon (64px `resources/icon.png`). This is a promotion surface for the mobile app, so showing the app's own icon is identification, not decoration.
+- **Constraints**: the color comes only from the official asset — no component-authored gradient or brand hex. The QR card itself carries **no brand edge, no border, no shadow and no pointer 3D tilt**: a 2px edge made of the scaled app icon was tried on 2026-07-25 and removed the same day (it read as a strange ring rotating behind the code — see §14.4). Do not re-add it in any form, static or animated.
+- **Scope boundary**: this dialog only. Other working-UI surfaces keep the neutral treatment; a new brand surface needs a new entry here. Contract test: `mobileDownloadDialog.test.tsx` → `keeps the QR card flat with no brand edge`.
+- **Reference renders** (light theme, zh-CN, @2x — `assets/mobile-download-dialog/`): [local mode](assets/mobile-download-dialog/guest-local.webp) (QR only — no account, so no permission card) · [signed in, no linked mobile](assets/mobile-download-dialog/onboarding.webp) (228px QR + permission card) · [signed in, mobile linked](assets/mobile-download-dialog/linked.webp) (132px QR + device list). Re-shoot these when the dialog's layout changes. **Stale as of 2026-07-25**: all three still show the retired brand edge around the QR — read them for layout only, not for the card's treatment.
### 15.8 status-badge-fg