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(settings): keep wrapped channel status aligned right

shenjiacheng9c8c866e355d
diff --git a/apps/desktop/scripts/fixtures/wechat-companion/ui-page.mjs b/apps/desktop/scripts/fixtures/wechat-companion/ui-page.mjs
index 18ef119ede..1e5d4b8668 100644
--- a/apps/desktop/scripts/fixtures/wechat-companion/ui-page.mjs
+++ b/apps/desktop/scripts/fixtures/wechat-companion/ui-page.mjs
@@ -39,10 +39,27 @@ export default {
viewport: { width: 1280, height: 900 },
data: { cardWidth: 760, headerAction: true },
},
+ 'sidebar-empty-320': {
+ about: 'Review #6729: empty summary keeps status and chevron at the right edge after wrapping',
+ viewport: { width: 1280, height: 900 },
+ data: { cardWidth: 320 },
+ },
+ 'header-action-empty-320': {
+ about: 'Empty summary with an independent switch at 320px',
+ viewport: { width: 1280, height: 900 },
+ data: { cardWidth: 320, headerAction: true },
+ },
+ 'header-action-empty-394': {
+ about: 'Empty summary with an independent switch at 394px',
+ viewport: { width: 1280, height: 900 },
+ data: { cardWidth: 394, headerAction: true },
+ },
},
// Browser/e2e regression for #6706. The existing jsdom unit test covers
// accordion semantics but cannot detect flex shrink or viewport breakpoints.
// Minimal failure: 394px assigned WeChat card inside a 1280px viewport.
+ // Review regression: null summary at 320px; checking visibility alone misses
+ // the wrapped status group jumping to the left. Measure the chevron's edge.
async check(page, ui) {
const trigger = page.locator('#companion-im-wechat-trigger');
await trigger.getByRole('status').waitFor();
@@ -71,11 +88,12 @@ export default {
textTop: text.getBoundingClientRect().top,
statusTop: status.getBoundingClientRect().top,
textBottom: text.getBoundingClientRect().bottom,
+ trailingGap: bounds.right - parseFloat(getComputedStyle(element).paddingRight) - chevron.getBoundingClientRect().right,
};
});
const assertHeader = async (button) => {
const metrics = await measureHeader(button);
- if (metrics.textWidth < 160 || metrics.titleLines !== 1 || !metrics.statusVisible || !metrics.chevronVisible || !metrics.summaryVisible) {
+ if (metrics.textWidth < 160 || metrics.titleLines !== 1 || !metrics.statusVisible || !metrics.chevronVisible || !metrics.summaryVisible || Math.abs(metrics.trailingGap) > 1) {
throw new Error(`Unreadable channel header: ${JSON.stringify(metrics)}`);
}
return metrics;
diff --git a/apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx b/apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx
index 51a9ca5b44..b85751cef1 100644
--- a/apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx
+++ b/apps/desktop/src/renderer/components/settings/ImChannelSettingsCard.tsx
@@ -104,7 +104,7 @@ export function ImChannelSettingsCard({
{/* Wrap using the trigger's available width, including any sibling
headerAction, rather than the window width of a narrow sidebar. */}
<span className={cn(
- 'flex min-w-0 max-w-full items-center justify-end gap-3',
+ 'ml-auto flex min-w-0 max-w-full items-center justify-end gap-3',
routeSummary ? 'flex-[1_1_18rem]' : 'shrink-0',
)}>
{routeSummary ? (