From b84162246ae637af7ea313a00a5b89a7511aad0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Wed, 22 Apr 2026 20:39:08 -0400 Subject: [PATCH] Keep companywide channel view visible --- .../communication/ChannelSidebar.tsx | 37 ++------ .../communication/CommunicationHub.tsx | 35 +++---- .../components/communication/MessageList.tsx | 6 +- .../communication/message-filters.ts | 36 +++++++ tests/unit/message-filters.test.ts | 93 +++++++++++++++++++ 5 files changed, 155 insertions(+), 52 deletions(-) create mode 100644 src/renderer/components/communication/message-filters.ts create mode 100644 tests/unit/message-filters.test.ts diff --git a/src/renderer/components/communication/ChannelSidebar.tsx b/src/renderer/components/communication/ChannelSidebar.tsx index 14033e18..99161043 100644 --- a/src/renderer/components/communication/ChannelSidebar.tsx +++ b/src/renderer/components/communication/ChannelSidebar.tsx @@ -4,6 +4,8 @@ import { EnvelopeSimple, Hash, Buildings, Megaphone, Fire, MagnifyingGlass, Funn import type { AgentRecord, MessageChannel } from "@shared/types" import { AgentAvatar } from "./MessageItem" import type { ChannelDescriptor, TaskDiscussionDescriptor } from "./ChannelHeader" +import type { MessageFilters } from "./message-filters" +import { DEFAULT_MESSAGE_FILTERS, hasActiveMessageFilters } from "./message-filters" import { useT } from "../../i18n" import { Eyebrow, Select } from "../ui" @@ -169,12 +171,7 @@ export function ChannelSidebar({ ) } -export interface FilterState { - search: string - channelType: MessageChannel | "all" - priority: string - unreadOnly: boolean -} +export type FilterState = MessageFilters export function FilterBar({ filters, @@ -209,7 +206,7 @@ export function FilterBar({ type="button" onClick={() => setExpanded(!expanded)} className={`flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-[11px] font-medium transition ${ - expanded || filters.channelType !== "all" || filters.priority !== "all" || filters.unreadOnly + expanded || hasActiveMessageFilters(filters) ? "border-transparent bg-primary text-primary-foreground" : "border-border text-muted-foreground hover:border-border" }`} @@ -227,19 +224,6 @@ export function FilterBar({ exit={{ opacity: 0, height: 0 }} className="flex flex-wrap items-center gap-2 overflow-hidden" > - - - {(filters.channelType !== "all" || filters.priority !== "all" || filters.unreadOnly) ? ( + {filters.priority !== "all" ? (