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[mobile]: good soup entity layouts on mobile (#2173)
Peter Chinman30b7b1ff4253
diff --git a/js/app/packages/app/component/mobile/EntityRow.tsx b/js/app/packages/app/component/mobile/EntityRow.tsxindex 38137acc2f..fcc9963a46 100644--- a/js/app/packages/app/component/mobile/EntityRow.tsx+++ b/js/app/packages/app/component/mobile/EntityRow.tsx@@ -73,6 +73,11 @@ type EntityRowContextValue = {stateFor: (entityId: string) => EntityRowState;clearState: (entityId: string) => void;collapseEntity: (entityId: string) => Promise<void>;+ registerRowHandler: (+ entityId: string,+ handlers: { onSwipeLeft?: () => void; onSwipeRight?: () => void }+ ) => void;+ unregisterRowHandler: (entityId: string) => void;};export const EntityRowContext = createContext<EntityRowContextValue>();@@ -106,6 +111,11 @@ export function EntityRowProvider(return newState;});};+ const customRowSwipeHandlers = new Map<+ string,+ { onSwipeLeft?: () => void; onSwipeRight?: () => void }+ >();+let touchState: SwipeTouchState = {startX: 0,startY: 0,@@ -181,9 +191,15 @@ export function EntityRowProvider(if (!els) return;const direction = stateById()[entityId]?.direction;if (!direction) return;- const onSwipe =- direction === 'left' ? props.onSwipeLeft : props.onSwipeRight;- if (!onSwipe) return;+ const defaultSwipeLeft = props.onSwipeLeft;+ const defaultSwipeRight = props.onSwipeRight;+ const swipeHandler =+ direction === 'left'+ ? (customRowSwipeHandlers.get(entityId)?.onSwipeLeft ??+ (defaultSwipeLeft ? () => defaultSwipeLeft(entityId) : undefined))+ : (customRowSwipeHandlers.get(entityId)?.onSwipeRight ??+ (defaultSwipeRight ? () => defaultSwipeRight(entityId) : undefined));+ if (!swipeHandler) return;// Cancel any pending animation frameif (rafId) cancelAnimationFrame(rafId);@@ -194,7 +210,7 @@ export function EntityRowProvider(setState(entityId, { phase: 'triggered' });setTimeout(() => {- onSwipe(entityId);+ swipeHandler();}, TRANSLATE_AFTER_TRIGGERED_SPEED);// If row has not been removed, reset it:@@ -207,10 +223,14 @@ export function EntityRowProvider(};const canSwipeRight = (entityId: string) => {+ if (customRowSwipeHandlers.get(entityId)?.onSwipeRight !== undefined)+ return true;if (!props.onSwipeRight) return false;return props.canSwipeRight ? props.canSwipeRight(entityId) : true;};const canSwipeLeft = (entityId: string) => {+ if (customRowSwipeHandlers.get(entityId)?.onSwipeLeft !== undefined)+ return true;if (!props.onSwipeLeft) return false;return props.canSwipeLeft ? props.canSwipeLeft(entityId) : true;};@@ -404,6 +424,12 @@ export function EntityRowProvider(stateById()[entityId] ?? { phase: 'idle', direction: null },clearState: (entityId) => clearState(entityId),collapseEntity,+ registerRowHandler: (entityId, handlers) => {+ customRowSwipeHandlers.set(entityId, handlers);+ },+ unregisterRowHandler: (entityId) => {+ customRowSwipeHandlers.delete(entityId);+ },};return (@@ -413,6 +439,9 @@ export function EntityRowProvider();}+/**+ * Container for swipe gesture capabilities on touch devices.+ */export function EntityRow(props: ParentProps<{entityId: string;@@ -420,6 +449,8 @@ export function EntityRow(swipeLeftRevealedComponent?: JSX.Element;swipeLeftColor?: string;swipeRightColor?: string;+ onSwipeLeft?: () => void;+ onSwipeRight?: () => void;}>) {const ctx = useContext(EntityRowContext);@@ -429,6 +460,13 @@ export function EntityRow(const rowState = createMemo(() => ctx.stateFor(props.entityId));+ createEffect(() => {+ const { onSwipeLeft, onSwipeRight, entityId } = props;+ if (!onSwipeLeft && !onSwipeRight) return;+ ctx.registerRowHandler(entityId, { onSwipeLeft, onSwipeRight });+ onCleanup(() => ctx.unregisterRowHandler(entityId));+ });+onCleanup(() => {ctx.clearState(props.entityId);});@@ -437,7 +475,7 @@ export function EntityRow(<divdata-swipe-rowdata-swipe-entity-id={props.entityId}- class="w-full grid grid-cols-1 relative overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out"+ class="grow w-full grid grid-cols-1 relative overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out"classList={{'bg-transparent': rowState()?.phase === 'idle',[props.swipeLeftColor ?? 'bg-edge-muted']:@@ -490,12 +528,12 @@ export function EntityRow({/* Swipe Surface */}<divdata-swipe-surface- class="relative min-h-0 z-[2] w-full select-none [touch-action:pan-y]"+ class="relative min-h-0 h-full z-[2] w-full select-none [touch-action:pan-y]">{/* Swipe Content */}<divdata-swipe-content- class="w-full min-h-0 overflow-hidden flex items-center p-0 bg-panel"+ class="w-full h-full min-h-0 overflow-hidden flex items-center p-0 bg-panel">{props.children}</div>diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsxindex c688266596..d373ae439b 100644--- a/js/app/packages/app/component/mobile/MobileDock.tsx+++ b/js/app/packages/app/component/mobile/MobileDock.tsx@@ -4,10 +4,16 @@ import { AnimatedInboxIcon } from '@macro-icons/wide/animating/inbox';import { AnimatedSearchIcon } from '@macro-icons/wide/animating/search';import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';import { AnimatedChannelIcon } from '@macro-icons/wide/animating/channel';-import { AnimatedFolderIcon } from '@macro-icons/wide/animating/folder';import { AnimatedSlidersHorizontalIcon } from '@macro-icons/wide/animating/sliders-horizontal';import { impactFeedback } from '@tauri-apps/plugin-haptics';-import { type Component, createSignal, For, type JSX } from 'solid-js';+import {+ type Accessor,+ type Component,+ createSignal,+ For,+ type JSX,+ type Setter,+} from 'solid-js';import { Dynamic } from 'solid-js/web';import { Popover } from '@kobalte/core/popover';import { cn } from '@ui/utils/classname';@@ -20,6 +26,7 @@ import { useSettingsState } from '@core/constant/SettingsState';import { setCreateMenuOpen } from '../Launcher';import { useLocation } from '@solidjs/router';import { useAnalytics } from '@app/component/analytics-context';+import { AnimatedEmailIcon } from '@macro-icons/wide/animating/email';const ICON_ANIMATION_DURATION_MS = 500;@@ -64,7 +71,7 @@ function MobileDockButton(props: MobileDockButtonProps) {);}-const PRIMARY_IDS = ['inbox', 'channels', 'folders', 'search'] as const;+const PRIMARY_IDS = ['inbox', 'channels', 'mail', 'search'] as const;const MORE_VIEWS = SIDEBAR_LINKS.filter((l) => !(PRIMARY_IDS as readonly string[]).includes(l.id)@@ -74,15 +81,16 @@ function MorePopover(props: {active: boolean;isActive: (id: ListView) => boolean;onNavigate: (id: ListView) => void;+ open: Accessor<boolean>;+ setOpen: Setter<boolean>;}) {const analytics = useAnalytics();const { toggleSettings } = useSettingsState();- const [open, setOpen] = createSignal(false);const [anchorRef, setAnchorRef] = createSignal<HTMLElement>();const [hoveredId, setHoveredId] = createSignal<string | null>(null);const handleTouchMove = (e: TouchEvent) => {- if (!open()) return;+ if (!props.open()) return;const touch = e.touches[0];const el = document.elementFromPoint(touch.clientX, touch.clientY);const button = el?.closest('[data-more-item]') as HTMLElement | null;@@ -98,14 +106,14 @@ function MorePopover(props: {setHoveredId(null);if (id === 'settings') {toggleSettings();- setOpen(false);+ props.setOpen(false);} else if (id === 'create') {analytics.track('create_menu_open', { from: 'mobile_dock' });setCreateMenuOpen(true);- setOpen(false);+ props.setOpen(false);} else if (isListViewID(id)) {props.onNavigate(id);- setOpen(false);+ props.setOpen(false);}};@@ -115,19 +123,19 @@ function MorePopover(props: {icon={ChevronUpIcon}label="More"active={props.active}- onClick={() => setOpen((prev) => !prev)}+ onClick={() => props.setOpen((prev) => !prev)}ref={setAnchorRef}onTouchMove={handleTouchMove}onTouchEnd={handleTouchEnd}iconClass={cn('transition-transform duration-200 [perspective:200px]',- open() && '[transform:rotateX(180deg)]'+ props.open() && '[transform:rotateX(180deg)]')}/><Popover- open={open()}+ open={props.open()}onOpenChange={(isOpen) => {- setOpen(isOpen);+ props.setOpen(isOpen);if (!isOpen) setHoveredId(null);}}placement="top"@@ -145,7 +153,7 @@ function MorePopover(props: {onClick={() => {impactFeedback('light');toggleSettings();- setOpen(false);+ props.setOpen(false);}}><div class="w-4 h-4 shrink-0 [&_svg]:size-4">@@ -166,7 +174,7 @@ function MorePopover(props: {impactFeedback('light');analytics.track('create_menu_open', { from: 'mobile_dock' });setCreateMenuOpen(true);- setOpen(false);+ props.setOpen(false);}}><div class="w-4 h-4 shrink-0 [&_svg]:size-4">@@ -187,7 +195,7 @@ function MorePopover(props: {onClick={() => {impactFeedback('light');props.onNavigate(item.id);- setOpen(false);+ props.setOpen(false);}}><div class="w-4 h-4 shrink-0 [&_svg]:size-4">@@ -209,6 +217,7 @@ function MorePopover(props: {export function MobileDock() {const { openWithSplit } = useSplitLayout();const location = useLocation();+ const [moreOpen, setMoreOpen] = createSignal(false);const isActive = (id: ListView) => {const activeContent = globalSplitManager()?.activeSplit()?.content();@@ -232,29 +241,41 @@ export function MobileDock() {icon={AnimatedInboxIcon}label="Inbox"active={isActive('inbox')}- onClick={() => navigate('inbox')}+ onClick={() => {+ setMoreOpen(false);+ navigate('inbox');+ }}/><MobileDockButtonicon={AnimatedChannelIcon}label="Channels"active={isActive('channels')}- onClick={() => navigate('channels')}+ onClick={() => {+ setMoreOpen(false);+ navigate('channels');+ }}/><MobileDockButton- icon={AnimatedFolderIcon}- label="Files"- active={isActive('folders')}- onClick={() => navigate('folders')}+ icon={AnimatedEmailIcon}+ label="Email"+ active={isActive('mail')}+ onClick={() => {+ setMoreOpen(false);+ navigate('mail');+ }}/><MorePopoveractive={isMoreActive()}isActive={isActive}onNavigate={navigate}+ open={moreOpen}+ setOpen={setMoreOpen}/><MobileDockButtonicon={AnimatedSearchIcon}label="Search"onClick={() => {+ setMoreOpen(false);SearchState.maybeResetState();SearchState.open();}}diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsxindex 392c674755..71ab6d7b0a 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx@@ -4,7 +4,7 @@ import {useGlobalBlockOrchestrator,useGlobalNotificationSource,} from '@app/component/GlobalAppState';-import { EntityRow, EntityRowProvider } from '@app/component/mobile/EntityRow';+import { EntityRowProvider } from '@app/component/mobile/EntityRow';import {makeMarkDoneAction,useEntityActionHotkeys,@@ -782,72 +782,70 @@ export const SoupViewList = (props: SoupViewListProps) => {More Results</div></Show>- <EntityRow- entityId={row.original.id}- swipeLeftColor="bg-success"- swipeLeftRevealedComponent={- <CheckIcon class="size-8 text-panel" />- }+ <SoupEntityContextMenu+ entity={row.original}+ entityTimestamp={timestamp()}>- <SoupEntityContextMenu+ <ListEntityentity={row.original}- entityTimestamp={timestamp()}- >- <ListEntity- entity={row.original}- timestamp={timestamp()}- highlighted={- panel.isPanelActive() && row.isFocused()- }- onMouseMove={() => {- if (isKeypressActive()) return;- if (soup.previewEntity()) return;- soup.focus.set(row.original.id);- }}- showUnrollNotifications={- soup.filters.isActive('signal') &&- !soup.filters.isActive('noise')- }- checked={row.isSelected()}- onChecked={(next: boolean, shiftKey: boolean) =>- handleMultiSelectChecked({- entity: row.original,- entityIndex: i(),- next,- shiftKey: shiftKey ?? false,- })- }- onClick={(event: MouseEvent) => {- onEntityClick({- type: 'entity',- entity: row.original,- event,- location: undefined,- });- }}- onProjectClick={(projectEntity, event) => {- onEntityClick({- type: 'project',- projectEntity,- entity: row.original,- event,- location: undefined,- });- }}- onContentHitClick={(- e: PointerEvent | MouseEvent,- location?: SearchLocation- ) => {- onEntityClick({- type: 'entity',- entity: row.original,- event: e,- location,- });- }}- />- </SoupEntityContextMenu>- </EntityRow>+ timestamp={timestamp()}+ highlighted={+ panel.isPanelActive() && row.isFocused()+ }+ onMouseMove={() => {+ if (isKeypressActive()) return;+ if (soup.previewEntity()) return;+ soup.focus.set(row.original.id);+ }}+ showUnrollNotifications={+ soup.filters.isActive('signal') &&+ !soup.filters.isActive('noise')+ }+ checked={row.isSelected()}+ onChecked={(next: boolean, shiftKey: boolean) =>+ handleMultiSelectChecked({+ entity: row.original,+ entityIndex: i(),+ next,+ shiftKey: shiftKey ?? false,+ })+ }+ onClick={(event: MouseEvent) => {+ onEntityClick({+ type: 'entity',+ entity: row.original,+ event,+ location: undefined,+ });+ }}+ onProjectClick={(projectEntity, event) => {+ onEntityClick({+ type: 'project',+ projectEntity,+ entity: row.original,+ event,+ location: undefined,+ });+ }}+ onContentHitClick={(+ e: PointerEvent | MouseEvent,+ location?: SearchLocation+ ) => {+ onEntityClick({+ type: 'entity',+ entity: row.original,+ event: e,+ location,+ });+ }}+ entityRowConfig={{+ swipeLeftColor: 'bg-success',+ swipeLeftRevealedComponent: (+ <CheckIcon class="size-8 text-panel" />+ ),+ }}+ />+ </SoupEntityContextMenu><Showwhen={i() === rows().length - 1 &&diff --git a/js/app/packages/core/component/EntityIcon.tsx b/js/app/packages/core/component/EntityIcon.tsxindex 1d2dffe0e4..0eda8df579 100644--- a/js/app/packages/core/component/EntityIcon.tsx+++ b/js/app/packages/core/component/EntityIcon.tsx@@ -6,6 +6,7 @@ import {itemToBlockName,} from '@core/constant/allBlocks';import { match } from 'ts-pattern';+import { cn } from '@ui/utils/classname';import { USE_WIDE_ICONS } from '@core/constant/featureFlags';import Building from '@icon/duotone/building-duotone.svg';import Chat from '@icon/duotone/chat-duotone.svg';@@ -367,15 +368,13 @@ export function EntityIcon(props: EntityIconProps) {return (<div- class={sizeClass()}- classList={{- 'text-current': isMonochrome(),- [config().foreground]: !isMonochrome(),- [config().background]: props.useBackground && !isMonochrome(),- [config().background]: props.useBackground && isMonochrome(),- 'p-[20%]': props.useBackground,- [`${props.class}`]: !!props.class,- }}+ class={cn(+ sizeClass(),+ isMonochrome() ? 'text-current' : config().foreground,+ props.useBackground && config().background,+ props.useBackground && 'p-[20%]',+ props.class+ )}><Dynamic component={icon()} /></div>diff --git a/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsxindex c2960c0f7d..781047b462 100644--- a/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx+++ b/js/app/packages/core/component/Properties/component/propertyValue/UserGroup.tsx@@ -20,10 +20,10 @@ export const UserGroup = (props: UserEntityPillProps) => {const displayEntities = () => props.entities.slice(0, max());return (- <div class="flex items-center shrink-0 w-fit pr-3">+ <div class="flex items-center shrink-0 w-fit"><For each={displayEntities()}>{(entity) => (- <div class="bg-panel rounded-full p-[2px] -mr-3">+ <div class="bg-panel rounded-full"><UserIconid={entity.entity_id}isDeleted={false}diff --git a/js/app/packages/entity/src/composed/ListEntity.css b/js/app/packages/entity/src/composed/ListEntity.cssnew file mode 100644index 0000000000..f4d147538a--- /dev/null+++ b/js/app/packages/entity/src/composed/ListEntity.css@@ -0,0 +1,30 @@+/* Variables for x-axis alignment of mobile soup inbox Entities */+.soup-list-entity {+ --soup-inbox-unread-indicator-diameter: 11px;+ --soup-inbox-unread-indicator-padding-x: 8px;+ --soup-inbox-unread: calc(+ var(--soup-inbox-unread-indicator-diameter) ++ var(--soup-inbox-unread-indicator-padding-x) * 2+ );+ --soup-inbox-icon-diameter: 44px;+ --soup-inbox-icon-factor: 0.5454;+ --soup-inbox-icon-padding-r: 12px;+ --soup-inbox-left-of-content: calc(+ var(--soup-inbox-unread) + var(--soup-inbox-icon-diameter) ++ var(--soup-inbox-icon-padding-r)+ );++ --soup-stack-icon-diameter: 24px;+ --soup-stack-row-padding-l: calc(+ var(--soup-inbox-unread) + 0.5 * var(--soup-inbox-icon-diameter)+ );+ --soup-stack-row-border-l: 2px;+ --soup-stack-header-icon-padding-l: calc(+ var(--soup-inbox-unread) + 0.5 * var(--soup-inbox-icon-diameter) - 0.5 *+ var(--soup-stack-icon-diameter) - var(--soup-stack-row-padding-l)+ );+ --soup-stack-row-unread-column-width: calc(+ var(--soup-inbox-left-of-content) - var(--soup-stack-row-padding-l) -+ var(--soup-stack-row-border-l)+ );+}diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsxindex d9e27cad27..cfab9582ec 100644--- a/js/app/packages/entity/src/composed/ListEntity.tsx+++ b/js/app/packages/entity/src/composed/ListEntity.tsx@@ -1,3 +1,4 @@+import './ListEntity.css';import type { DateValue } from '@core/util/date';import {visibleLength,@@ -20,7 +21,9 @@ import {type Accessor,createContext,createEffect,+ createMemo,createSignal,+ For,Match,onCleanup,Show,@@ -55,10 +58,24 @@ import { ProjectBreadCrumb } from '../components/ProjectBreadCrumb';import {filterNotDoneNotifications,filterValidNotifications,+ extractMessageContent,+ isNotificationUnread,} from '../utils/notification';+import { getActionVerb } from '../extractors-notification/notification-description-helpers';+import type { NotificationType } from '@core/types';import { useSplitPanel } from '@app/component/split-layout/layoutUtils';+import { useGlobalNotificationSource } from '@app/component/GlobalAppState';+import { toast } from '@core/component/Toast/Toast';+import { EntityRow, EntityRowContext } from '@app/component/mobile/EntityRow';+import {+ type NotificationStack,+ stackNotifications,+ getMostRecentNotification,+ getAllNotificationsFromGroup,+} from '@notifications';import { mergeRefs } from '@solid-primitives/refs';import { createElementSize } from '@solid-primitives/resize-observer';+import { isMobile } from '@core/mobile/isMobile';import { tryMacroId, useDisplayNameParts } from '@core/user';import { DisplayName } from '@entity/components/DisplayName';@@ -130,6 +147,13 @@ function useCharacterCount(ref: Accessor<HTMLElement | undefined>) {return chars;}+type EntityRowConfig = {+ swipeLeftColor?: string;+ swipeLeftRevealedComponent?: JSX.Element;+ swipeRightColor?: string;+ swipeRightRevealedComponent?: JSX.Element;+};+interface ListEntityProps {entity: WithNotification<EntityData>;onClick?: (event: MouseEvent) => void;@@ -150,6 +174,7 @@ interface ListEntityProps {e: PointerEvent | MouseEvent,location?: SearchLocation) => void;+ entityRowConfig?: EntityRowConfig;}interface LayoutProps {@@ -167,6 +192,12 @@ interface LayoutProps {) => void;}+function InboxDivider() {+ return (+ <div class="col-span-3 ml-(--soup-inbox-left-of-content) min-w-full min-h-[1px] max-h-[1px] bg-edge-muted" />+ );+}+function EmailIdentity(props: { entity: EmailEntity }) {return (<>@@ -228,19 +259,13 @@ function ChannelMessage(props: {}function NarrowLayout(props: LayoutProps) {- const [emailSnippetContainerRef, setEmailSnippetContainerRef] = createSignal<- HTMLElement | undefined- >();- const chars = useCharacterCount(emailSnippetContainerRef);-return (<Entity.Layout- class="w-full gap-x-2 items-center text-sm pl-0 px-2 grid"+ class="w-full gap-x-2 items-center text-sm px-2 grid"style={{- 'grid-template-columns': 'auto 1fr 8ch',- 'grid-template-rows': '2.5rem auto',- 'grid-template-areas':- '"indicator title timestamp" "indicator body body"',+ 'grid-template-columns': 'auto 1fr max-content',+ 'grid-template-rows': '44px',+ 'grid-template-areas': '"indicator title timestamp"',}}><Entity.Slot placement="indicator" class="relative self-start pt-3">@@ -266,85 +291,53 @@ function NarrowLayout(props: LayoutProps) {<div class="size-4 shrink-0"><Entity.Icon entity={props.entity} streamState={props.streamState} /></div>- <Switch>- <Match when={isEmailEntity(props.entity) && props.entity}>- {(entity) => <EmailIdentity entity={entity()} />}- </Match>- <Match when={props.entity}>- {(entity) => <Entity.Title entity={entity()} />}- </Match>- </Switch>- <Show when={isTaskEntity(props.entity) && props.entity}>- {(entity) => <Entity.Properties entity={entity()} />}- </Show>- </Entity.Slot>-- <Entity.Slot- placement="timestamp"- class="text-xs font-mono text-right text-ink-extra-muted uppercase font-light"- >- <Show when={!props.hasNotifications}>- <Entity.Timestamp entity={props.entity} />- </Show>+ <Entity.Title entity={props.entity} /></Entity.Slot><Showwhen={- (isEmailEntity(props.entity) || isChannelEntity(props.entity)) &&- !props.hasNotifications+ !props.hasNotifications &&+ !(isChannelEntity(props.entity) && isSearchEntity(props.entity))}>- <Entity.Slot placement="body" class="flex flex-col gap-1 pb-3 -mt-1">- <Switch>- <Match when={isEmailEntity(props.entity) && props.entity}>- {(entity) => (- <>- <div class="flex items-center gap-2 font-semibold truncate">- <span class="truncate">- <Entity.Title entity={entity()} />- </span>- </div>- <div- ref={setEmailSnippetContainerRef}- class="text-ink/50 font-medium w-full truncate inline-flex items-center"- >- <EmailSnippet- entity={entity()}- showContentHits={props.showContentHits}- chars={chars()}- />- </div>- </>- )}- </Match>- <Match when={isChannelEntity(props.entity) && props.entity}>- {(entity) => (- <Show when={entity().latestMessage}>- {(msg) => (- <div class="flex items-center gap-2 w-full truncate">- <ChannelMessage message={msg()} />- </div>- )}- </Show>- )}- </Match>- </Switch>+ <Entity.Slot+ placement="timestamp"+ class="text-xs font-mono text-right text-ink-extra-muted uppercase font-light"+ >+ <Show+ when={!isTaskEntity(props.entity)}+ fallback={<Entity.Properties entity={props.entity} />}+ >+ <Entity.Timestamp entity={props.entity} />+ </Show></Entity.Slot></Show></Entity.Layout>);}-function NarrowMessageLayout(props: LayoutProps) {+function NarrowInboxLayout(props: LayoutProps) {const isDirectMessage = () =>isChannelEntity(props.entity) &&props.entity.channelType === 'direct_message';- const name =+ const [emailSnippetContainerRef, setEmailSnippetContainerRef] = createSignal<+ HTMLElement | undefined+ >();+ const chars = useCharacterCount(emailSnippetContainerRef);++ const mostRecentMessageSenderName =isChannelEntity(props.entity) && props.entity.latestMessage?.senderId? useDisplayNameParts(tryMacroId(props.entity.latestMessage?.senderId)): undefined;+ const firstNotification = () => {+ if (!isWithNotification(props.entity)) return undefined;+ return filterNotDoneNotifications(+ filterValidNotifications(props.entity.notifications?.())+ )[0];+ };+return (<Entity.Layoutclass="w-full text-sm grid"@@ -355,16 +348,22 @@ function NarrowMessageLayout(props: LayoutProps) {'"icon title timestamp" "icon body body" "icon body body"',}}>- <Entity.Slot placement="icon" class="flex items-center self-center pr-3">- <UnreadIndicator class="mx-2 size-2.75" active={props.unread} />- <div class="relative size-11 shrink-0 group">+ <Entity.Slot+ placement="icon"+ class="flex items-center self-center pr-(--soup-inbox-icon-padding-r)"+ >+ <UnreadIndicator+ class="mx-(--soup-inbox-unread-indicator-padding-x) size-(--soup-inbox-unread-indicator-diameter)"+ active={props.unread}+ />+ <div class="relative size-(--soup-inbox-icon-diameter) shrink-0 group"><Show when={!props.checked}><div class="absolute inset-0 grid place-items-center group-hover:opacity-0 transition-opacity"><Showwhen={isDirectMessage()}fallback={- <div class="size-11 bg-edge-muted rounded-full flex items-center justify-center">- <div class="size-6">+ <div class="size-(--soup-inbox-icon-diameter) bg-edge-muted rounded-full flex items-center justify-center">+ <div class="size-[calc(var(--soup-inbox-icon-diameter)*var(--soup-inbox-icon-factor))]"><Entity.Iconentity={props.entity}streamState={props.streamState}@@ -402,8 +401,11 @@ function NarrowMessageLayout(props: LayoutProps) {placement="title"class="flex items-center gap-2 truncate font-semibold pt-3">- <Show when={isChannelEntity(props.entity) && props.entity}>- {(entity) => <Entity.Title entity={entity()} />}+ <Show+ when={isEmailEntity(props.entity) && props.entity}+ fallback={<Entity.Title entity={props.entity} />}+ >+ {(entity) => <EmailIdentity entity={entity()} />}</Show></Entity.Slot>@@ -411,39 +413,91 @@ function NarrowMessageLayout(props: LayoutProps) {placement="timestamp"class="text-xs text-right text-ink-extra-muted font-light pt-3 pr-4">- <Show when={!props.hasNotifications}>+ <Show+ when={+ !props.hasNotifications &&+ !(isChannelEntity(props.entity) && isSearchEntity(props.entity))+ }+ ><Entity.Timestamp entity={props.entity} /></Show></Entity.Slot>- <Show when={isChannelEntity(props.entity) && props.entity}>- {(entity) => (- <Show when={entity().latestMessage}>- {(msg) => (- <>- <Entity.Slot- placement="body"- class="text-ink-extra-muted line-clamp-2 pb-2 min-h-[2lh] pr-4 border-b border-edge-muted"- >- <Show- when={msg().content?.trim()}- fallback={<span class="italic">Attached Items</span>}- >- <StaticMarkdown- theme={twoLineClampMarkdownTheme}- markdown={- (name ? `**${name.firstName()}:** ` : '') +- msg().content.trim()- }- singleLine- />+ <Switch>+ <Match+ when={isChannelEntity(props.entity) && props.entity.latestMessage}+ >+ {(msg) => (+ <Entity.Slot+ placement="body"+ class="text-ink-extra-muted line-clamp-2 pb-2 min-h-[2lh] pr-4"+ >+ <Show+ when={msg().content?.trim()}+ fallback={<span class="italic">Attached Items</span>}+ >+ <StaticMarkdown+ theme={twoLineClampMarkdownTheme}+ markdown={+ (mostRecentMessageSenderName+ ? `**${mostRecentMessageSenderName.firstName()}:** `+ : '') + msg().content.trim()+ }+ singleLine+ />+ </Show>+ </Entity.Slot>+ )}+ </Match>+ <Match when={isEmailEntity(props.entity) && props.entity}>+ {(entity) => (+ <Entity.Slot+ placement="body"+ class="flex flex-col pb-2 min-h-[2lh] pr-4"+ >+ <Entity.Title entity={props.entity} />+ <span+ ref={setEmailSnippetContainerRef}+ class="text-ink/50 font-medium truncate"+ >+ <EmailSnippet+ entity={entity()}+ showContentHits={props.showContentHits}+ chars={chars()}+ />+ </span>+ </Entity.Slot>+ )}+ </Match>+ <Match when={isTaskEntity(props.entity)}>+ <Entity.Slot+ placement="body"+ class="flex flex-col pb-2 min-h-[2lh] pr-4 "+ >+ <Entity.Properties entity={props.entity} />+ <Show when={firstNotification()}>+ {(notif) => (+ <span class="text-ink-extra-muted font-normal truncate">+ <Show when={notif().sender_id}>+ {(senderId) => (+ <>+ <DisplayName id={senderId()} format="firstName" />{' '}+ </>+ )}</Show>- </Entity.Slot>- </>- )}- </Show>- )}- </Show>+ {getActionVerb(+ notif().notification_event_type as NotificationType+ )}+ </span>+ )}+ </Show>+ </Entity.Slot>+ </Match>+ <Match when={true}>+ <Entity.Slot placement="body" class="pb-2 min-h-[2lh] pr-4" />+ </Match>+ </Switch>+ <InboxDivider /></Entity.Layout>);}@@ -483,7 +537,6 @@ function WideLayout(props: LayoutProps) {/></div></Entity.Slot>-<Entity.Slotplacement="content"class="font-semibold truncate items-center gap-2 flex"@@ -531,7 +584,6 @@ function WideLayout(props: LayoutProps) {</Match></Switch></Entity.Slot>-<Entity.Slot placement="meta" class="flex items-center gap-2"><Show when={isProjectContainedEntity(props.entity) && props.entity}>{(entity) => (@@ -550,12 +602,16 @@ function WideLayout(props: LayoutProps) {{(entity) => <Entity.Properties entity={entity()} />}</Show></Entity.Slot>-<Entity.Slotplacement="timestamp"class="text-xs font-mono text-right text-ink-extra-muted uppercase font-light">- <Show when={!props.hasNotifications}>+ <Show+ when={+ !props.hasNotifications &&+ !(isChannelEntity(props.entity) && isSearchEntity(props.entity))+ }+ ><Entity.Timestamp entity={props.entity} /></Show></Entity.Slot>@@ -563,6 +619,175 @@ function WideLayout(props: LayoutProps) {);}+function MaybeEntityRow(props: {+ entityId: string;+ children: JSX.Element;+ config?: EntityRowConfig;+}) {+ const ctx = useContext(EntityRowContext);+ return (+ <Show when={isMobile() && ctx} fallback={props.children}>+ <EntityRow+ entityId={props.entityId}+ swipeLeftColor={props.config?.swipeLeftColor}+ swipeLeftRevealedComponent={props.config?.swipeLeftRevealedComponent}+ swipeRightColor={props.config?.swipeRightColor}+ swipeRightRevealedComponent={props.config?.swipeRightRevealedComponent}+ >+ {props.children}+ </EntityRow>+ </Show>+ );+}++function StackRowLayout(props: {+ stack: NotificationStack;+ entity: WithNotification<EntityData>;+ unread: boolean;+}) {+ const msgContent = () =>+ extractMessageContent(getMostRecentNotification(props.stack));++ return (+ <Entity.Layout+ class="w-full text-sm grid bg-edge/10 border-edge-muted"+ style={{+ 'grid-template-columns':+ 'var(--soup-stack-row-unread-column-width) 1fr 8ch',+ 'grid-template-rows': 'auto auto',+ 'grid-template-areas': '"unread title timestamp" "unread body body"',+ 'border-left-width': 'var(--soup-stack-row-border-l)',+ }}+ >+ <Entity.Slot placement="unread" class="flex items-center justify-center">+ <UnreadIndicator+ class="mx-(--soup-inbox-unread-indicator-padding-x) size-(--soup-inbox-unread-indicator-diameter)"+ active={props.unread}+ />+ </Entity.Slot>+ <Entity.Slot+ placement="title"+ class="flex items-center gap-2 truncate font-semibold pt-3"+ >+ <Entity.Notification.Icon stack={props.stack} class="size-3.5" />+ <Entity.Notification.Description stack={props.stack} />+ </Entity.Slot>+ <Entity.Slot+ placement="timestamp"+ class="text-xs text-right text-ink-extra-muted font-light pt-3 pr-4"+ >+ <Entity.Timestamp entity={props.entity} />+ </Entity.Slot>+ <Entity.Slot+ placement="body"+ class="text-ink-extra-muted truncate pb-2 min-h-[1lh] pr-4"+ >+ <Show when={msgContent()}>+ {(content) => (+ <StaticMarkdown+ theme={unifiedListMarkdownTheme}+ markdown={content()}+ singleLine+ />+ )}+ </Show>+ </Entity.Slot>+ </Entity.Layout>+ );+}++function StackRow(props: {+ stack: NotificationStack;+ entity: WithNotification<EntityData>;+ entityRowConfig?: EntityRowConfig;+}) {+ const ctx = useContext(EntityRowContext);+ const notificationSource = useGlobalNotificationSource();+ const stackEntityId = getMostRecentNotification(props.stack).id;+ const unread = () => isNotificationUnread(props.stack);++ const handleSwipeLeft = async () => {+ await ctx?.collapseEntity(stackEntityId);+ void notificationSource.bulkMarkAsDone(+ getAllNotificationsFromGroup(props.stack)+ );+ toast.success('Marked as done');+ };++ if (!ctx) {+ return (+ <StackRowLayout+ stack={props.stack}+ entity={props.entity}+ unread={unread()}+ />+ );+ }++ return (+ <EntityRow+ entityId={stackEntityId}+ onSwipeLeft={handleSwipeLeft}+ swipeLeftColor={props.entityRowConfig?.swipeLeftColor}+ swipeLeftRevealedComponent={+ props.entityRowConfig?.swipeLeftRevealedComponent+ }+ swipeRightColor={props.entityRowConfig?.swipeRightColor}+ swipeRightRevealedComponent={+ props.entityRowConfig?.swipeRightRevealedComponent+ }+ >+ <StackRowLayout+ stack={props.stack}+ entity={props.entity}+ unread={unread()}+ />+ </EntityRow>+ );+}++function MobileMultiStackLayout(props: {+ stacks: NotificationStack[];+ entity: WithNotification<EntityData>;+ entityRowConfig?: EntityRowConfig;+}) {+ const isDirectMessage = () =>+ isChannelEntity(props.entity) &&+ props.entity.channelType === 'direct_message';++ return (+ <div class="pl-(--soup-stack-row-padding-l) pb-3 relative">+ {/* Non-swipeable header */}+ <div class="grid grid-cols-[calc(var(--soup-inbox-left-of-content)-var(--soup-stack-row-padding-l))_auto] w-full text-sm items-center pr-4 py-3">+ <div class="ml-(--soup-stack-header-icon-padding-l) mr-(--soup-inbox-icon-padding-r) shrink-0 size-(--soup-stack-icon-diameter) bg-edge-muted rounded-full flex items-center justify-center">+ <Entity.Icon+ entity={props.entity}+ class={cn(+ !isDirectMessage() &&+ 'size-[calc(var(--soup-stack-icon-diameter)*var(--soup-inbox-icon-factor))]'+ )}+ />+ </div>+ <span class="flex-1 truncate font-semibold text-sm">+ <Entity.Title entity={props.entity} />+ </span>+ </div>+ {/* Stack rows */}+ <div class="flex flex-col gap-3">+ <For each={props.stacks}>+ {(stack) => (+ <StackRow+ stack={stack}+ entity={props.entity}+ entityRowConfig={props.entityRowConfig}+ />+ )}+ </For>+ </div>+ </div>+ );+}+export function ListEntity(props: ListEntityProps) {const unread = () => unreadFilterFn(props.entity);const isShared = useIsShared(props.entity);@@ -602,6 +827,27 @@ export function ListEntity(props: ListEntityProps) {const isWide = useListLayout()?.isWide ?? (() => true);+ const mobileStacks = createMemo(() => {+ if (!isMobile()) return [];+ if (!props.showUnrollNotifications) return [];+ const notifs = props.entity.notifications?.();+ if (!notifs?.length) return [];+ const validNotifs = filterNotDoneNotifications(+ filterValidNotifications(notifs)+ );+ if (!validNotifs.length) return [];+ return stackNotifications(validNotifs);+ });++ // Latch to true once multi-stack is ever seen (including async arrivals).+ // Prevents a jarring layout switch when swiping down to 1 stack.+ const [hasBeenMultiStack, setHasBeenMultiStack] = createSignal(+ mobileStacks().length > 1+ );+ createEffect(() => {+ if (mobileStacks().length > 1) setHasBeenMultiStack(true);+ });+return (<Entity.Rootentity={props.entity}@@ -613,35 +859,73 @@ export function ListEntity(props: ListEntityProps) {props.onClick?.(e);}}ref={mergeRefs(props.ref, draggable)}- class={cn('@container/entity w-full min-h-10 relative group/narrow', {- 'bg-accent/5': props.checked,- 'hover:bg-hover/30':- !props.checked && !props.highlighted && !props.hovered,- 'bg-hover/20': props.hovered && !props.highlighted && !props.checked,- 'bg-accent/5 outline-1 outline-accent/20 outline-offset-[-1px]':- props.highlighted,- })}+ class={cn(+ 'soup-list-entity @container/entity w-full relative group/narrow flex flex-col',+ {+ 'min-h-10': !isMobile(),+ 'bg-accent/5': props.checked,+ 'hover:bg-hover/30':+ !props.checked && !props.highlighted && !props.hovered,+ 'bg-hover/20': props.hovered && !props.highlighted && !props.checked,+ 'bg-accent/5 outline-1 outline-accent/20 outline-offset-[-1px]':+ props.highlighted && !isMobile(),+ }+ )}onMouseMove={props.onMouseMove}><divclass={cn('absolute h-full w-[3px] left-0 top-0 bg-accent opacity-0', {- 'opacity-100': props.highlighted,+ 'opacity-100': props.highlighted && !isMobile(),})}/><Switch><Match when={isWide()}>- <WideLayout {...layoutProps()} />+ <MaybeEntityRow+ entityId={props.entity.id}+ config={props.entityRowConfig}+ >+ <WideLayout {...layoutProps()} />+ </MaybeEntityRow>+ </Match>+ <Match+ when={+ isMobile() && (hasBeenMultiStack() || mobileStacks().length > 1)+ }+ >+ <MobileMultiStackLayout+ stacks={mobileStacks()}+ entity={props.entity}+ entityRowConfig={props.entityRowConfig}+ />+ <InboxDivider /></Match>- <Match when={isChannelEntity(props.entity) && !hasNotifications()}>- <NarrowMessageLayout {...layoutProps()} />+ <Match+ when={+ isMobile() &&+ (isChannelEntity(props.entity) ||+ isEmailEntity(props.entity) ||+ props.showUnrollNotifications)+ }+ >+ <MaybeEntityRow+ entityId={props.entity.id}+ config={props.entityRowConfig}+ >+ <NarrowInboxLayout {...layoutProps()} />+ </MaybeEntityRow></Match><Match when={true}>- <NarrowLayout {...layoutProps()} />+ <MaybeEntityRow+ entityId={props.entity.id}+ config={props.entityRowConfig}+ >+ <NarrowLayout {...layoutProps()} />+ </MaybeEntityRow></Match></Switch>- <Show when={hasNotifications()}>+ <Show when={hasNotifications() && !isMobile()}><div class="flex gap-2 w-full h-full items-center text-sm px-2 pb-1 -mt-2 min-w-0 overflow-hidden"><div class={cn('min-w-0 flex-1 truncate ml-2 @lg/entity:ml-6')}><Show when={isWithNotification(props.entity) && !showContentHits()}>diff --git a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsxindex ff22fcdfbf..0c0d90fc4d 100644--- a/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx+++ b/js/app/packages/entity/src/extractors-property/entity-key-properties.tsx@@ -96,12 +96,7 @@ export function EntityKeyProperties(props: EntityKeyPropertiesProps) {onPropertyDeleted={() => {}}saveHandler={saveHandler}>- <div- class="grid items-center gap-1 justify-start overflow-hidden w-24"- style={{- 'grid-template-columns': 'min-content min-content 1fr',- }}- >+ <div class="flex items-center gap-1 justify-start overflow-hidden"><For each={keyProperties()}>{(property) => (<div class="relative">