Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): Agent 问题卡选项选中态改为反色实底对勾 (#873)
Dashf6291cff3272
diff --git a/apps/mobile/docs/mobile-design-guide.md b/apps/mobile/docs/mobile-design-guide.mdindex 7f8368d432..84fb1fab3a 100644--- a/apps/mobile/docs/mobile-design-guide.md+++ b/apps/mobile/docs/mobile-design-guide.md@@ -12,7 +12,7 @@- **iOS 优先**,触控优先,跟随系统 light / dark 自动切换(`useColorScheme`)。- **灰度环境**:除品牌 teal(就绪态)和 Heart Orange(运行/thinking 态)两个语义色外,界面全是黑白之间的灰阶。不引入任何品牌蓝 / 绿 / 红等装饰色。-- **二元圆角**:`container`(12,卡片 / 容器)或 `pill`(9999,交互元素)。**禁止**中间值(0 / 3 / 4 / 8 / 28 等)。+- **圆角走四档阶梯**(与 `src/theme/tokens.ts` 的 `radius` 一致,守护测试拦截阶梯外值):`micro`(4,缩略图内 chip、勾选指示器等微元素)/ `control`(8,卡片内层控件)/ `container`(12,卡片 / 容器)/ `pill`(9999,交互元素)。**禁止**阶梯外中间值(0 / 3 / 6 / 28 等)与字面量圆角。根规范 `docs/design-rules/DESIGN.md` §5 的三档制约束的是桌面 surface;其「Mobile」节明确把 §15.13 / §16 之外的 mobile 布局细节委托给 `apps/mobile` 的实现,mobile 圆角阶梯以 `tokens.ts` 为准。- **零阴影**:层次靠背景色差 + 1px 边框,不用 `shadow*` / `elevation`。- **字重克制**:只用 400 / 500,极少量大写微标签可用 600。无 700+。- **手机只做减法**(详见 `mobile-current-execution-plan.md`):主层信息量不超过桌面主层;视觉轻、触控够(可见图标小,hitSlop 补足热区)。@@ -144,7 +144,7 @@ function Foo() {## 5. 间距 / 圆角 / 触控 / 安全区- **间距 `spacing`**:`xs 4 · sm 8 · md 12 · lg 16 · xl 24 · xxl 32`(基数 4)。避免 `2 / 6 / 13 / 17` 这类裸数字;1-2pt 的微调若实在需要,集中、少量、写注释。-- **圆角 `radius`**:二元——`container 12` / `pill 9999`。**禁止**中间值。+- **圆角 `radius`**:四档阶梯——`micro 4` / `control 8` / `container 12` / `pill 9999`(定义与各档用途见 `src/theme/tokens.ts`,守护测试 `designTokenDiscipline.test.ts` 拦截字面量与 token 算术)。**禁止**阶梯外值。- **触控目标**:主操作命中区 ≥ 44×44(iOS HIG)。可见图标可小(14–18),用 `hitSlop` 或不可见外层把热区补到 44。- **安全区**:屏幕根用 `SafeAreaView`(react-native-safe-area-context);需要精确 inset 用 `useSafeAreaInsets()`。键盘遮挡用 `KeyboardAvoidingView` + inset,务必开软键盘实测。diff --git a/apps/mobile/src/__tests__/interactionModel.test.ts b/apps/mobile/src/__tests__/interactionModel.test.tsindex 99640d2aff..8d1caf17d2 100644--- a/apps/mobile/src/__tests__/interactionModel.test.ts+++ b/apps/mobile/src/__tests__/interactionModel.test.ts@@ -199,6 +199,19 @@ describe('interactionModel', () => {});});+ it('marks the selected ask option with an inverse-filled check for single and multi select', () => {+ const interactionPanelSource = readFileSync(resolve(process.cwd(), 'src/session/InteractionPanel.tsx'), 'utf8');++ // 选中态不能只靠 surfaceChip 底色:dark 下它与卡底几乎同色,单选选完看不出+ // 选了哪个(线上截图复现)。指示器必须单选/多选都渲染,只在形状上分家。+ expect(interactionPanelSource).toContain('isMulti ? styles.optionIndicatorSquare : styles.optionIndicatorRound');+ // 选中 = 反色实底 + ctaText 勾,对齐桌面 ask-checkbox(accent-cta-bg 实底)与+ // 登录 radio 的「选中反色 + 对勾」体系;不得退回描边勾叠 Square 的弱指示。+ expect(interactionPanelSource).toContain('optionIndicatorSelected: {');+ expect(interactionPanelSource).toContain('backgroundColor: colors.cta,');+ expect(interactionPanelSource).not.toContain('optionCheckboxMark');+ });+it('keeps issue confirmation unsupported in the mobile adapter and panel', () => {const interactionPanelSource = readFileSync(resolve(process.cwd(), 'src/session/InteractionPanel.tsx'), 'utf8');diff --git a/apps/mobile/src/session/InteractionPanel.tsx b/apps/mobile/src/session/InteractionPanel.tsxindex 50d3972996..d647f0ccc9 100644--- a/apps/mobile/src/session/InteractionPanel.tsx+++ b/apps/mobile/src/session/InteractionPanel.tsx@@ -8,7 +8,6 @@ import {Minus,Pencil,Plus,- Square,} from 'lucide-react-native';import {Image,@@ -858,23 +857,25 @@ function AskUserQuestionCard({]}testID={`interaction.ask.option.${index + 1}`}>- {isMulti ? (- <View style={styles.optionCheckbox} testID={selected ? 'interaction.ask.checkbox.checked' : 'interaction.ask.checkbox'}>- <Square- color={selected ? colors.textPrimary : colors.borderStrong}- size={iconSize.xl}- strokeWidth={iconStroke.regular}+ {/* 单选也要有指示器:选中反色实底 + 对勾(对齐桌面 ask-checkbox 与登录+ radio 的反色勾体系)。此前单选行只靠 surfaceChip 底色,dark 下与卡底+ 几乎同色,选中态不可见。 */}+ <View+ style={[+ styles.optionIndicator,+ isMulti ? styles.optionIndicatorSquare : styles.optionIndicatorRound,+ selected && styles.optionIndicatorSelected,+ ]}+ testID={`interaction.ask.${isMulti ? 'checkbox' : 'radio'}${selected ? '.checked' : ''}`}+ >+ {selected ? (+ <Check+ color={colors.ctaText}+ size={iconSize.sm}+ strokeWidth={iconStroke.bold}/>- {selected ? (- <Check- color={colors.textPrimary}- size={iconSize.sm}- strokeWidth={iconStroke.bold}- style={styles.optionCheckboxMark}- />- ) : null}- </View>- ) : null}+ ) : null}+ </View><View style={styles.optionCopy}><Text style={styles.optionTitle}>{option.label}</Text>{option.description ? <Text style={styles.optionDescription}>{option.description}</Text> : null}@@ -1961,14 +1962,24 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({optionRowSelected: {backgroundColor: colors.surfaceChip,},- optionCheckbox: {+ optionIndicator: {alignItems: 'center',- height: 24,+ borderColor: colors.borderStrong,+ borderWidth: 2,+ height: iconSize.xl,justifyContent: 'center',- width: 24,+ width: iconSize.xl,},- optionCheckboxMark: {- position: 'absolute',+ // 单选圆形(radio 语义)、多选圆角方形(checkbox 语义),选中都用反色实底 + 勾。+ optionIndicatorRound: {+ borderRadius: radius.pill,+ },+ optionIndicatorSquare: {+ borderRadius: radius.micro,+ },+ optionIndicatorSelected: {+ backgroundColor: colors.cta,+ borderColor: colors.cta,},optionCopy: { flex: 1, minWidth: 0 },optionTitle: {