Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(activity): most-active entities as an inline chip row under the graph (#6236)
teo17a1dc18481b
diff --git a/apps/web/src/features/activity/components/top-entities.tsx b/apps/web/src/features/activity/components/top-entities.tsxindex 7a5498ab9e..496ab1d914 100644--- a/apps/web/src/features/activity/components/top-entities.tsx+++ b/apps/web/src/features/activity/components/top-entities.tsx@@ -2,62 +2,62 @@ import { SoupSectionHeader } from '@app/features/next-soup/soup-view/section-heaimport { type JSX, Show } from 'solid-js';import type { EntityDisplay } from '../context/activity-context';import type { ActivityTopEntity } from '../core/event';-import { EntityMention } from './entity-mention';-/** The "Most active" section chrome; the view supplies the rows. */-export function TopEntitiesSection(props: {- empty: boolean;- children: JSX.Element;-}) {+/**+ * The "Most active" chips as one wrapping row under the graph card, headed+ * like the feed's day sections. The view supplies the chips and hides the+ * section when there are none.+ */+export function TopEntitiesSection(props: { children: JSX.Element }) {return (- <section class="min-w-0" aria-label="Most active">- <SoupSectionHeader>Most active</SoupSectionHeader>- <Show- when={!props.empty}- fallback={- <p class="px-2 py-2 text-ink-muted text-sm">No entities yet.</p>- }- >+ <section+ class="flex min-w-0 flex-col gap-1.5"+ aria-labelledby="activity-most-active-heading"+ >+ <SoupSectionHeader class="mx-0 my-0 w-full">+ <h2 id="activity-most-active-heading">Most active</h2>+ </SoupSectionHeader>+ <div class="flex min-w-0 flex-wrap items-center gap-1.5 px-1">{props.children}- </Show>+ </div></section>);}/**- * One most-active row sharing the feed's row chrome: mention on the left,- * action count on the right. Without a resolved display the entity kind is- * not linkable and the row reads "Item".+ * One most-active entity as a pill: icon, name, action count. Without a+ * resolved display the entity kind is not linkable and the chip reads+ * "Item". `rowProps` carry the host's click-to-open handlers.*/-export function TopEntityRow(props: {+export function TopEntityChip(props: {entity: ActivityTopEntity;display?: EntityDisplay;rowProps?: JSX.HTMLAttributes<HTMLDivElement>;}) {return (- <div class="mx-1 flex w-[calc(100%-0.5rem)] items-stretch px-2 text-sm">- <div- {...props.rowProps}- class="flex min-h-10 min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-0.5 hover:bg-hover/30"+ <div+ {...props.rowProps}+ class="inline-flex max-w-full cursor-default items-center gap-1.5 rounded-full border border-edge-muted bg-surface px-2.5 py-1 text-xs hover:bg-hover/30"+ data-activity-top-entity+ >+ <Show+ when={props.display}+ fallback={<span class="text-ink-extra-muted">Item</span>}>- <span class="min-w-0 truncate">- <Show- when={props.display}- fallback={<span class="text-ink-extra-muted">Item</span>}- >- {(display) => (- <EntityMention- entityId={props.entity.entityId}- display={display()}- />- )}- </Show>- </span>- <span class="ml-auto shrink-0 text-right font-medium text-ink-extra-muted text-xs tabular-nums">- {props.entity.count.toLocaleString()}{' '}- {props.entity.count === 1 ? 'action' : 'actions'}- </span>- </div>+ {(display) => (+ <>+ <span class="flex shrink-0 items-center [&_svg]:size-3.5">+ {display().icon()}+ </span>+ <span class="max-w-[24ch] truncate text-ink">+ {display().name()}+ </span>+ </>+ )}+ </Show>+ <span class="shrink-0 text-ink-extra-muted tabular-nums">+ {props.entity.count.toLocaleString()}+ </span></div>);}diff --git a/apps/web/src/features/activity/views/my-activity-view.test.tsx b/apps/web/src/features/activity/views/my-activity-view.test.tsxindex c74a411b67..2deef70563 100644--- a/apps/web/src/features/activity/views/my-activity-view.test.tsx+++ b/apps/web/src/features/activity/views/my-activity-view.test.tsx@@ -137,22 +137,34 @@ describe('MyActivityView', () => {expect(container.textContent).toContain('No activity yet.');});- it('lists the most active entities and opens them', () => {+ it('renders the most active entities as chips under the graph and opens them', () => {const { container, onOpen, graphql } = renderView();graphql.latest('MyActivityOverview').resolve(overviewPage({- total: 4,- topEntities: [{ entityType: 'DOCUMENT', entityId: 'doc-7', count: 4 }],+ total: 7,+ topEntities: [+ { entityType: 'DOCUMENT', entityId: 'doc-7', count: 4 },+ { entityType: 'DOCUMENT', entityId: 'doc-8', count: 3 },+ ],}));- expect(container.textContent).toContain('Most active');- expect(container.textContent).toContain('4 actions');-const section = screen.getByLabelText('Most active');- const body = section.querySelector('.hover\\:bg-hover\\/30');- if (!body) throw new Error('top entity body not rendered');- fireEvent.click(body);+ const chips = section.querySelectorAll('[data-activity-top-entity]');+ expect(chips).toHaveLength(2);+ expect(chips[0]?.textContent).toContain('4');+ expect(section.textContent).not.toContain('actions');++ const graph = container.querySelector(+ '[aria-labelledby="activity-actions-heading"]'+ );+ expect(graph?.closest('[data-layer]')?.parentElement).toBe(+ section.parentElement+ );++ const chip = chips[0];+ if (!chip) throw new Error('top entity chip not rendered');+ fireEvent.click(chip);expect(onOpen).toHaveBeenCalledExactlyOnceWith({block: 'md',@@ -161,4 +173,11 @@ describe('MyActivityView', () => {newSplit: false,});});++ it('renders no most-active row when the overview has no top entities', () => {+ const { container, graphql } = renderView();+ graphql.latest('MyActivityOverview').resolve(overviewPage({ total: 0 }));+ expect(screen.queryByLabelText('Most active')).toBeNull();+ expect(container.textContent).not.toContain('No entities yet.');+ });});diff --git a/apps/web/src/features/activity/views/my-activity-view.tsx b/apps/web/src/features/activity/views/my-activity-view.tsxindex 453b9d311d..0bff1a0dab 100644--- a/apps/web/src/features/activity/views/my-activity-view.tsx+++ b/apps/web/src/features/activity/views/my-activity-view.tsx@@ -4,7 +4,7 @@ import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/componentimport { Button } from '@ui';import { For, type JSX, Match, Show, Switch } from 'solid-js';import { ActionGraph } from '../components/action-graph';-import { TopEntitiesSection, TopEntityRow } from '../components/top-entities';+import { TopEntitiesSection, TopEntityChip } from '../components/top-entities';import {type OpenEntityTarget,useActivityContext,@@ -79,23 +79,21 @@ export function MyActivityView(props: {}>{(overview) => (- <>- <OverviewInset>- <ActionGraph overview={overview()} />- </OverviewInset>- <TopEntitiesSection- empty={overview().topEntities.length === 0}- >- <For each={overview().topEntities}>- {(entity) => (- <OpenableTopEntityRow- entity={entity}- onOpen={props.onOpen}- />- )}- </For>- </TopEntitiesSection>- </>+ <OverviewInset>+ <ActionGraph overview={overview()} />+ <Show when={overview().topEntities.length > 0}>+ <TopEntitiesSection>+ <For each={overview().topEntities}>+ {(entity) => (+ <OpenableTopEntityChip+ entity={entity}+ onOpen={props.onOpen}+ />+ )}+ </For>+ </TopEntitiesSection>+ </Show>+ </OverviewInset>)}</Show><Switch>@@ -165,7 +163,7 @@ function NamedActivityRow(props: {);}-function OpenableTopEntityRow(props: {+function OpenableTopEntityChip(props: {entity: ActivityTopEntity;onOpen: (target: OpenEntityTarget) => void;}) {@@ -177,7 +175,7 @@ function OpenableTopEntityRow(props: {props.onOpen);return (- <TopEntityRow+ <TopEntityChipentity={props.entity}display={opener()?.display}rowProps={opener()?.handlers}diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex 4193df1a82..d0190491bc 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -86,7 +86,10 @@ Board/List views, `Company` create button. Requires a team ("Join a team to enab## Activity — `/app/component/activity`GitHub-style actions heatmap (one a11y node per day — makes snapshots huge; prefer saving the-snapshot to a file) plus a feed of "You edited/created X" entries.+snapshot to a file), then a `Most active` section header (styled like the feed's day headers)+over a wrapping row of pill chips (entity icon, name, action count; click opens the entity,+shift-click opens a new split; the section is absent when there are no entities), then a feed+of "You edited/created X" entries.## Home — `/app/component/home`