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.

feat(soup): better notification styling (#3223)

teoe1e417d82926
diff --git a/js/app/packages/entity/src/components/CollapsibleList.tsx b/js/app/packages/entity/src/components/CollapsibleList.tsx
index 1fba2bec95..eaa8fd7357 100644
--- a/js/app/packages/entity/src/components/CollapsibleList.tsx
+++ b/js/app/packages/entity/src/components/CollapsibleList.tsx
@@ -14,24 +14,23 @@ interface ToggleButtonProps {
function ToggleButton(props: ToggleButtonProps) {
return (
<Show when={props.hasMore}>
- <div class="w-full flex items-center gap-2 my-2">
+ <div class="px-3 py-1.5">
<button
type="button"
- class="flex items-center gap-1 text-xs hover:text-accent"
+ class="flex items-center gap-1 text-[0.6875rem] text-ink-muted/70 hover:text-ink-muted"
data-collapsible-toggle
data-collapsible-state={props.showAll ? 'expanded' : 'collapsed'}
onClick={props.toggle}
>
<ChevronDownIcon
- class={cn('size-3 transition-transform duration-100', {
+ class={cn('size-2.5', {
'rotate-180': props.showAll,
})}
/>
- <Show when={!props.showAll} fallback="Collapse">
+ <Show when={!props.showAll} fallback="Show less">
{props.getExpandTextFn(props.itemsLength - props.visibleCount)}
</Show>
</button>
- <div class="border-t border-edge-muted grow" />
</div>
</Show>
);
diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsx
index ee62f64556..8ce1c4f974 100644
--- a/js/app/packages/entity/src/composed/ListEntity.tsx
+++ b/js/app/packages/entity/src/composed/ListEntity.tsx
@@ -250,8 +250,8 @@ export function ListEntity(props: ListEntityProps) {
</Switch>
<Show when={hasNotifications() && !isMobile()}>
- <div class="flex gap-2 size-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')}>
+ <div class="px-2 pb-1.5 -mt-1 min-w-0 overflow-hidden">
+ <div class={cn('min-w-0 flex-1 ml-2 @lg/entity:ml-6')}>
<Show when={isWithNotification(props.entity) && !showContentHits()}>
<Entity.Notification.Stacks
entity={props.entity}
diff --git a/js/app/packages/entity/src/extractors-notification/mobile-notification-stacks.tsx b/js/app/packages/entity/src/extractors-notification/mobile-notification-stacks.tsx
index d7313a8c8b..63cd619345 100644
--- a/js/app/packages/entity/src/extractors-notification/mobile-notification-stacks.tsx
+++ b/js/app/packages/entity/src/extractors-notification/mobile-notification-stacks.tsx
@@ -10,13 +10,13 @@ import { cn } from '@ui';
import { createEffect, type JSX, useContext } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
import { CollapsibleList } from '../components/CollapsibleList';
-import { UnreadIndicator } from '../components/UnreadIndicator';
import { Entity } from '../entity';
import { type EntityData, isChannelEntity } from '../types/entity';
import type { WithNotification } from '../types/notification';
import { isNotificationUnread } from '../utils/notification';
import { useNotificationStackActions } from './notification-actions';
import { NotificationContent } from './notification-content';
+import { NotificationSenderIcon } from './notification-sender-icon';
import { NotificationTimestamp } from './notification-timestamp';
export type EntityRowConfig = {
@@ -34,43 +34,49 @@ function MobileStackRowLayout(props: {
}) {
return (
<Entity.Layout
- class="w-full text-sm grid bg-message border-edge"
+ class="w-full text-sm grid"
onClick={props.onClick}
style={{
- 'grid-template-columns':
- 'var(--soup-stack-row-unread-column-width) 1fr auto',
+ 'grid-template-columns': 'auto 1fr auto',
'grid-template-rows': 'auto auto',
- 'grid-template-areas': '"unread title timestamp" "unread body body"',
- 'border-left-width': 'var(--soup-stack-row-border-l)',
+ 'grid-template-areas': '"icon title timestamp" "icon body body"',
}}
>
- <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 overflow-hidden min-w-0 font-semibold pt-3"
+ placement="icon"
+ class="flex flex-col items-center gap-1 pt-3.5 pl-3 pr-2"
>
<Entity.Notification.Icon
stack={props.stack}
- class="size-3.5 shrink-0"
+ class={cn('size-3.5 shrink-0', {
+ 'text-accent': props.unread,
+ 'text-ink-muted': !props.unread,
+ })}
+ />
+ <span
+ class={cn('size-1.5 rounded-full bg-accent shrink-0 opacity-0', {
+ 'opacity-100': props.unread,
+ })}
/>
- <span class="truncate min-w-0">
+ </Entity.Slot>
+ <Entity.Slot
+ placement="title"
+ class="flex items-center gap-2 overflow-hidden min-w-0 pt-3"
+ >
+ <NotificationSenderIcon stack={props.stack} size="sm" />
+ <span class="truncate min-w-0 font-medium text-ink">
<Entity.Notification.Description stack={props.stack} />
</span>
</Entity.Slot>
<Entity.Slot
placement="timestamp"
- class="text-xs text-right text-ink-extra-muted font-light pt-3 pr-4 pl-2"
+ class="text-xs text-right text-ink-extra-muted pt-3 pr-4 pl-2 tabular-nums"
>
<NotificationTimestamp stack={props.stack} />
</Entity.Slot>
<Entity.Slot
placement="body"
- class={cn('text-ink-extra-muted pb-2 min-h-lh pr-4', {
+ class={cn('text-ink-muted/80 pb-2.5 min-h-lh pr-4 text-xs', {
truncate: props.stack.type !== 'document_mention',
})}
>
@@ -198,7 +204,7 @@ export function MobileNotificationStacks(props: MobileNotificationStacksProps) {
</span>
</div>
{/* Stack rows */}
- <div class="flex flex-col gap-3">
+ <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/[0.025] overflow-hidden divide-y divide-ink-muted/8">
<CollapsibleList
items={stacks}
visibleCount={props.visibleCount ?? 3}
diff --git a/js/app/packages/entity/src/extractors-notification/notification-content.tsx b/js/app/packages/entity/src/extractors-notification/notification-content.tsx
index d1899aec88..e96249cd7c 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-content.tsx
+++ b/js/app/packages/entity/src/extractors-notification/notification-content.tsx
@@ -50,7 +50,7 @@ function DocumentMentionPill(props: { notification: UnifiedNotification }) {
return (
<div
- class="group relative flex items-center gap-1.5 px-2 py-1 rounded border border-edge-muted bg-surface hover:bg-hover text-xs min-w-0 max-w-48 shrink-0"
+ class="group relative flex items-center gap-1.5 px-2 py-1 rounded-md bg-ink-muted/[0.06] hover:bg-ink-muted/10 text-xs text-ink-muted min-w-0 max-w-48 shrink-0"
onClick={handleClick}
role="button"
tabIndex={0}
@@ -58,7 +58,7 @@ function DocumentMentionPill(props: { notification: UnifiedNotification }) {
<EntityIcon targetType={targetType()} size="xs" />
<span class="truncate min-w-0">{documentName()}</span>
<Button
- class="absolute -top-2 -right-2 size-6 rounded-full bg-surface border border-edge-muted p-0 place-items-center hidden group-hover:grid hover:bg-accent! hover:text-surface!"
+ class="absolute -top-1.5 -right-1.5 size-5 rounded-full bg-surface border border-edge-muted/50 p-0 place-items-center hidden group-hover:grid hover:bg-accent! hover:text-surface!"
tooltip="Mark as done"
onClick={(e) => {
e.stopPropagation();
@@ -162,7 +162,7 @@ function DocumentMentionPills(props: { stack: NotificationStack }) {
<button
ref={badgeRef}
data-badge
- class="text-xs text-ink-muted border border-edge-muted rounded px-2 py-1 shrink-0"
+ class="text-xs text-ink-muted border border-edge-muted/50 rounded-md px-2 py-1 shrink-0"
tabIndex={-1}
>
+{notifications().length} more
@@ -181,7 +181,7 @@ function DocumentMentionPills(props: { stack: NotificationStack }) {
</For>
<Show when={overflow() > 0}>
<button
- class="text-xs text-ink-muted border border-edge-muted rounded px-2 py-1 bg-surface hover:bg-edge shrink-0"
+ class="text-xs text-ink-muted border border-edge-muted/50 rounded-md px-2 py-1 bg-surface hover:bg-hover shrink-0"
onClick={(e) => {
e.stopPropagation();
setExpanded(true);
diff --git a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
index 902f4b646d..8dc7bc507c 100644
--- a/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
+++ b/js/app/packages/entity/src/extractors-notification/notification-stacks.tsx
@@ -17,7 +17,6 @@ import { Button, cn } from '@ui';
import { createEffect, type JSX, Show } from 'solid-js';
import { createStore, reconcile } from 'solid-js/store';
import { CollapsibleList } from '../components/CollapsibleList';
-import { UnreadIndicator } from '../components/UnreadIndicator';
import type { EntityData } from '../types/entity';
import type { WithNotification } from '../types/notification';
import {
@@ -106,9 +105,7 @@ export function NotificationStackRow(props: {
<ContextMenu>
<ContextMenu.Trigger class="size-full">
<div
- class={cn(
- 'flex p-2 pr-0 my-1 border-l-2 border-edge bg-message gap-4 hover:bg-hover min-w-0 overflow-hidden'
- )}
+ class="group/notif flex items-center gap-2.5 px-3 py-2 hover:bg-ink-muted/[0.06] min-w-0 overflow-hidden cursor-pointer"
onClick={handleClick}
role="button"
tabIndex={0}
@@ -124,51 +121,48 @@ export function NotificationStackRow(props: {
}
}}
>
- <div class="pt-1 shrink-0">
- <NotificationIcon stack={props.stack} class="size-4" />
+ <span
+ class={cn('size-1.5 rounded-full shrink-0', {
+ 'bg-accent': unread(),
+ 'bg-transparent': !unread(),
+ })}
+ />
+ <NotificationIcon
+ stack={props.stack}
+ class="size-3.5 shrink-0 text-ink-muted/60"
+ />
+ <div class="shrink-0">
+ <NotificationSenderIcon stack={props.stack} size="sm" />
</div>
- <div class="min-w-0 flex-1">
- <div class="flex items-center gap-1 text-xs min-w-0 overflow-hidden">
- <span
- class={cn(
- 'w-0 transition-[width] overflow-hidden duration-500 ease shrink-0',
- {
- 'w-4': unread(),
- }
- )}
- >
- <UnreadIndicator active />
- </span>
- <div class="shrink-0">
- <NotificationSenderIcon stack={props.stack} size="sm" />
- </div>
- <span class="ph-no-capture truncate min-w-0">
- <NotificationDescription stack={props.stack} />
- </span>
- <span class="text-ink-extra-muted/50 shrink-0">
- {' - '}
- <NotificationTimestamp stack={props.stack} />
- </span>
- <Show when={canMarkDone()}>
- <div class="ml-auto flex items-center gap-1 pr-2 shrink-0">
- <Button
- onClick={handleMarkAsDone}
- tooltip={'Mark notification done'}
- class="border border-edge-muted text-xs text-ink-muted grid p-0 place-items-center size-6"
- >
- <CheckIcon class="size-3" />
- </Button>
- </div>
- </Show>
- </div>
- <div
- class={cn('ph-no-capture mt-1 min-w-0', {
- 'truncate overflow-hidden':
- props.stack.type !== 'document_mention' && !props.content,
+ <span
+ class={cn('ph-no-capture truncate min-w-0 text-xs text-ink', {
+ 'font-medium': unread(),
+ })}
+ >
+ <NotificationDescription stack={props.stack} />
+ </span>
+ <span class="ph-no-capture truncate min-w-0 text-xs text-ink-muted/60 flex-1">
+ {props.content ?? (
+ <NotificationContent stack={props.stack} singleLine />
+ )}
+ </span>
+ <div class="shrink-0 ml-auto">
+ <span
+ class={cn('text-ink-extra-muted text-xs tabular-nums', {
+ 'group-hover/notif:hidden': canMarkDone(),
})}
>
- {props.content ?? <NotificationContent stack={props.stack} />}
- </div>
+ <NotificationTimestamp stack={props.stack} />
+ </span>
+ <Show when={canMarkDone()}>
+ <Button
+ onClick={handleMarkAsDone}
+ tooltip={'Mark done'}
+ class="rounded text-ink-muted hover:text-accent hover:bg-accent/10 hidden group-hover/notif:grid p-0 place-items-center size-5"
+ >
+ <CheckIcon class="size-3" />
+ </Button>
+ </Show>
</div>
</div>
</ContextMenu.Trigger>
@@ -200,19 +194,23 @@ export function NotificationStacks(props: NotificationStacksProps) {
return (
<Show when={stacks.length > 0}>
- <CollapsibleList
- items={stacks}
- visibleCount={props.visibleCount ?? DEFAULT_VISIBLE_COUNT}
- togglePosition="bottom"
- >
- {(stack) => (
- <NotificationStackRow
- stack={stack}
- entity={props.entity}
- onClick={props.onClick}
- />
- )}
- </CollapsibleList>
+ <div class="rounded-lg border border-ink-muted/8 bg-ink-muted/[0.025] overflow-hidden">
+ <div class="divide-y divide-ink-muted/8">
+ <CollapsibleList
+ items={stacks}
+ visibleCount={props.visibleCount ?? DEFAULT_VISIBLE_COUNT}
+ togglePosition="bottom"
+ >
+ {(stack) => (
+ <NotificationStackRow
+ stack={stack}
+ entity={props.entity}
+ onClick={props.onClick}
+ />
+ )}
+ </CollapsibleList>
+ </div>
+ </div>
</Show>
);
}