Ver Fonte

style(feedback): refine feedback dialog disclosure and layout

yx.zhang há 1 mês atrás
pai
commit
4b3cfcfaf3

+ 2 - 0
apps/web/tests/message-feedback.e2e.ts

@@ -82,6 +82,8 @@ describe('web e2e: durable per-message feedback', () => {
     await page.getByRole('button', { name: 'Bad response' }).first().click()
     const dialog = page.getByRole('dialog', { name: 'Submit feedback' })
     await dialog.waitFor({ timeout: 10_000 })
+    await expect.poll(() => dialog.getByRole('textbox', { name: 'Feedback details' }).getAttribute('placeholder'))
+      .toBe('Add details to help us improve. Your submission will include the current conversation log.')
     await dialog.getByRole('button', { name: 'Task result', exact: true }).click()
     await dialog.getByRole('textbox', { name: 'Feedback details' }).fill(NOTE)
     await dialog.getByRole('button', { name: 'Submit', exact: true }).click()

+ 7 - 5
packages/client/ui-message-feedback/src/client/FeedbackDialog.module.css

@@ -1,6 +1,7 @@
 /* The card width leaves four categories on the first row and three on the
    second. The doubled selector overrides the Modal card geometry. */
 .dialog.dialog {
+  gap: 38px;
   width: min(488px, 100%);
   border-radius: 18px;
 }
@@ -9,6 +10,7 @@
   display: flex;
   flex-wrap: wrap;
   gap: 8px;
+  margin-top: -14px;
 }
 
 .chip {
@@ -18,7 +20,7 @@
   border-radius: 14px;
   corner-shape: round;
   background: transparent;
-  color: var(--dsw-alias-label-secondary);
+  color: var(--dsw-alias-label-primary);
   font: inherit;
   font-size: 13px;
   line-height: 18px;
@@ -59,7 +61,7 @@
   margin-top: 18px;
   padding: 12px 14px;
   border: 0.5px solid var(--dsw-alias-border-l4);
-  border-radius: 12px;
+  border-radius: 16px;
   background: var(--dsw-alias-bg-layer-1);
   color: var(--dsw-alias-label-primary);
   font: inherit;
@@ -71,7 +73,7 @@
 }
 
 .detail::placeholder {
-  color: var(--dsw-alias-label-tertiary);
+  color: var(--dsw-alias-label-caption);
 }
 
 .detail:focus {
@@ -91,9 +93,9 @@
 .submit {
   width: 100%;
   height: 44px;
-  border-radius: 22px;
-  corner-shape: round;
+  border-radius: 18px;
   font-size: 14px;
+  font-weight: 500;
 }
 
 /* The design's ringed green check, not the warning tint the Toast icon seat defaults to. */

+ 1 - 1
packages/client/ui-message-feedback/src/client/MessageFeedbackActions.module.css

@@ -35,7 +35,7 @@
 /* A recorded rating stays legible without hover, so the signal survives a
    pointer leaving the row. */
 .action[data-active] {
-  color: var(--dsw-alias-label-primary);
+  color: var(--dsw-alias-label-tertiary);
 }
 
 .failure {

+ 2 - 2
packages/client/ui-message-feedback/src/client/locales.ts

@@ -9,7 +9,7 @@ export const zh = {
   'dialog.title': '提交反馈',
   'dialog.categories': '反馈分类',
   'dialog.detail': '反馈详情',
-  'dialog.hint': '填写详情以帮助我们改进体验',
+  'dialog.hint': '填写详情以帮助我们改进体验,提交内容会包括当前对话的日志',
   'category.task-result': '任务结果',
   'category.instruction-following': '指令理解与遵循',
   'category.product-interaction': '产品功能与交互',
@@ -43,7 +43,7 @@ export const en = {
   'dialog.title': 'Submit feedback',
   'dialog.categories': 'Feedback category',
   'dialog.detail': 'Feedback details',
-  'dialog.hint': 'Add details to help us improve',
+  'dialog.hint': 'Add details to help us improve. Your submission will include the current conversation log.',
   'category.task-result': 'Task result',
   'category.instruction-following': 'Instruction understanding and following',
   'category.product-interaction': 'Product features and interaction',

+ 6 - 1
packages/client/ui-message-feedback/tests/feedback-dialog.client.spec.tsx

@@ -15,7 +15,7 @@ import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts
 import { FEEDBACK_CATEGORIES } from '@deepseek-ai/dsh-command-feedback'
 import { FeedbackDialog } from '../src/client/FeedbackDialog.tsx'
 import type { FeedbackDialogState } from '../src/client/dialog.ts'
-import { zh } from '../src/client/locales.ts'
+import { en, zh } from '../src/client/locales.ts'
 
 afterEach(cleanup)
 
@@ -40,6 +40,11 @@ function mount(overrides: Partial<FeedbackDialogState> = {}) {
 }
 
 describe('FeedbackDialog', () => {
+  it('discloses conversation-log inclusion in both supported locales', () => {
+    expect(zh['dialog.hint']).toBe('填写详情以帮助我们改进体验,提交内容会包括当前对话的日志')
+    expect(en['dialog.hint']).toBe('Add details to help us improve. Your submission will include the current conversation log.')
+  })
+
   it('renders nothing but the probe while closed with no toast', () => {
     const ui = mount({ target: null })
 

+ 25 - 7
packages/client/ui-message-feedback/tests/styles.client.spec.ts

@@ -24,7 +24,6 @@ const sheets = Object.fromEntries(SHEETS.map(name => [name, readFileSync(
   fileURLToPath(new URL(`../src/client/${name}.module.css`, import.meta.url)),
   'utf8',
 )])) as Record<(typeof SHEETS)[number], string>
-const css = sheets.MessageFeedbackActions
 // The theme package maps `./styles/*` to `./src/styles/*`, so the declarations
 // stay on the source plane rather than needing a build. Every theme sheet, not
 // just the platform tokens: font and scrollbar variables are declared in
@@ -36,12 +35,14 @@ const tokens = readdirSync(fileURLToPath(new URL('../../ui-theme/src/styles/', i
 
 /**
  * The declarations of one top-level rule, by selector.
+ * @param sheetName - the stylesheet containing the rule.
  * @param selector - the class selector to read, including its leading dot.
  * @returns the rule's declaration text.
  */
-function block(selector: string): string {
-  const match = new RegExp(`^\\${selector} \\{([^}]*)\\}`, 'm').exec(css)
-  if (match === null) throw new Error(`MessageFeedbackActions.module.css has no \`${selector}\` rule`)
+function block(sheetName: (typeof SHEETS)[number], selector: string): string {
+  const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+  const match = new RegExp(`^${escapedSelector} \\{([^}]*)\\}`, 'm').exec(sheets[sheetName])
+  if (match === null) throw new Error(`${sheetName}.module.css has no \`${selector}\` rule`)
   return match[1] ?? ''
 }
 
@@ -82,8 +83,25 @@ describe('MessageFeedbackActions row styles', () => {
     // These buttons render inside ui-chat's MessageIconActions row; a fixed
     // 28px would leave them undersized (or overflowing) once the Settings
     // font size moves the row.
-    expect(block('.action')).toMatch(/width:\s*calc\(28px \+ var\(--dsh-content-font-delta, 0px\)\)/)
-    expect(block('.action')).toMatch(/height:\s*calc\(28px \+ var\(--dsh-content-font-delta, 0px\)\)/)
-    expect(block('.action svg')).toMatch(/width:\s*calc\(15px \+ var\(--dsh-content-font-delta, 0px\)\)/)
+    expect(block('MessageFeedbackActions', '.action')).toMatch(/width:\s*calc\(28px \+ var\(--dsh-content-font-delta, 0px\)\)/)
+    expect(block('MessageFeedbackActions', '.action')).toMatch(/height:\s*calc\(28px \+ var\(--dsh-content-font-delta, 0px\)\)/)
+    expect(block('MessageFeedbackActions', '.action svg')).toMatch(/width:\s*calc\(15px \+ var\(--dsh-content-font-delta, 0px\)\)/)
+  })
+
+  it('uses the tertiary label colour for recorded rating icons', () => {
+    expect(block('MessageFeedbackActions', '.action[data-active]'))
+      .toMatch(/color:\s*var\(--dsw-alias-label-tertiary\)/)
+  })
+})
+
+describe('FeedbackDialog layout styles', () => {
+  it('uses the reviewed spacing, text colours, and submit-button geometry', () => {
+    expect(block('FeedbackDialog', '.dialog.dialog')).toMatch(/gap:\s*38px/)
+    expect(block('FeedbackDialog', '.categories')).toMatch(/margin-top:\s*-14px/)
+    expect(block('FeedbackDialog', '.chip')).toMatch(/color:\s*var\(--dsw-alias-label-primary\)/)
+    expect(block('FeedbackDialog', '.detail::placeholder')).toMatch(/color:\s*var\(--dsw-alias-label-caption\)/)
+    expect(block('FeedbackDialog', '.detail')).toMatch(/border-radius:\s*16px/)
+    expect(block('FeedbackDialog', '.submit')).toMatch(/border-radius:\s*18px/)
+    expect(block('FeedbackDialog', '.submit')).toMatch(/font-weight:\s*500/)
   })
 })