Merge pull request #601 from buster-so/big-nate/bus-1489-alerts-channel-dropdown-shouldnt-be-a-button

Update slack integration to use new fake button
This commit is contained in:
Nate Kelley 2025-07-22 22:10:24 -06:00 committed by GitHub
commit a0bd890ca2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 32 additions and 25 deletions

View File

@ -78,8 +78,7 @@ const ConnectSlackCard = React.memo(() => {
prefix={<SlackIcon size={16} />} prefix={<SlackIcon size={16} />}
onClick={() => initiateSlackOAuth()} onClick={() => initiateSlackOAuth()}
size={'tall'} size={'tall'}
className="border-yellow-500 bg-yellow-50 text-yellow-700 hover:bg-yellow-100" className="border-yellow-500 bg-yellow-50 text-yellow-700 hover:bg-yellow-100">
>
Re-install Required Re-install Required
</Button> </Button>
) : ( ) : (
@ -196,15 +195,13 @@ const ConnectedSlackChannels = React.memo(() => {
onSelect={onSelect} onSelect={onSelect}
menuHeader="Search channels" menuHeader="Search channels"
className="w-fit min-w-40"> className="w-fit min-w-40">
<Button <WeirdFakeSelectButtonForBlake
disabled={!isFetchedSlackChannels} label={
loading={showLoadingButton} numberOfSelectedChannels > 0
size={'tall'}
variant="default">
{numberOfSelectedChannels > 0
? `${numberOfSelectedChannels} ${pluralize('channel', numberOfSelectedChannels)} selected` ? `${numberOfSelectedChannels} ${pluralize('channel', numberOfSelectedChannels)} selected`
: 'Select a channel'} : 'Select a channel'
</Button> }
/>
</Dropdown> </Dropdown>
</> </>
) : ( ) : (
@ -243,8 +240,10 @@ const SlackSharingPermissions = React.memo(() => {
} }
]; ];
const selectedOption: SlackSharingPermission = slackIntegration?.integration?.default_sharing_permissions || 'noSharing'; const selectedOption: SlackSharingPermission =
const selectedLabel = sharingOptions.find(option => option.value === selectedOption)?.label || 'Select option'; slackIntegration?.integration?.default_sharing_permissions || 'noSharing';
const selectedLabel =
sharingOptions.find((option) => option.value === selectedOption)?.label || 'Select option';
const handleSelect = useMemoizedFn((value: string) => { const handleSelect = useMemoizedFn((value: string) => {
updateSlackIntegration({ updateSlackIntegration({
@ -266,15 +265,23 @@ const SlackSharingPermissions = React.memo(() => {
align="end" align="end"
side="bottom" side="bottom"
selectType="single"> selectType="single">
<div className="flex items-center justify-between space-x-2 cursor-pointer border rounded px-3 py-1.5 bg-background hover:bg-item-hover transition-colors min-w-32"> <WeirdFakeSelectButtonForBlake label={selectedLabel} />
<Text size="sm" className="truncate">{selectedLabel}</Text>
<span className="text-icon-color flex items-center">
<ChevronDown />
</span>
</div>
</Dropdown> </Dropdown>
</div> </div>
); );
}); });
SlackSharingPermissions.displayName = 'SlackSharingPermissions'; SlackSharingPermissions.displayName = 'SlackSharingPermissions';
const WeirdFakeSelectButtonForBlake = ({ label }: { label: string }) => {
return (
<div className="bg-background hover:bg-item-hover flex min-w-32 cursor-pointer items-center justify-between space-x-2 rounded border px-3 py-1.5 transition-colors">
<Text size="sm" className="truncate">
{label}
</Text>
<span className="text-icon-color flex items-center">
<ChevronDown />
</span>
</div>
);
};