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

@ -74,12 +74,11 @@ const ConnectSlackCard = React.memo(() => {
{isConnected ? ( {isConnected ? (
needsReinstall ? ( needsReinstall ? (
<Button <Button
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'} ? `${numberOfSelectedChannels} ${pluralize('channel', numberOfSelectedChannels)} selected`
variant="default"> : 'Select a channel'
{numberOfSelectedChannels > 0 }
? `${numberOfSelectedChannels} ${pluralize('channel', numberOfSelectedChannels)} selected` />
: 'Select a channel'}
</Button>
</Dropdown> </Dropdown>
</> </>
) : ( ) : (
@ -232,22 +229,24 @@ const SlackSharingPermissions = React.memo(() => {
secondaryLabel: 'All workspace members will have access to any chat created from any channel.' secondaryLabel: 'All workspace members will have access to any chat created from any channel.'
}, },
// { // {
// label: 'Channel', // label: 'Channel',
// value: 'shareWithChannel', // value: 'shareWithChannel',
// secondaryLabel: 'All channel members will have access to any chat created from that channel.' // secondaryLabel: 'All channel members will have access to any chat created from that channel.'
// }, // },
{ {
label: 'None', label: 'None',
value: 'noSharing', value: 'noSharing',
secondaryLabel: 'Only the user who sent the request will have access to their chat.' secondaryLabel: 'Only the user who sent the request will have access to their chat.'
} }
]; ];
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({
default_sharing_permissions: value as SlackSharingPermission default_sharing_permissions: value as SlackSharingPermission
}); });
}); });
@ -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>
);
};