diff --git a/e2e/work-companion.playwright.ts b/e2e/work-companion.playwright.ts index 8d62f51..a8761d4 100644 --- a/e2e/work-companion.playwright.ts +++ b/e2e/work-companion.playwright.ts @@ -141,6 +141,36 @@ test('places the full work card only in the desktop work pane', async ({ page }) expect(state.errors).toEqual([]) }) +test('uses a focused reading column and a compact authored-message shape', async ({ page }) => { + await page.setViewportSize({ width: 1920, height: 1080 }) + const state = await fixture(page) + await page.getByRole('button', { name: '打开工作', exact: true }).click() + + const conversation = page.locator('.chat-body .msg').first() + const authored = page.locator('.chat-body .msg.user').first() + const answer = page.locator('.chat-body .msg.assistant').first() + const [conversationBox, authoredBox, answerBox] = await Promise.all([ + conversation.boundingBox(), authored.boundingBox(), answer.boundingBox(), + ]) + expect(conversationBox).not.toBeNull() + expect(authoredBox).not.toBeNull() + expect(answerBox).not.toBeNull() + expect(conversationBox!.width).toBeLessThanOrEqual(840) + expect(authoredBox!.width).toBeLessThanOrEqual(680) + expect(authoredBox!.x + authoredBox!.width).toBeCloseTo(answerBox!.x + answerBox!.width, 0) + + const activeCard = page.locator('.right-panel .acard.status-active') + await expect(activeCard).toBeVisible() + const cardStyle = await activeCard.evaluate(element => { + const style = getComputedStyle(element) + return { background: style.backgroundColor, borderLeftWidth: style.borderLeftWidth } + }) + const panelBackground = await page.locator('.right-panel').evaluate(element => getComputedStyle(element).backgroundColor) + expect(cardStyle.background).not.toBe(panelBackground) + expect(Number.parseFloat(cardStyle.borderLeftWidth)).toBeGreaterThanOrEqual(3) + expect(state.errors).toEqual([]) +}) + test('preserves the selected material, physical scroll and focus when background work finishes', async ({ page }) => { await page.setViewportSize({ width: 1440, height: 960 }) const tabbed = work('work1', 'active', { body: [...progress.body!, { diff --git a/src/companion-conversation.css b/src/companion-conversation.css index ce559b4..1fbfc6d 100644 --- a/src/companion-conversation.css +++ b/src/companion-conversation.css @@ -3,9 +3,11 @@ display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; - padding: 16px 24px; + min-height: 64px; + padding: 12px 24px; + background: var(--bg-panel); } -.work-companion-chat .chat-title { font-size: var(--fs-ui-xl); font-weight: 650; letter-spacing: -0.02em; } +.work-companion-chat .chat-title { font-size: var(--fs-ui-xl); font-weight: 650; letter-spacing: -0.025em; } .work-companion-chat .chat-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .work-companion-chat .chat-header > .mk-col-root { position: relative; } .work-companion-chat .chat-header > .mk-col-root > .mk-col { @@ -37,9 +39,51 @@ .companion-setting select { max-width: 100%; padding: 4px 8px; background: var(--bg-panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-ui-caption); } .companion-setting .session-note { flex: 1 1 100%; min-width: 0; width: 100%; } .companion-setting-note { flex: 1 1 100%; margin: 0; color: var(--text-dim); font-size: var(--fs-ui-sm); line-height: 1.6; } -.work-companion-chat .chat-body { padding: 24px clamp(16px, 5vw, 64px); } -.work-companion-chat .input-bar { padding: 8px clamp(16px, 5vw, 64px) 16px; } -.work-companion-chat .input-row { flex-direction: column; align-items: stretch; padding: 12px; box-shadow: none; } +.work-companion-chat .chat-body { + display: flex; + flex-direction: column; + align-items: center; + padding: 36px clamp(20px, 6vw, 96px) 48px; + scroll-padding-block: 36px; +} +.work-companion-chat .chat-body > * { + width: min(100%, 840px); + margin-left: auto; + margin-right: auto; +} +.work-companion-chat .chat-body > .msg { margin-bottom: 32px; } +.work-companion-chat .chat-body > .msg.user { + width: min(80%, 680px); + margin-right: max(0px, calc((100% - 840px) / 2)); + margin-left: auto; +} +.work-companion-chat .msg-role { + margin-bottom: 10px; + color: var(--text-dim); + font-size: var(--fs-ui-caption); + font-weight: 600; +} +.work-companion-chat .msg.user .msg-role { justify-content: flex-end; } +.work-companion-chat .msg.assistant .role-mark { + background: var(--primary); + border-color: var(--primary); + color: var(--primary-foreground); +} +.work-companion-chat .msg.assistant .part-text { color: var(--text); font-size: var(--fs-ui-base); line-height: 1.8; } +.work-companion-chat .input-bar { + padding: 12px clamp(20px, 6vw, 96px) 20px; + border-top: 1px solid var(--border-soft); + background: var(--bg-panel); +} +.work-companion-chat .input-bar > * { width: min(100%, 840px); margin-left: auto; margin-right: auto; } +.work-companion-chat .input-row { + flex-direction: column; + align-items: stretch; + padding: 14px; + border-color: var(--border-strong); + border-radius: var(--radius-xl); + box-shadow: var(--shadow-md); +} .work-companion-chat .input-row textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: 4px; line-height: 1.6; font-size: var(--fs-ui-base); } .companion-compose-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; } .companion-compose-spacer { flex: 1; } @@ -48,7 +92,7 @@ .companion-add-material:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; } .companion-file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); } .companion-input-hint { font-size: var(--fs-ui-sm); color: var(--text-dim); } -.companion-operation-trigger { margin-bottom: 8px; } +.companion-operation-trigger { margin-bottom: 8px; color: var(--text-dim); } .companion-operation-body { padding: 12px; margin-bottom: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-panel); } .companion-operation-body .companion-setting { margin-bottom: 8px; } .work-companion-chat .input-status { flex-wrap: wrap; gap: 4px 8px; padding: 8px 0; line-height: 1.5; } @@ -58,31 +102,62 @@ .companion-remove-material { display: inline-flex; align-items: center; justify-content: center; padding: 4px; color: var(--text-dim); background: transparent; border: 0; border-radius: var(--radius-xs); cursor: pointer; } .companion-remove-material:hover { background: var(--bg-hover); color: var(--text); } .work-companion-chat .attach-chip { max-width: 100%; overflow-wrap: anywhere; } -.companion-empty { min-height: 240px; height: 100%; text-align: center; line-height: 1.7; } -.companion-empty-title { color: var(--text); font-size: var(--fs-ui-xl); } +.companion-empty { min-height: 320px; height: 100%; text-align: center; line-height: 1.7; } +.companion-empty .es-mark { width: 52px; height: 52px; margin-bottom: 8px; background: var(--bg-panel); box-shadow: var(--shadow-md); } +.companion-empty-title { color: var(--text); font-size: var(--fs-ui-xl); font-weight: 650; letter-spacing: -0.02em; } .companion-examples { display: grid; gap: 8px; width: min(100%, 32rem); margin-top: 12px; } -.companion-example { padding: 12px 16px; background: var(--bg-panel); border: 1px solid var(--border-soft); border-radius: var(--radius); color: var(--text-dim); font: inherit; text-align: left; cursor: pointer; } -.companion-example:hover { color: var(--text); background: var(--bg-hover); } +.companion-example { padding: 14px 16px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-dim); font: inherit; text-align: left; cursor: pointer; } +.companion-example:hover { color: var(--text); background: var(--bg-raised); border-color: var(--border-strong); } .conversation-work { margin: 24px 0 16px; min-width: 0; } .conversation-work-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--text-dim); font-size: var(--fs-ui-caption); } .conversation-work-heading > span:first-child { color: var(--text); font-size: var(--fs-ui-lg); font-weight: 650; } .conversation-work-current, .conversation-work-history { display: grid; gap: 12px; min-width: 0; } .conversation-work-more { padding: 12px 0; color: var(--text-dim); font-size: var(--fs-ui-caption); } .conversation-work .acard { margin: 0; } -.conversation-action-anchor { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; width: 100%; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-panel); color: var(--text); text-align: left; font-size: var(--fs-ui-caption); cursor: pointer; } +.conversation-action-anchor { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; width: 100%; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel); color: var(--text); text-align: left; font-size: var(--fs-ui-caption); cursor: pointer; } .conversation-action-anchor > span:last-child { color: var(--accent-text); } .conversation-action-anchor:hover { background: var(--bg-hover); } .work-companion-chat .live-bar { flex-wrap: wrap; } .work-companion-chat .part-error-detail, .work-companion-chat .hitl-detail { overflow-wrap: anywhere; white-space: pre-wrap; } @media (max-width: 540px) { .work-companion-chat .chat-header { padding: 12px 16px; gap: 8px; } + .work-companion-chat .chat-body { padding: 24px 16px 32px; } + .work-companion-chat .chat-body > .msg.user { width: 92%; margin-right: 0; } + .work-companion-chat .input-bar { padding: 10px 12px 14px; } .companion-input-hint { display: none; } .companion-empty { min-height: 200px; } .work-companion-chat .hitl-choices { grid-template-columns: minmax(0, 1fr); } } -.work-companion-chat .msg.user .bubble { background: var(--bg-active); } +.work-companion-chat .msg.user .bubble { + padding: 14px 18px; + background: var(--bg-active); + border: 1px solid var(--border-soft); + border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg); + line-height: 1.7; +} +.work-companion-chat .process-collapse { + margin: 12px 0 16px; + border-color: var(--border); + background: var(--bg-panel); +} +.work-companion-chat .process-collapse .process-collapse-summary { padding: 9px 14px; color: var(--text-dim); } +.work-companion-chat .process-collapse .process-collapse-summary:hover { background: var(--bg-hover); color: var(--text); } +.work-companion-chat .process-collapse .body { padding: 8px 14px 14px; border-top: 1px solid var(--border-soft); } .companion-message-copy { padding: 4px 8px; border: 0; background: transparent; color: var(--text-dim); font-size: var(--fs-ui-caption); border-radius: var(--radius-sm); cursor: pointer; } .companion-message-copy:hover { background: var(--bg-hover); color: var(--text); } -.companion-message-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; } +.companion-message-actions { + display: flex; + flex-wrap: wrap; + gap: 8px; + padding: 8px 0; + opacity: 0; + transition: opacity .12s var(--ease); +} +.work-companion-chat .msg:hover .companion-message-actions, +.work-companion-chat .msg:focus-within .companion-message-actions { opacity: 1; } .work-companion-chat .msg-tools { gap: 4px; } + +@media (hover: none) { + .companion-message-actions { opacity: 1; } +} diff --git a/src/companion-shell.css b/src/companion-shell.css index ee52d3e..f224265 100644 --- a/src/companion-shell.css +++ b/src/companion-shell.css @@ -16,15 +16,53 @@ .companion-app .icon-only[hidden] { display: none !important; } .shell-context-content { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; } -.companion-app .companion-topbar { height: auto; min-height: 44px; gap: 8px; padding: 4px 12px; } +.companion-app .companion-topbar { + height: auto; + min-height: 52px; + gap: 12px; + padding: 8px 16px; + box-shadow: var(--shadow-md); +} .topbar-identity { display: flex; align-items: center; gap: 8px; min-width: 0; } -.companion-topbar .topbar-name { font-size: var(--fs-ui-base); font-weight: 650; white-space: nowrap; } -.companion-app .right-panel .tabs { padding: 4px 12px 0; } -.companion-app .right-panel .tab { font-size: var(--fs-ui-base); font-weight: 600; } -.companion-app .right-panel .tab-body { padding: 16px; } -.companion-app .right-panel .inbox-zone-label { color: var(--text); font-size: var(--fs-ui-caption); font-weight: 600; margin-top: 16px; } -.companion-app .right-panel .acard.status-active { border-left: 3px solid var(--work-focus-border); background: var(--work-focus-surface); } -.companion-app .right-panel .acard-title { color: var(--text); font-size: var(--fs-ui-lg); } +.companion-topbar .topbar-name { font-size: var(--fs-ui-lg); font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; } +.companion-app .right-panel .tabs { + min-height: 52px; + align-items: flex-end; + gap: 16px; + padding: 0 20px; + background: var(--bg-panel); +} +.companion-app .right-panel .tab { + min-height: 52px; + padding: 0 2px; + color: var(--text-dim); + font-size: var(--fs-ui-base); + font-weight: 600; +} +.companion-app .right-panel .tab:hover { color: var(--text); } +.companion-app .right-panel .tab-body { padding: 20px; } +.companion-app .right-panel .inbox-zone-label { margin: 20px 0 8px; color: var(--text); font-size: var(--fs-ui-caption); font-weight: 650; } +.companion-app .right-panel .acard { margin: 12px 0; border-color: var(--border); padding: 18px; } +.companion-app .right-panel .acard.status-active { + border-left: 3px solid var(--work-focus-border); + background: var(--work-focus-surface); + box-shadow: var(--shadow-md); +} +.companion-app .right-panel .acard-title { color: var(--text); font-size: var(--fs-ui-lg); line-height: 1.4; } +.companion-app .right-panel .acard-status { + display: inline-flex; + width: fit-content; + margin-top: 8px; + padding: 2px 8px; + border-radius: var(--radius-full); + background: var(--bg-active); + color: var(--text); + font-weight: 600; +} +.companion-app .right-panel .acard-body { margin-top: 16px; } +.companion-app .right-panel .acard-summary-row { grid-template-columns: minmax(64px, auto) minmax(0, 1fr); gap: 12px; margin: 12px 0; } +.companion-app .right-panel .acard-summary-row > span, +.companion-app .right-panel .acard-summary-label { color: var(--text-dim); font-weight: 600; } .companion-app .right-panel .acard-summary-row p, .companion-app .right-panel .acard-findings li { color: var(--text); font-size: var(--fs-ui-base); } .companion-topbar .brand-mark { @@ -65,19 +103,23 @@ font-variant-numeric: tabular-nums; } -.companion-app .tsb-brand { gap: 4px; padding: 16px 12px 8px; } -.companion-app .tsb-projrow { min-height: 36px; height: auto; border-color: transparent; background: none; padding: 4px 8px; } +.companion-app .tsb-brand { gap: 8px; padding: 16px 14px 12px; border-bottom: 1px solid var(--border-soft); } +.companion-app .tsb-projrow { min-height: 40px; height: auto; border-color: transparent; background: none; padding: 6px 10px; } .companion-app .tsb-projrow:hover { background: var(--bg-hover); } -.companion-app .tsb-projrow-name { flex: 1; } +.companion-app .tsb-projrow-name { flex: 1; font-size: var(--fs-ui-base); font-weight: 650; } .companion-app .tsb-projrow-stage { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); border-radius: var(--radius-sm); } .companion-app .tsb-iconbtn { width: 32px; height: 32px; flex: none; } -.companion-app .tsb-actions { padding: 8px 12px 12px; gap: 12px; } +.companion-app .tsb-actions { padding: 12px 14px; gap: 10px; } .companion-app .tsb-newtask { min-height: 40px; height: auto; box-shadow: none; transition: none; } .companion-app .tsb-newtask-main { justify-content: center; padding: 8px 12px; } .companion-app .tsb-newtask-caret { width: 36px; flex: none; } -.companion-app .tsb-search { min-height: 36px; height: auto; padding: 8px 12px; } -.companion-app .tsb-orgrow { padding-bottom: 4px; } -.companion-app .tsb-task { min-height: 40px; height: auto; gap: 4px; transition: none; } +.companion-app .tsb-search { min-height: 38px; height: auto; padding: 8px 12px; background: var(--bg-hover); border-color: transparent; } +.companion-app .tsb-search:focus-within { background: var(--bg-panel); } +.companion-app .tsb-orgrow { padding: 4px 16px 8px; } +.companion-app .tsb-seclabel { color: var(--text-dim); font-size: var(--fs-ui-sm); font-weight: 600; } +.companion-app .tsb-scroll { padding: 0 8px 12px; } +.companion-app .tsb-task { min-height: 42px; height: auto; gap: 6px; padding: 0 10px; transition: none; } +.companion-app .tsb-task.active { background: var(--bg-active); color: var(--text); } .companion-app .tsb-task-open { display: flex; align-items: center; @@ -93,6 +135,7 @@ cursor: pointer; } .companion-app .tsb-task-open > svg { flex: none; } +.companion-app .tsb-task-t { font-size: var(--fs-ui-base); } .companion-app .tsb-task-tm { color: var(--text-dim); } .companion-app .tsb-task:focus-within .tsb-row-acts { display: inline-flex; } .companion-app .tsb-task:focus-within .tsb-task-tm { display: none; } @@ -111,11 +154,32 @@ cursor: pointer; } .companion-app .tsb-row-menu:hover { background: var(--bg-hover); color: var(--text); } -.companion-app .tsb-bottom { padding: 8px 12px; gap: 4px; } -.companion-app .tsb-tool { min-height: 36px; } +.companion-app .tsb-bottom { padding: 10px 12px; gap: 4px; background: var(--bg-hover); } +.companion-app .tsb-tool { min-height: 38px; padding: 7px 10px; } .companion-app .tsb-avatar { background: var(--bg-active); color: var(--text); box-shadow: none; border-radius: var(--radius-full); } .companion-app .tsb-user-sub { color: var(--text-dim); } -.companion-app .tsb-user { min-height: 44px; height: auto; } +.companion-app .tsb-footer { padding: 10px 12px; } +.companion-app .tsb-user { min-height: 46px; height: auto; } +.companion-app .right-panel .inbox-scope { + gap: 4px; + margin: 14px 20px 0; + padding: 4px; + border: 1px solid var(--border-soft); + border-radius: var(--radius); + background: var(--bg); +} +.companion-app .right-panel .inbox-scope button { + flex: 1; + min-width: 0; + border: none; + border-radius: var(--radius-sm); + padding: 5px 10px; + opacity: 1; + color: var(--text-dim); + font-size: var(--fs-ui-sm); + white-space: nowrap; +} +.companion-app .right-panel .inbox-scope button.active { background: var(--bg-raised); box-shadow: var(--shadow-md); color: var(--text); } .companion-app .tsb-menu { min-width: min(216px, calc(100vw - 16px)); max-width: min(360px, calc(100vw - 16px)); @@ -124,7 +188,7 @@ } .companion-app .tsb-mi { overflow-wrap: anywhere; } -.companion-app.compact .companion-topbar { flex-wrap: wrap; padding: 8px; } +.companion-app.compact .companion-topbar { flex-wrap: wrap; padding: 8px 12px; } .companion-app.compact .shell-navigation { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); } .companion-app.compact .shell-nav-button { min-width: 0; min-height: 40px; flex-wrap: wrap; gap: 0 4px; padding: 4px; } .companion-app.compact .shell-nav-button > svg { display: none; }