mirror of https://github.com/buster-so/buster.git
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:
commit
a0bd890ca2
|
@ -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>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue