From 33e927417f25bbc9f68f3e24b6b8484ef2c13068 Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:08:16 +0000 Subject: [PATCH] feat(web): search channels in proactivity exceptions picker (#1377) Workspaces with hundreds of Slack channels made the plain select unusable, so the channel exception picker is now a Popover + Command combobox that filters as you type. The exceptions block is also reworked into one list card with an inline add row, matching the max-w-3xl measure used by the workspace prompt pane. Fixes ENG-1138 --- .../settings/company-brain-proactivity.tsx | 239 ++++++++++-------- 1 file changed, 134 insertions(+), 105 deletions(-) diff --git a/apps/web/components/settings/company-brain-proactivity.tsx b/apps/web/components/settings/company-brain-proactivity.tsx index 4e17eaf4..5b98c1ff 100644 --- a/apps/web/components/settings/company-brain-proactivity.tsx +++ b/apps/web/components/settings/company-brain-proactivity.tsx @@ -2,15 +2,18 @@ import { useQuery } from "@tanstack/react-query" import { cn } from "@lib/utils" -import { Check, Loader2, Lock, X } from "lucide-react" +import { Check, Loader2, Lock, Plus, X } from "lucide-react" +import { useState } from "react" import { useAuth } from "@lib/auth-context" import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@ui/components/select" + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@ui/components/command" +import { Popover, PopoverContent, PopoverTrigger } from "@ui/components/popover" import { type BrainChannelProactivity, type BrainProactivityDefault, @@ -27,7 +30,6 @@ const BACKEND = type Channel = { id: string; name: string; isPrivate: boolean } const HOME_CHANNEL_NAME = "company-brain" -const ADD_PLACEHOLDER = "__add__" const MODES: { id: BrainProactivityDefault @@ -50,16 +52,12 @@ const fieldLabel = cn( dmSans125ClassName(), "text-[11px] font-medium uppercase tracking-[0.06em] text-[#5B6675]", ) -const controlClass = cn( - dmSans125ClassName(), - "h-9 w-full rounded-full border border-[#1E293B] bg-[#0D121A] px-3.5 text-[13px] text-[#FAFAFA] outline-none disabled:opacity-50", -) const selectContentClass = cn( dmSans125ClassName(), "rounded-[10px] border-white/[0.08] bg-[#1B1F24] text-[#FAFAFA] shadow-[0px_8px_24px_rgba(0,0,0,0.5)]", ) -const selectItemClass = - "cursor-pointer rounded-[8px] text-[13px] text-[#FAFAFA] hover:bg-white/10 hover:text-white data-[highlighted]:bg-white/10 data-[highlighted]:text-white focus:bg-white/10 focus:text-white" +const commandItemClass = + "cursor-pointer rounded-[8px] text-[13px] text-[#FAFAFA] data-[selected=true]:bg-white/10 data-[selected=true]:text-white" export default function CompanyBrainProactivity() { const isCompanyBrain = useHasCompanyBrain() @@ -68,6 +66,7 @@ export default function CompanyBrainProactivity() { const settingsQuery = useBrainSettings(isCompanyBrain) const update = useUpdateBrainSettings() + const [pickerOpen, setPickerOpen] = useState(false) const slackStatusQuery = useQuery({ queryKey: ["brain", "slack-status", org?.id], @@ -129,7 +128,7 @@ export default function CompanyBrainProactivity() { } return ( -
+
{settingsQuery.isLoading ? (
@@ -183,100 +182,130 @@ export default function CompanyBrainProactivity() {
Channel exceptions - {Object.entries(overrides).map(([channelId, value]) => ( -
- +
+ {Object.entries(overrides).map(([channelId, value]) => ( +
+ + #{channelName(channelId)} + +
+
+ {(["proactive", "quiet"] as const).map((option) => ( + + ))} +
+ +
+
+ ))} +
+ {addable.length > 0 ? ( + + + + + + + + + + No channels found. + + + {addable.map((ch) => ( + { + setOverride( + ch.id, + activeMode === "all_channels" + ? "quiet" + : "proactive", + ) + setPickerOpen(false) + }} + > + {ch.isPrivate ? "đź”’ " : "# "} + {ch.name} + + ))} + + + + + + ) : channelsQuery.isLoading || + slackStatusQuery.isLoading ? null : ( +

- #{channelName(channelId)} - -

-
- {(["proactive", "quiet"] as const).map((option) => ( - - ))} -
- -
-
- ))} - {addable.length > 0 ? ( - - ) : channelsQuery.isLoading || slackStatusQuery.isLoading ? null : ( -

- {slackStatusQuery.data?.connected === false - ? "Connect Slack to set per-channel exceptions." - : "Invite Company Brain to a Slack channel to list it here."} -

- )} + {slackStatusQuery.data?.connected === false + ? "Connect Slack to set per-channel exceptions." + : "Invite Company Brain to a Slack channel to list it here."} +

+ )} +
{!isAdmin ? (