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.

style(soup): update task grid view (#3188)

Seamus8e3ea6366635
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/TaskListHeader.tsx b/js/app/packages/app/component/next-soup/soup-view/views/tasks/TaskListHeader.tsx
index 0930245760..ae2fd27c3b 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/TaskListHeader.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/TaskListHeader.tsx
@@ -7,8 +7,8 @@ import { cn } from '@ui/utils/classname';
import { For, type JSX, Show } from 'solid-js';
import {
TASK_GRID_COLUMNS,
- TASK_GRID_TEMPLATE_AREAS,
- TASK_GRID_TEMPLATE_COLUMNS,
+ TASK_GRID_TEMPLATE_AREAS_WIDE,
+ TASK_GRID_TEMPLATE_COLUMNS_WIDE,
} from './task-grid-template';
import './list-property-value.css';
@@ -50,8 +50,8 @@ export function TaskListHeader(props: { class?: string }) {
props.class
)}
style={{
- 'grid-template-columns': TASK_GRID_TEMPLATE_COLUMNS,
- 'grid-template-areas': TASK_GRID_TEMPLATE_AREAS,
+ 'grid-template-columns': TASK_GRID_TEMPLATE_COLUMNS_WIDE,
+ 'grid-template-areas': TASK_GRID_TEMPLATE_AREAS_WIDE,
}}
>
<div style={{ 'grid-area': 'indicator' }} />
@@ -76,6 +76,13 @@ export function TaskListHeader(props: { class?: string }) {
</div>
)}
</For>
+ {/* Created By column - only shown on wide containers (>1220px) */}
+ <div
+ style={{ 'grid-area': 'createdBy' }}
+ class="truncate hidden @min-[1221px]/uList:block"
+ >
+ Created By
+ </div>
<div style={{ 'grid-area': 'timestamp' }} class="text-right">
Updated
</div>
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.css b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.css
index 31f4aef6a8..beb9ba8715 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.css
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.css
@@ -2,14 +2,24 @@
--task-col-status: 7rem;
--task-col-priority: 7rem;
--task-col-assignees: 7rem;
+ --task-col-created-by: 7rem;
--task-col-timestamp: 5rem;
}
+/* Medium containers: hide Created By column */
+@container uList (max-width: 1220px) {
+ .task-grid-row {
+ --task-col-created-by: 0rem;
+ }
+}
+
+/* Narrow containers: collapse property columns to icons */
@container uList (max-width: 840px) {
.task-grid-row {
--task-col-status: 2rem;
--task-col-priority: 2rem;
--task-col-assignees: 2rem;
+ --task-col-created-by: 0rem;
--task-col-timestamp: 5rem;
}
}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
index 4771f459f0..c03a522540 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/list-property-value.tsx
@@ -10,6 +10,8 @@ import {
} from '@core/component/Properties/utils';
import { Tooltip } from '@core/component/Tooltip';
import { UserGroup } from '@core/component/UserGroup';
+import { UserIcon } from '@core/component/UserIcon';
+import { tryMacroId, useDisplayNameParts } from '@core/user';
import CaretDownIcon from '@icon/regular/caret-down.svg';
import CircleDashedEmpty from '@icon/regular/circle-dashed.svg';
import { cn } from '@ui/utils/classname';
@@ -133,6 +135,48 @@ const ListSelectValue: Component<{ property: Property }> = (props) => {
);
};
+/** Single user display with icon + truncated first name */
+const SingleUserValue: Component<{ userId: string }> = (props) => {
+ const nameParts = () => useDisplayNameParts(tryMacroId(props.userId));
+ const firstName = () => nameParts().firstName() || 'Unknown';
+
+ return (
+ <div class="flex items-center gap-1.5 min-w-0">
+ <UserIcon id={props.userId} size="sm" suppressClick showTooltip />
+ {/* First name hidden on narrow containers */}
+ <span class="truncate @max-[840px]/uList:hidden">{firstName()}</span>
+ </div>
+ );
+};
+
+/** Multi-user display with avatar stack */
+const MultiUserValue: Component<{ userIds: string[] }> = (props) => {
+ return (
+ <>
+ {/* Wide mode: show up to 2 users */}
+ <div class="flex @max-[840px]/uList:hidden">
+ <UserGroup
+ userIds={props.userIds}
+ size="sm"
+ suppressClick
+ showTooltip
+ maxUsers={2}
+ />
+ </div>
+ {/* Narrow mode: show 1 user */}
+ <div class="hidden @max-[840px]/uList:flex">
+ <UserGroup
+ userIds={props.userIds}
+ size="sm"
+ suppressClick
+ showTooltip
+ maxUsers={1}
+ />
+ </div>
+ </>
+ );
+};
+
const ListEntityValue: Component<{ property: Property }> = (props) => {
const context = usePropertiesContext();
@@ -147,6 +191,7 @@ const ListEntityValue: Component<{ property: Property }> = (props) => {
const entities = () => getEntityValues(props.property);
const isUser = () => props.property.specificEntityType === 'USER';
const hasValues = () => entities().length > 0;
+ const isSingleUser = () => isUser() && entities().length === 1;
return (
<Tooltip
@@ -182,25 +227,15 @@ const ListEntityValue: Component<{ property: Property }> = (props) => {
</span>
}
>
- {/* Wide mode: show up to 2 users. Narrow mode: show 1 user */}
- <div class="flex @max-[840px]/uList:hidden">
- <UserGroup
- userIds={entities().map((e) => e.entity_id)}
- size="sm"
- suppressClick
- showTooltip
- maxUsers={2}
- />
- </div>
- <div class="hidden @max-[840px]/uList:flex">
- <UserGroup
- userIds={entities().map((e) => e.entity_id)}
- size="sm"
- suppressClick
- showTooltip
- maxUsers={1}
- />
- </div>
+ {/* Single user: show icon + first name */}
+ <Show
+ when={isSingleUser()}
+ fallback={
+ <MultiUserValue userIds={entities().map((e) => e.entity_id)} />
+ }
+ >
+ <SingleUserValue userId={entities()[0].entity_id} />
+ </Show>
</Show>
</Show>
{/* Caret hidden when container is narrow */}
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-layout.tsx b/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-layout.tsx
index 5450aa349f..5ccbb14888 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-layout.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-layout.tsx
@@ -7,6 +7,8 @@ import type {
Property,
PropertyApiValues,
} from '@core/component/Properties/types';
+import { UserIcon } from '@core/component/UserIcon';
+import { tryMacroId, useDisplayNameParts } from '@core/user';
import {
Entity,
type EntityData,
@@ -16,7 +18,10 @@ import {
ProjectBreadCrumb,
UnreadIndicator,
} from '@entity';
-import { SharedBadgeSmall } from '@entity/components/Badges';
+import {
+ CreatedByBadgeSmall,
+ SharedBadgeSmall,
+} from '@entity/components/Badges';
import type { LayoutProps } from '@entity/composed/list-entity/shared';
import { soupPropertyToProperty } from '@entity/extractors-property';
import { useUserId } from '@queries/auth';
@@ -28,8 +33,8 @@ import { createMemo, For, Show, Suspense } from 'solid-js';
import { ListPropertyValue } from './list-property-value';
import {
TASK_GRID_COLUMNS,
- TASK_GRID_TEMPLATE_AREAS,
- TASK_GRID_TEMPLATE_COLUMNS,
+ TASK_GRID_TEMPLATE_AREAS_WIDE,
+ TASK_GRID_TEMPLATE_COLUMNS_WIDE,
type TaskGridColumn,
} from './task-grid-template';
@@ -60,6 +65,13 @@ function buildStubProperty(col: TaskGridColumn): Property {
export function TaskGridLayout(props: LayoutProps) {
const currentId = useUserId();
const entity = () => props.entity as EntityWithProperties<EntityData>;
+ const isShared = () => props.entity.ownerId !== currentId();
+
+ // Get owner's first name for the Created By column
+ const ownerNameParts = () =>
+ useDisplayNameParts(tryMacroId(props.entity.ownerId));
+ const ownerDisplayName = () =>
+ isShared() ? ownerNameParts().firstName() || 'Unknown' : 'Me';
const propertyMap = createMemo(() => {
const map = new Map<string, Property>();
@@ -108,8 +120,8 @@ export function TaskGridLayout(props: LayoutProps) {
'gap-2 grid grid-rows-[1fr]'
)}
style={{
- 'grid-template-columns': TASK_GRID_TEMPLATE_COLUMNS,
- 'grid-template-areas': TASK_GRID_TEMPLATE_AREAS,
+ 'grid-template-columns': TASK_GRID_TEMPLATE_COLUMNS_WIDE,
+ 'grid-template-areas': TASK_GRID_TEMPLATE_AREAS_WIDE,
}}
>
<Entity.Slot placement="indicator" class="relative size-full group">
@@ -154,8 +166,16 @@ export function TaskGridLayout(props: LayoutProps) {
</span>
)}
</Show>
- <Show when={props.entity.ownerId !== currentId()}>
- <SharedBadgeSmall ownerId={props.entity.ownerId} />
+ {/* Show shared badges on narrow/medium containers, hide on wide (>1220px) */}
+ <Show when={isShared()}>
+ {/* Narrow: "shared this with you" tooltip */}
+ <span class="@min-[841px]/uList:hidden">
+ <SharedBadgeSmall ownerId={props.entity.ownerId} />
+ </span>
+ {/* Medium (841px-1220px): "Created by" tooltip */}
+ <span class="hidden @min-[841px]/uList:inline @min-[1221px]/uList:hidden">
+ <CreatedByBadgeSmall ownerId={props.entity.ownerId} />
+ </span>
</Show>
</Entity.Slot>
@@ -174,6 +194,15 @@ export function TaskGridLayout(props: LayoutProps) {
)}
</For>
+ {/* Created By column - only shown on wide containers (>1220px) */}
+ <Entity.Slot
+ placement="createdBy"
+ class="hidden @min-[1221px]/uList:flex items-center gap-1.5 min-w-0 overflow-hidden text-xs ph-no-capture"
+ >
+ <UserIcon id={props.entity.ownerId} size="sm" showTooltip={true} />
+ <span class="truncate text-ink-muted">{ownerDisplayName()}</span>
+ </Entity.Slot>
+
<Entity.Slot
placement="timestamp"
class="text-xs font-mono text-right text-ink-extra-muted uppercase font-light"
diff --git a/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-template.ts b/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-template.ts
index f10bd88b33..c9e42a8511 100644
--- a/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-template.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/views/tasks/task-grid-template.ts
@@ -33,12 +33,33 @@ export const TASK_GRID_COLUMNS = [
},
] as const;
+/** Width for the "Created By" column - only shown on wide containers */
+export const CREATED_BY_COLUMN_WIDTH = 'var(--task-col-created-by, 7rem)';
+
export type TaskGridColumn = (typeof TASK_GRID_COLUMNS)[number];
-export const TASK_GRID_TEMPLATE_COLUMNS = `1rem minmax(0, 100%) ${TASK_GRID_COLUMNS.map(
+/** Grid template for narrow containers (no Created By column) */
+export const TASK_GRID_TEMPLATE_COLUMNS_NARROW = `1rem minmax(0, 100%) ${TASK_GRID_COLUMNS.map(
(c) => c.width
).join(' ')} var(--task-col-timestamp, 5rem)`;
-export const TASK_GRID_TEMPLATE_AREAS = `"indicator content ${TASK_GRID_COLUMNS.map(
+/** Grid template for wide containers (includes Created By column) */
+export const TASK_GRID_TEMPLATE_COLUMNS_WIDE = `1rem minmax(0, 100%) ${TASK_GRID_COLUMNS.map(
+ (c) => c.width
+).join(' ')} ${CREATED_BY_COLUMN_WIDTH} var(--task-col-timestamp, 5rem)`;
+
+/** @deprecated Use TASK_GRID_TEMPLATE_COLUMNS_NARROW or TASK_GRID_TEMPLATE_COLUMNS_WIDE */
+export const TASK_GRID_TEMPLATE_COLUMNS = TASK_GRID_TEMPLATE_COLUMNS_NARROW;
+
+/** Grid template areas for narrow containers (no Created By column) */
+export const TASK_GRID_TEMPLATE_AREAS_NARROW = `"indicator content ${TASK_GRID_COLUMNS.map(
(c) => c.id
).join(' ')} timestamp"`;
+
+/** Grid template areas for wide containers (includes Created By column) */
+export const TASK_GRID_TEMPLATE_AREAS_WIDE = `"indicator content ${TASK_GRID_COLUMNS.map(
+ (c) => c.id
+).join(' ')} createdBy timestamp"`;
+
+/** @deprecated Use TASK_GRID_TEMPLATE_AREAS_NARROW or TASK_GRID_TEMPLATE_AREAS_WIDE */
+export const TASK_GRID_TEMPLATE_AREAS = TASK_GRID_TEMPLATE_AREAS_NARROW;
diff --git a/js/app/packages/entity/src/components/Badges.tsx b/js/app/packages/entity/src/components/Badges.tsx
index 140d9f4ccb..4f7c411e7c 100644
--- a/js/app/packages/entity/src/components/Badges.tsx
+++ b/js/app/packages/entity/src/components/Badges.tsx
@@ -60,6 +60,38 @@ export function SharedBadgeSmall(props: { ownerId: string }) {
);
}
+export function CreatedByBadgeSmall(props: { ownerId: string }) {
+ const id = () => tryMacroId(props.ownerId);
+ const name = () => {
+ const currentId = id();
+ if (currentId) {
+ let [name] = useDisplayName(currentId);
+ return name;
+ }
+ return () => undefined;
+ };
+
+ return (
+ <Tooltip
+ tooltip={
+ <div class="flex items-center gap-1.5 text-xs">
+ <UserIcon
+ id={props.ownerId}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ <span>Created by {name()()}</span>
+ </div>
+ }
+ >
+ <div class="text-ink-extra-muted/50 p-1">
+ <UserPlus class="size-4" />
+ </div>
+ </Tooltip>
+ );
+}
+
export function DraftBadge() {
return <Badge class="text-accent-30 border-edge-muted px-2">draft</Badge>;
}