Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email-view): bring back the Focus importance meter's colors and score (#9588)

teo9d1d2fa43309
diff --git a/apps/web/src/features/email-view/browser-test/focus-rows.browser.e2e.ts b/apps/web/src/features/email-view/browser-test/focus-rows.browser.e2e.ts
index bcf31441eb..4bd9792477 100644
--- a/apps/web/src/features/email-view/browser-test/focus-rows.browser.e2e.ts
+++ b/apps/web/src/features/email-view/browser-test/focus-rows.browser.e2e.ts
@@ -121,7 +121,7 @@ for (const size of WIDTHS) {
expect(horizontalOverflow).toBe(false);
});
- test('the meter shows only under the importance sort, and quietly', async ({
+ test('the meter shows only under the importance sort, in its band color', async ({
page,
}) => {
await open(page);
@@ -134,21 +134,20 @@ for (const size of WIDTHS) {
await expect(
reply.getByRole('img', { name: 'Importance 92 of 100' })
).toBeVisible();
- // The value lives in the label, not on screen.
- await expect(reply).not.toContainText('92');
+ await expect(reply).toContainText('92');
- // No color per band: each meter's first bar is lit or unlit, nothing else.
+ // Each band has its own color; the lowest score leaves the first bar unlit.
const firstBarColors = await page.evaluate(() => {
const colors = new Set<string>();
for (const meter of document.querySelectorAll(
'[role="img"][aria-label^="Importance"]'
)) {
- const first = meter.firstElementChild;
+ const first = meter.lastElementChild?.firstElementChild;
if (first) colors.add(getComputedStyle(first).backgroundColor);
}
return [...colors];
});
- expect(firstBarColors).toHaveLength(2);
+ expect(firstBarColors).toHaveLength(6);
await page.getByRole('button', { name: 'Most recent' }).click();
await expect(meters).toHaveCount(0);
diff --git a/apps/web/src/features/email-view/components/EmailFocusBadges.tsx b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
index d53a4d5e7c..39b0b1a60c 100644
--- a/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
+++ b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
@@ -16,35 +16,40 @@ const emailFocusOf = (entity: EntityData): EmailFocus | undefined =>
/** Lit bars for each importance band, highest first. */
const IMPORTANCE_LEVELS = [
- { from: 80, lit: 5 },
- { from: 60, lit: 4 },
- { from: 40, lit: 3 },
- { from: 20, lit: 2 },
- { from: 5, lit: 1 },
- { from: 0, lit: 0 },
+ { from: 80, lit: 5, color: 'bg-green' },
+ { from: 60, lit: 4, color: 'bg-lime' },
+ { from: 40, lit: 3, color: 'bg-yellow' },
+ { from: 20, lit: 2, color: 'bg-orange' },
+ { from: 5, lit: 1, color: 'bg-red' },
+ { from: 0, lit: 0, color: '' },
] as const;
const BARS = [0, 1, 2, 3, 4] as const;
-/** The 0-100 importance score as five quiet bars; the value is in the label. */
+/** The 0-100 importance score as a number and a five-bar meter. */
function ImportanceMeter(props: { focus: EmailFocus }) {
const label = () => `Importance ${props.focus.importance} of 100`;
- const lit = () =>
- IMPORTANCE_LEVELS.find((band) => props.focus.importance >= band.from)
- ?.lit ?? 0;
+ const level = () =>
+ IMPORTANCE_LEVELS.find((band) => props.focus.importance >= band.from) ??
+ IMPORTANCE_LEVELS[IMPORTANCE_LEVELS.length - 1];
return (
<Tooltip as="span" label={label()} class="inline-flex shrink-0">
- <span role="img" aria-label={label()} class="flex items-center gap-0.5">
- <For each={BARS}>
- {(bar) => (
- <span
- class={cn(
- 'h-3 w-1 rounded-full',
- bar < lit() ? 'bg-ink-extra-muted/60' : 'bg-ink-extra-muted/20'
- )}
- />
- )}
- </For>
+ <span role="img" aria-label={label()} class="flex items-center gap-2">
+ <span class="w-[3ch] text-right text-xs font-medium tabular-nums text-ink-muted">
+ {props.focus.importance}
+ </span>
+ <span class="flex items-center gap-[3px]">
+ <For each={BARS}>
+ {(bar) => (
+ <span
+ class={cn(
+ 'h-3.5 w-1.5 rounded-full',
+ bar < level().lit ? level().color : 'bg-ink-extra-muted/25'
+ )}
+ />
+ )}
+ </For>
+ </span>
</span>
</Tooltip>
);
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index 63d785d42f..d11df6b267 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -208,8 +208,8 @@ is someone else's. A thread holding only the owner's sent mail is not listed: it
has no inbox state, so Mark Done could not remove it. Each row says why it is
there with one tag pill: `Reply needed`, else `Follow up`, else its category as
`Calendar change`, `Customer`, `Teammate` or `Contact`; other categories show no
-pill. While the list is sorted by Importance, five quiet bars join it, with the
-0-100 score in their tooltip and label; Most recent hides them. Rows at least
+pill. While the list is sorted by Importance, the 0-100 score and five bars
+colored by band join it, red through green; Most recent hides them. Rows at least
40rem wide keep both just before the date. Narrower Focus rows stack, on touch
too, with the subject on its own line and both ahead of the preview. The desktop
header's sort dropdown (`Sort Focus`, among the view options) switches between