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): show the importance score on every Focus row, except on phones (#9855)

teo9e8132c07a1d
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 14351cc941..f1e79d6346 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -94,10 +94,9 @@ searches, and picks by keyboard:
Focus rows have a backend-free browser regression over the real row and mapping
at wide, one-line, stacked, phone, and tablet widths: one reason per row, no
extra height or lost subject, touch rows of at least 44px, and the importance
-meter only under its sort, with the direction in its label while importance moves:
+meter on every row except on phones, with the direction in its label while
+importance moves:
`bunx playwright test --config src/features/email-view/browser-test/playwright.config.ts`.
-The fixture has its own sort buttons: the real touch layouts have no sort menu, so
-that coverage proves the meter's layout there, not that touch users can reach it.
Discussion link scrolling has a backend-free browser regression:
`bunx playwright test --config src/lib/core/messages/browser-test/playwright.config.ts`.
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 1b35d8e2fa..767417de4a 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
@@ -69,11 +69,14 @@ test.afterEach(async ({ page }) => {
});
for (const size of WIDTHS) {
+ // The `mobile:` variant: touch and under 640px.
+ const phone = size.touch && size.width < 640;
+
test.describe(size.name, () => {
test.use({
viewport: { width: size.width, height: size.height },
hasTouch: size.touch,
- isMobile: size.touch && size.width < 640,
+ isMobile: phone,
});
test('every row shows its one reason, on one line', async ({ page }) => {
@@ -127,12 +130,9 @@ for (const size of WIDTHS) {
if (size.stacked) {
expect(await subjectWidth('reply')).toBe(await subjectWidth('other'));
}
- // One-line rows keep a readable subject beside the pills, and the meter too.
+ // One-line rows keep a readable subject beside the pills and the meter.
else {
- expect(await subjectWidth('due-soon')).toBeGreaterThanOrEqual(200);
- await page.getByRole('button', { name: 'Importance' }).click();
expect(await subjectWidth('due-soon')).toBeGreaterThanOrEqual(130);
- await page.getByRole('button', { name: 'Most recent' }).click();
}
const horizontalOverflow = await page.evaluate(
@@ -143,28 +143,23 @@ for (const size of WIDTHS) {
expect(horizontalOverflow).toBe(false);
});
- test('a due date shows beside the reason, on both sorts', async ({
- page,
- }) => {
+ test('a due date shows beside the reason', async ({ page }) => {
await open(page);
const pill = (id: string, label: string | RegExp) =>
page.getByTestId(`row-${id}`).getByText(label, { exact: true });
- for (const sort of ['Most recent', 'Importance']) {
- await page.getByRole('button', { name: sort }).click();
- await expect(
- pill('due-soon', /^Due (Mon|Tue|Wed|Thu|Fri|Sat|Sun)$/)
- ).toBeVisible();
- await expect(pill('due-today', 'Due today')).toBeVisible();
- await expect(pill('due-tomorrow', 'Due tomorrow')).toBeVisible();
- await expect(pill('overdue', 'Overdue')).toBeVisible();
- await expect(
- pill('due-no-reason', /^Due [A-Z][a-z]{2} \d{1,2}(, \d{4})?$/)
- ).toBeVisible();
- await expect(
- page.getByTestId('row-reply').getByText(/^(Due|Overdue)/)
- ).toHaveCount(0);
- }
+ await expect(
+ pill('due-soon', /^Due (Mon|Tue|Wed|Thu|Fri|Sat|Sun)$/)
+ ).toBeVisible();
+ await expect(pill('due-today', 'Due today')).toBeVisible();
+ await expect(pill('due-tomorrow', 'Due tomorrow')).toBeVisible();
+ await expect(pill('overdue', 'Overdue')).toBeVisible();
+ await expect(
+ pill('due-no-reason', /^Due [A-Z][a-z]{2} \d{1,2}(, \d{4})?$/)
+ ).toBeVisible();
+ await expect(
+ page.getByTestId('row-reply').getByText(/^(Due|Overdue)/)
+ ).toHaveCount(0);
// The warning tone sets an overdue row apart from one that is only due.
const border = (id: string, label: string | RegExp) =>
@@ -174,16 +169,25 @@ for (const size of WIDTHS) {
);
});
- test('the meter shows only under the importance sort, in its band color', async ({
+ test('phones leave out the meter, number and bars', async ({ page }) => {
+ test.skip(!phone);
+ await open(page);
+ await expect(page.getByRole('img', { name: /^Importance/ })).toHaveCount(
+ 0
+ );
+ await expect(
+ page.getByTestId('row-reply').getByText('92', { exact: true })
+ ).toBeHidden();
+ });
+
+ test('the meter shows on every row, in its band color', async ({
page,
}) => {
+ test.skip(phone);
await open(page);
const meters = page.getByRole('img', {
name: /^Importance \d+ of 100(, (rising|falling))?$/,
});
- await expect(meters).toHaveCount(0);
-
- await page.getByRole('button', { name: 'Importance' }).click();
await expect(meters).toHaveCount(Object.keys(REASONS).length);
const reply = page.getByTestId('row-reply');
await expect(
@@ -203,16 +207,13 @@ for (const size of WIDTHS) {
return [...colors];
});
expect(firstBarColors).toHaveLength(6);
-
- await page.getByRole('button', { name: 'Most recent' }).click();
- await expect(meters).toHaveCount(0);
});
test('the label says which way importance is moving, with no icon', async ({
page,
}) => {
+ test.skip(phone);
await open(page);
- await page.getByRole('button', { name: 'Importance' }).click();
const labels: Record<string, string> = {
reply: 'Importance 92 of 100, rising',
'follow-up': 'Importance 71 of 100, falling',
diff --git a/apps/web/src/features/email-view/browser-test/focus-rows.tsx b/apps/web/src/features/email-view/browser-test/focus-rows.tsx
index a8a1adae9b..89fd01d823 100644
--- a/apps/web/src/features/email-view/browser-test/focus-rows.tsx
+++ b/apps/web/src/features/email-view/browser-test/focus-rows.tsx
@@ -19,7 +19,7 @@ import { queryClient } from '@queries/client';
import { mapEmailFocus } from '@queries/email/focus';
import type { EmailFocusQuery } from '@service-storage/graphql/generated/graphql';
import { addDays } from 'date-fns';
-import { createSignal, For, type JSX } from 'solid-js';
+import { createSignal, For } from 'solid-js';
import { render } from 'solid-js/web';
import { macroDarkTheme } from '../../theme/themes/macro-dark';
import { macroLightTheme } from '../../theme/themes/macro-light';
@@ -29,7 +29,6 @@ import {
EmailFocusReason,
EmailFocusScore,
} from '../components/EmailFocusBadges';
-import type { EmailFocusSort } from '../constants';
const VIEWER_ID = 'macro|[email protected]';
@@ -209,23 +208,9 @@ const ROWS = mapEmailFocus({
});
function Fixture() {
- const [sort, setSort] = createSignal<EmailFocusSort>('recent');
const [list, setList] = createSignal<HTMLElement>();
- const sortButton = (value: EmailFocusSort, label: string): JSX.Element => (
- <button
- type="button"
- aria-pressed={sort() === value}
- onClick={() => setSort(value)}
- >
- {label}
- </button>
- );
return (
<main class="flex h-dvh flex-col bg-panel text-ink">
- <div class="flex h-8 shrink-0 gap-2 px-2 text-xs text-ink-muted">
- {sortButton('recent', 'Most recent')}
- {sortButton('importance', 'Importance')}
- </div>
<div ref={setList} class="soup-list min-h-0 flex-1 overflow-y-auto">
<ListLayoutProvider
ref={list}
@@ -240,9 +225,9 @@ function Fixture() {
<ListEntity
entity={entity}
meta={<EmailFocusReason entity={entity} />}
- metaEnd={<EmailFocusScore entity={entity} sort={sort()} />}
+ metaEnd={<EmailFocusScore entity={entity} />}
previewLeading={
- <EmailFocusPreviewLeading entity={entity} sort={sort()} />
+ <EmailFocusPreviewLeading entity={entity} />
}
/>
</div>
diff --git a/apps/web/src/features/email-view/components/EmailFocusBadges.test.tsx b/apps/web/src/features/email-view/components/EmailFocusBadges.test.tsx
index 1e84a6882a..950b82f741 100644
--- a/apps/web/src/features/email-view/components/EmailFocusBadges.test.tsx
+++ b/apps/web/src/features/email-view/components/EmailFocusBadges.test.tsx
@@ -34,9 +34,7 @@ function row(importanceTrend: EmailFocus['importanceTrend']): EntityData {
}
const meterFor = (importanceTrend: EmailFocus['importanceTrend']) => {
- render(() => (
- <EmailFocusScore entity={row(importanceTrend)} sort="importance" />
- ));
+ render(() => <EmailFocusScore entity={row(importanceTrend)} />);
return screen.getByRole('img');
};
@@ -66,9 +64,4 @@ describe('EmailFocusScore', () => {
const meter = meterFor(JSON.parse('"NEWLY_ADDED"'));
expect(meter.getAttribute('aria-label')).toBe('Importance 72 of 100');
});
-
- it('stays off the list unless it is sorted by importance', () => {
- render(() => <EmailFocusScore entity={row('UP')} sort="recent" />);
- expect(screen.queryByRole('img')).toBeNull();
- });
});
diff --git a/apps/web/src/features/email-view/components/EmailFocusBadges.tsx b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
index b5835f46a2..98fb4bab0f 100644
--- a/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
+++ b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
@@ -2,7 +2,6 @@ import type { EmailFocus, EntityData } from '@entity';
import { Badge, cn, TagDot, Tooltip } from '@ui';
import { For, Show } from 'solid-js';
import { match } from 'ts-pattern';
-import type { EmailFocusSort } from '../constants';
import { emailFocusDue } from '../focus-due';
import { emailFocusReason } from '../focus-reason';
@@ -42,7 +41,8 @@ const importanceDirection = (trend: EmailFocus['importanceTrend']) =>
/**
* The 0-100 importance score as a number and a five-bar meter, with which way it
- * is moving, if it is, in the label.
+ * is moving, if it is, in the label. Phones leave it out: beside a reason and a
+ * due date it pushes the due date past the row's edge.
*/
function ImportanceMeter(props: { focus: EmailFocus }) {
const direction = () => importanceDirection(props.focus.importanceTrend);
@@ -54,7 +54,11 @@ function ImportanceMeter(props: { focus: EmailFocus }) {
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">
+ <Tooltip
+ as="span"
+ label={label()}
+ class="inline-flex shrink-0 mobile:hidden"
+ >
<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}
@@ -76,16 +80,10 @@ function ImportanceMeter(props: { focus: EmailFocus }) {
);
}
-/**
- * A Focus row's importance meter, only while the list is sorted by importance:
- * there it explains the order, and elsewhere it only draws the eye.
- */
-export function EmailFocusScore(props: {
- entity: EntityData;
- sort: EmailFocusSort;
-}) {
+/** A Focus row's importance meter, on every sort. */
+export function EmailFocusScore(props: { entity: EntityData }) {
return (
- <Show when={props.sort === 'importance' && emailFocusOf(props.entity)}>
+ <Show when={emailFocusOf(props.entity)}>
{(focus) => <ImportanceMeter focus={focus()} />}
</Show>
);
@@ -150,13 +148,10 @@ export function EmailFocusReason(props: { entity: EntityData }) {
}
/** Both on one line, for stacked rows, which have no metadata column. */
-export function EmailFocusPreviewLeading(props: {
- entity: EntityData;
- sort: EmailFocusSort;
-}) {
+export function EmailFocusPreviewLeading(props: { entity: EntityData }) {
return (
<>
- <EmailFocusScore entity={props.entity} sort={props.sort} />
+ <EmailFocusScore entity={props.entity} />
<EmailFocusReason entity={props.entity} />
</>
);
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsx
index d5135149aa..ac66cbe44b 100644
--- a/apps/web/src/features/email-view/components/EmailList.tsx
+++ b/apps/web/src/features/email-view/components/EmailList.tsx
@@ -863,13 +863,11 @@ export function EmailList(props: EmailListProps) {
metaEnd={
<EmailFocusScore
entity={entityRow().entity}
- sort={state.focusSort}
/>
}
previewLeading={
<EmailFocusPreviewLeading
entity={entityRow().entity}
- sort={state.focusSort}
/>
}
scheduleStatus={
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index a7ee4e0e26..686b254419 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -215,20 +215,22 @@ when: `Due today`, `Due tomorrow`, a weekday for the week ahead (`Due Fri`), or
date (`Due Nov 12`), on either sort, with the full date in its tooltip. A date
before the viewer's local today reads `Overdue` with a warning dot and border. A
thread classified before due dates shipped shows none until new mail arrives, and
-mail naming no firm date shows none. 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. The meter's tooltip and label add `rising` or `falling` while a thread's
+mail naming no firm date shows none. Every row also shows the 0-100 score and five
+bars colored by band, red through green, on either sort, except on phones (touch
+and under 640px), which leave it out so the reason and due date fit. The meter's
+tooltip and label add `rising` or `falling` while a thread's
importance is moving: Jev judges per thread whether it gets more pressing or matters
less as it sits, and the read moves the score from the time of its classified
message until newer mail arrives. Threads classified before those questions stay
flat until their next message. Rows at least 45rem wide keep all of it just before
the date. Narrower Focus rows stack, on touch too, with the subject on its own line
-and all of it ahead of the preview, so a narrow desktop window still shows the meter. The desktop
+and all of it ahead of the preview, so a narrow desktop window still shows the
+meter. The desktop
header's sort dropdown (`Sort Focus`, among the view options) switches between
**Most recent**, the default, and **Importance**, which
is flat with no day headers. Touch layouts, phone or tablet, have no dropdown and
-keep the saved order: Most recent, which shows no meter, unless that browser had
-already saved Importance. A saved order
+keep the saved order: Most recent, unless that browser had already saved
+Importance. A saved order
that no longer exists restores as Most recent. The filter menu adds a Focus group (Reply
needed, Follow up) on this tab only and has no Status or Done group there. The
list is one `user.emailFocus` GraphQL read filtered on the client. New mail