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.

chore(chat): show muted-bell indicator in the app sidebar channel list (#7060)

Wolf Mermelstein1c192cf0ad99
diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
index e7922bebb3..aee7b24f3a 100644
--- a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx
@@ -32,6 +32,9 @@ vi.mock('@entity', () => ({
MaybeEntityRow: (props: { children: JSX.Element }) => props.children,
}));
vi.mock('@entity/utils/filter', () => ({ unreadFilterFn: unreadFilter }));
+vi.mock('@components/app/GlobalAppState', () => ({
+ useGlobalNotificationSource: () => ({ mutedEntities: () => [] }),
+}));
vi.mock('@app/features/home/components/HomeEntityIcon', () => ({
HomeEntityIcon: () => null,
}));
diff --git a/apps/web/src/features/channel/components/ChannelMutedIndicator.tsx b/apps/web/src/features/channel/components/ChannelMutedIndicator.tsx
new file mode 100644
index 0000000000..9aae69830a
--- /dev/null
+++ b/apps/web/src/features/channel/components/ChannelMutedIndicator.tsx
@@ -0,0 +1,29 @@
+import BellSlashIcon from '@phosphor/bell-slash.svg';
+import { cn, Tooltip } from '@ui';
+import { Show } from 'solid-js';
+
+export function ChannelMutedIndicator(props: {
+ muted: boolean;
+ class?: string;
+}) {
+ return (
+ <Show when={props.muted}>
+ <Tooltip
+ as="span"
+ label="Notifications are muted"
+ placement="top"
+ class={cn(
+ 'size-4 shrink-0 justify-center text-ink-extra-muted',
+ props.class
+ )}
+ >
+ <span
+ aria-label="Notifications muted"
+ class="flex size-full items-center justify-center"
+ >
+ <BellSlashIcon class="size-full" />
+ </span>
+ </Tooltip>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx b/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx
index ae8948be56..f10eb76452 100644
--- a/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx
+++ b/apps/web/src/features/channel/sidebar/channels-recent-widget.tsx
@@ -6,6 +6,7 @@ import {
} from '@app/features/next-soup/filters/filter-store';
import { globalSplitManager } from '@app/signal/splitLayout';
import { navigateToChannelMessage } from '@block-channel/utils/link';
+import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
import { ReadonlyThread } from '@channel/StandaloneThread';
import {
CollapsibleSidebarSection,
@@ -207,6 +208,7 @@ function ChannelRow(props: {
const entity = () => props.channel.entity;
const isUnread = () => props.channel.unread.length > 0;
const unreadCount = () => props.channel.unread.length;
+ const isMuted = () => muteAction.isMuted(entity());
const isSlim = () => props.isSlim ?? false;
const canOpenInNewSplit = () =>
@@ -248,6 +250,7 @@ function ChannelRow(props: {
<span class="text-sm font-medium truncate flex-1 text-start">
{entity().name}
</span>
+ <ChannelMutedIndicator muted={isMuted()} class="size-3.5" />
</Show>
<Show when={!isSlim() && isUnread()}>
<span class="ml-auto shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-ink/6 text-ink-muted rounded-md">
@@ -310,11 +313,7 @@ function ChannelRow(props: {
<MenuSeparator />
<MenuGroup>
<MenuItem
- text={
- muteAction.isMuted(entity())
- ? 'Unmute notifications'
- : 'Mute notifications'
- }
+ text={isMuted() ? 'Unmute notifications' : 'Mute notifications'}
onClick={() => void muteAction.execute([entity()])}
/>
</MenuGroup>
diff --git a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
index 3f2515ff3c..fadce5be6a 100644
--- a/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ChannelRailItems.tsx
@@ -5,6 +5,7 @@ import {
} from '@app/features/next-soup/actions';
import { SoupEntityContextMenu } from '@app/features/soup/SoupEntityContextMenu';
import { joinChannelCall } from '@channel/Call/join-channel-call';
+import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { inlineWrappingMarkdownTheme } from '@core/component/LexicalMarkdown/theme';
import { toast } from '@core/component/Toast/Toast';
@@ -15,7 +16,6 @@ import type { MacroId } from '@core/user/macroId';
import { type ChannelEntity, Entity } from '@entity';
import ReplyIcon from '@phosphor/arrow-bend-up-left.svg';
import AtIcon from '@phosphor/at.svg';
-import BellSlashIcon from '@phosphor/bell-slash.svg';
import XIcon from '@phosphor/x.svg';
import PhoneCallIcon from '@phosphor-fill/phone-call-fill.svg';
import PhoneIncomingIcon from '@phosphor-fill/phone-incoming-fill.svg';
@@ -119,32 +119,6 @@ export function ChannelCallIndicator(props: {
);
}
-export function ChannelMutedIndicator(props: {
- muted: boolean;
- class?: string;
-}) {
- return (
- <Show when={props.muted}>
- <Tooltip
- as="span"
- label="Notifications are muted"
- placement="top"
- class={cn(
- 'size-4 shrink-0 justify-center text-ink-extra-muted',
- props.class
- )}
- >
- <span
- aria-label="Notifications muted"
- class="flex size-full items-center justify-center"
- >
- <BellSlashIcon class="size-full" />
- </span>
- </Tooltip>
- </Show>
- );
-}
-
export function IncomingCallActions(props: {
callId: string | undefined;
channelId: string;
diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
index 5a910d77bc..e0f1678b89 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -4,6 +4,7 @@ import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
import { useFavoriteDisplayName } from '@app/util/favorites';
import { openNewChannelModal } from '@channel/CreateChannelModal';
+import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
import { useUserId } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
@@ -43,7 +44,6 @@ import {
import {
ChannelAvatar,
ChannelCallIndicator,
- ChannelMutedIndicator,
ChannelRailItemContextMenu,
CONVERSATION_CARD_HEIGHT,
ConversationCard,
@@ -196,6 +196,7 @@ function FavoriteOption(props: { favorite: Favorite }) {
<FavoriteIcon favorite={props.favorite} class="size-4" />
</ViewSidebar.Icon>
<span class="min-w-0 flex-1 truncate">{displayName()}</span>
+ <ChannelMutedIndicator muted={item().muted} />
</ViewSidebar.Item>
);
}
diff --git a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
index 60fe65c349..5423ad3761 100644
--- a/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
+++ b/apps/web/src/features/channels-view/components/rail/hooks/useChannelRailState.ts
@@ -1,5 +1,5 @@
import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import { isMutedItem } from '@entity/utils/notification';
+import { isMutedItem, muteItemForRef } from '@entity/utils/notification';
import type { ChannelLabel } from '@service-storage/generated/schemas/channelLabel';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
import { type Accessor, createMemo, createSignal, onCleanup } from 'solid-js';
@@ -47,10 +47,15 @@ export function useChannelRailItemState(
export function useChannelRailFavoriteItemState(favorite: Accessor<Favorite>) {
const rail = useChannelsRail();
+ const notificationSource = useGlobalNotificationSource();
return createMemo(() => {
const current = favorite();
const rowId = rowKeyForFavorite(current);
+ const muteItem = muteItemForRef({
+ id: current.entityId,
+ type: current.entityType,
+ });
return {
domId: domIdForRow(rail.railId, rowId),
@@ -58,6 +63,9 @@ export function useChannelRailFavoriteItemState(favorite: Accessor<Favorite>) {
current.entityType === 'channel' &&
rail.selectedChannel()?.id === current.entityId,
focused: rail.list.focus.key() === rowId,
+ muted:
+ muteItem !== undefined &&
+ isMutedItem(notificationSource.mutedEntities(), muteItem),
};
});
}
diff --git a/apps/web/src/features/favorites/sidebar/favorites-section.tsx b/apps/web/src/features/favorites/sidebar/favorites-section.tsx
index 05fd4d73ed..701852cdf3 100644
--- a/apps/web/src/features/favorites/sidebar/favorites-section.tsx
+++ b/apps/web/src/features/favorites/sidebar/favorites-section.tsx
@@ -8,6 +8,7 @@ import {
useFavoriteDmRecipientId,
} from '@app/util/favorites';
import { navigateToChannelMessage } from '@block-channel/utils/link';
+import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
import { ReadonlyThread } from '@channel/StandaloneThread';
import type { SidebarState } from '@components/app/app-sidebar/sidebar';
import {
@@ -446,6 +447,10 @@ const FavoriteRow = (props: {
/>
</div>
<span class="min-w-0 truncate">{displayName()}</span>
+ <ChannelMutedIndicator
+ muted={muteAction.isMuted(favoriteAsEntity())}
+ class="size-3.5"
+ />
<Show when={props.notifications().length > 0}>
<span class="ml-auto shrink-0 min-w-5 h-5 px-1.5 flex items-center justify-center text-xs font-medium bg-ink/6 text-ink-muted rounded-md">
{props.notifications().length}
diff --git a/apps/web/src/features/home/components/HomeListEntity.tsx b/apps/web/src/features/home/components/HomeListEntity.tsx
index e9c692892b..475a908ade 100644
--- a/apps/web/src/features/home/components/HomeListEntity.tsx
+++ b/apps/web/src/features/home/components/HomeListEntity.tsx
@@ -1,10 +1,13 @@
import { ViewSidebar } from '@app/components/view-shell';
import { AgentSessionListItem } from '@app/features/agents-view/views/AgentSessionListItem';
+import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
import { useUserId } from '@core/context/user';
import { getDisplayName, tryMacroId } from '@core/user';
import { Entity, MaybeEntityRow } from '@entity';
import type { BaseListEntityProps } from '@entity/composed/list-entity/shared';
import { unreadFilterFn } from '@entity/utils/filter';
+import { entityIsMuted } from '@entity/utils/notification';
import { getDocumentCommentNotification } from '@notifications/document-comment-notification';
import { getNotificationAgentSender } from '@notifications/notification-sender';
import type { UnifiedNotification } from '@notifications/types';
@@ -30,6 +33,9 @@ export function HomeListEntity(props: HomeListEntityProps) {
const commentNotification = () =>
getDocumentCommentNotification(props.entity);
const unread = () => unreadFilterFn(props.entity);
+ const notificationSource = useGlobalNotificationSource();
+ const muted = () =>
+ entityIsMuted(notificationSource.mutedEntities(), props.entity);
return (
<div class="soup-list-entity relative mx-(--sidebar-gutter) my-(--sidebar-row-gap)">
@@ -96,6 +102,7 @@ export function HomeListEntity(props: HomeListEntityProps) {
</Match>
</Switch>
</span>
+ <ChannelMutedIndicator muted={muted()} class="size-3.5" />
<span
data-home-timestamp
class="hidden shrink-0 text-xs font-normal text-ink-extra-muted group-hover/home-item:block"
diff --git a/apps/web/src/features/home/components/home-press.test.tsx b/apps/web/src/features/home/components/home-press.test.tsx
index cf553fe4b9..dda1a32921 100644
--- a/apps/web/src/features/home/components/home-press.test.tsx
+++ b/apps/web/src/features/home/components/home-press.test.tsx
@@ -20,6 +20,9 @@ vi.mock('@entity', () => ({
MaybeEntityRow: (props: { children: JSX.Element }) => props.children,
}));
vi.mock('@entity/utils/filter', () => ({ unreadFilterFn: () => false }));
+vi.mock('@components/app/GlobalAppState', () => ({
+ useGlobalNotificationSource: () => ({ mutedEntities: () => [] }),
+}));
vi.mock('./HomeEntityIcon', () => ({ HomeEntityIcon: () => null }));
vi.mock('@ui', async () => ({
...(await import('@app/components/ui/utils/press')),