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} />}
onClick={() => initiateSlackOAuth()}
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
</Button>
) : (
@ -196,15 +195,13 @@ const ConnectedSlackChannels = React.memo(() => {
onSelect={onSelect}
menuHeader="Search channels"
className="w-fit min-w-40">
<Button
disabled={!isFetchedSlackChannels}
loading={showLoadingButton}
size={'tall'}
variant="default">
{numberOfSelectedChannels > 0
<WeirdFakeSelectButtonForBlake
label={
numberOfSelectedChannels > 0
? `${numberOfSelectedChannels} ${pluralize('channel', numberOfSelectedChannels)} selected`
: 'Select a channel'}
</Button>
: 'Select a channel'
}
/>
</Dropdown>
</>
) : (
@ -243,8 +240,10 @@ const SlackSharingPermissions = React.memo(() => {
}
];
const selectedOption: SlackSharingPermission = slackIntegration?.integration?.default_sharing_permissions || 'noSharing';
const selectedLabel = sharingOptions.find(option => option.value === selectedOption)?.label || 'Select option';
const selectedOption: SlackSharingPermission =
slackIntegration?.integration?.default_sharing_permissions || 'noSharing';
const selectedLabel =
sharingOptions.find((option) => option.value === selectedOption)?.label || 'Select option';
const handleSelect = useMemoizedFn((value: string) => {
updateSlackIntegration({
@ -266,15 +265,23 @@ const SlackSharingPermissions = React.memo(() => {
align="end"
side="bottom"
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">
<Text size="sm" className="truncate">{selectedLabel}</Text>
<span className="text-icon-color flex items-center">
<ChevronDown />
</span>
</div>
<WeirdFakeSelectButtonForBlake label={selectedLabel} />
</Dropdown>
</div>
);
});
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>
);
};