From 5ed3651348c1b329e6e617bcec951ed9701a76a6 Mon Sep 17 00:00:00 2001 From: Danny Simms <103758200+GreyNewfie@users.noreply.github.com> Date: Wed, 4 Feb 2026 21:26:00 -0330 Subject: [PATCH 1/2] Replace Select with Autocomplete for Slack channel selection - Replaced Material-UI Select component with Autocomplete for better UX - Added grouping by channel type (Channels vs Users) - Maintained existing sorting logic (channels first, then alphabetically) - Updated styling to allow component to grow while maintaining minimum width - Simplified value handling with direct object comparison --- lib/components/Slack/SlackConnect.tsx | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/components/Slack/SlackConnect.tsx b/lib/components/Slack/SlackConnect.tsx index 5a5126a..e969ff7 100644 --- a/lib/components/Slack/SlackConnect.tsx +++ b/lib/components/Slack/SlackConnect.tsx @@ -2,14 +2,12 @@ import { useContext, useEffect, useState, useCallback } from 'react'; import { Box, Button, - FormControl, - InputLabel, - MenuItem, - Select, Typography, CircularProgress, Alert, - Stack + Stack, + Autocomplete, + TextField } from '@mui/material'; import { NotificationAPIContext } from '../Provider/context'; import { User } from '@notificationapi/core/dist/interfaces'; @@ -361,30 +359,32 @@ export function SlackConnect({ {selectChannelText} - - Channel or User - - + { + if (a.type === b.type) { + return a.name.localeCompare(b.name); + } + return a.type === 'channel' ? -1 : 1; + })} + groupBy={(option) => + option.type === 'channel' ? 'Channels' : 'Users' + } + getOptionLabel={(option) => + `${option.type === 'channel' ? '#' : '@'}${option.name}` + } + sx={{ minWidth: 200, flexGrow: 1 }} // Allow it to grow but keep min width + size="small" + value={channels.find((c) => c.id === selectedChannel) || null} + onChange={(_, newValue) => { + setSelectedChannel(newValue ? newValue.id : ''); + }} + isOptionEqualToValue={(option, value) => option.id === value.id} + renderInput={(params) => ( + + )} + />