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(views): correct date labels and crm loading skeletons (#9295)

dev-rb05832ca904fb
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index b727c1e18a..76950bdb3c 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -279,6 +279,10 @@ about its groups (labels, order, membership) is computed on the server and
mirrored by the cache's local grouping projection; never add a side cache in
feature code to cover a remount.
+Resolve server date-group keys through the shared `DATE_GROUP_BUCKETS` metadata
+in `lib/queries/soup/grouped/api.ts` for labels and display order; cached Mail
+uses the same metadata.
+
Keep persistent list hotkeys free of mounted-view closures, and clear
virtualizer accessors when their view unmounts.
Keep editor newline handling local; result-opening handlers must yield
diff --git a/apps/web/src/features/crm/README.md b/apps/web/src/features/crm/README.md
index f390512045..24cb7231e3 100644
--- a/apps/web/src/features/crm/README.md
+++ b/apps/web/src/features/crm/README.md
@@ -87,8 +87,10 @@ joins the CRM list only after a row has a Companies or Contacts link.
CRM collection and record lists use full-height empty states, horizontally
centered and raised toward the toolbar, with
creation guidance, distinct search-empty actions, retryable error states, and
-shared list skeletons. Keep search and available header actions visible in every
-state. A failed continuation retains rows and retries that page.
+shared list skeletons with compact single-line rows, small icons, varied title
+widths, and supporting metadata columns that hide in narrow panes. Keep search
+and available header actions visible in every state. A failed continuation retains
+rows and retries that page.
Workspace activity uses the shared single-row desktop header with New and an
expandable Search control; record-detail tabs retain their section toolbar.
Company and contact headers keep desktop section tabs; touch uses a labeled
diff --git a/apps/web/src/features/crm/components/list-state.tsx b/apps/web/src/features/crm/components/list-state.tsx
index f0b8e93a5d..e00dbc1981 100644
--- a/apps/web/src/features/crm/components/list-state.tsx
+++ b/apps/web/src/features/crm/components/list-state.tsx
@@ -75,15 +75,25 @@ export function CrmListSkeleton(props: { label?: string; count?: number }) {
return (
<ListSkeleton.Root
label={props.label ?? 'Loading CRM list'}
- class="w-full shrink-0 py-2"
+ class="@container/crm-skeleton w-full shrink-0 overflow-hidden py-1"
>
<For each={Array.from({ length: props.count ?? 6 })}>
- {() => (
- <ListSkeleton.Row class="gap-3 px-4">
- <ListSkeleton.Bar class="size-7 shrink-0 rounded-full" />
- <div class="flex min-w-0 flex-1 flex-col gap-2">
- <ListSkeleton.Bar class="w-1/2" />
- <ListSkeleton.Bar class="h-2 w-2/3 opacity-60" />
+ {(_, index) => (
+ <ListSkeleton.Row class="h-10 gap-2 px-3">
+ <div class="size-4 shrink-0" />
+ <ListSkeleton.Bar class="size-4 shrink-0 rounded" />
+ <div class="min-w-0 flex-1">
+ <div
+ style={{ width: `${[10, 8, 12, 9, 11, 7][index() % 6]}rem` }}
+ class="max-w-full"
+ >
+ <ListSkeleton.Bar class="w-full" />
+ </div>
+ </div>
+ <ListSkeleton.Bar class="hidden w-20 shrink-0 @lg/crm-skeleton:block" />
+ <ListSkeleton.Bar class="hidden w-16 shrink-0 @3xl/crm-skeleton:block" />
+ <div class="flex w-12 shrink-0 justify-end @lg/crm-skeleton:w-20">
+ <ListSkeleton.Bar class="h-2 w-10 opacity-60" />
</div>
</ListSkeleton.Row>
)}
diff --git a/apps/web/src/lib/queries/soup/grouped/api.ts b/apps/web/src/lib/queries/soup/grouped/api.ts
index bd779fd05a..5ca367dbd4 100644
--- a/apps/web/src/lib/queries/soup/grouped/api.ts
+++ b/apps/web/src/lib/queries/soup/grouped/api.ts
@@ -7,6 +7,16 @@ import type { SoupApiItem } from '@service-storage/generated/schemas/soupApiItem
import { match } from 'ts-pattern';
import { type GroupByField, type GroupMeta, NOT_SET_GROUP_KEY } from './types';
+export const DATE_GROUP_BUCKETS = [
+ ['today', 'Today'],
+ ['yesterday', 'Yesterday'],
+ ['this_week', 'This Week'],
+ ['last_week', 'Last Week'],
+ ['this_month', 'This Month'],
+ ['last_month', 'Last Month'],
+ ['older', 'Older'],
+] as const;
+
/** Sort methods the grouped soup endpoints accept. */
export type GroupedSortMethod = Exclude<
NonNullable<Params['sort_method']>,
@@ -139,7 +149,13 @@ export function resolveGroupMetaForKey(
return;
})
- .with({ type: 'date' }, () => undefined)
+ .with({ type: 'date' }, () => {
+ const displayOrder = DATE_GROUP_BUCKETS.findIndex(
+ ([bucketKey]) => bucketKey === key
+ );
+ if (displayOrder === -1) return;
+ return { key, label: DATE_GROUP_BUCKETS[displayOrder][1], displayOrder };
+ })
.exhaustive(() => undefined);
}
diff --git a/apps/web/src/lib/queries/soup/grouped/mail-date-groups.ts b/apps/web/src/lib/queries/soup/grouped/mail-date-groups.ts
index 42ffa00a23..b0e1f388b9 100644
--- a/apps/web/src/lib/queries/soup/grouped/mail-date-groups.ts
+++ b/apps/web/src/lib/queries/soup/grouped/mail-date-groups.ts
@@ -1,16 +1,7 @@
import type { SoupAstItemsData } from '../items';
+import { DATE_GROUP_BUCKETS } from './api';
import type { GroupMeta } from './types';
-const buckets = [
- ['today', 'Today'],
- ['yesterday', 'Yesterday'],
- ['this_week', 'This Week'],
- ['last_week', 'Last Week'],
- ['this_month', 'This Month'],
- ['last_month', 'Last Month'],
- ['older', 'Older'],
-] as const;
-
/** Matches models_grouping's UTC date buckets; counts describe loaded cached mail. */
export function groupCachedMailByDate(
data: SoupAstItemsData,
@@ -49,8 +40,8 @@ export function groupCachedMailByDate(
? 5
: 6;
const group = groups.get(index) ?? {
- key: buckets[index][0],
- label: buckets[index][1],
+ key: DATE_GROUP_BUCKETS[index][0],
+ label: DATE_GROUP_BUCKETS[index][1],
displayOrder: index,
totalCount: 0,
itemIds: [],