Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Open the connect dialog on Slack from the buddy card

raullopez-sandboxb37eae009bbe
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/buddy-setup-cards.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/buddy-setup-cards.tsx
index b5de9f6c0..4ff19c2b4 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/buddy-setup-cards.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/buddy-setup-cards.tsx
@@ -177,7 +177,7 @@ const Cards = observer(function Cards({
title="Connect Slack"
description="Add Slack to your Switch workspace."
footer={
- <Button onClick={() => showConnect({ serverId, onClosed: retry })}>
+ <Button onClick={() => showConnect({ serverId, platform: 'slack', onClosed: retry })}>
Connect Slack
</Button>
}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/ConnectMessagingAppModal.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/ConnectMessagingAppModal.tsx
index 2f3b1dfe9..82977887a 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/ConnectMessagingAppModal.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/ConnectMessagingAppModal.tsx
@@ -1,7 +1,7 @@
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { ExternalLink } from 'lucide-react';
import { observer } from 'mobx-react-lite';
-import { useCallback, useMemo, useState } from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import { workspacesStore } from '@renderer/features/workspaces/workspaces-store';
import { BridgeIcon, hasBridgeIcon } from '@renderer/lib/components/bridge-icon';
import { bridgePlatformLabel, bridgeSetupDocsUrl } from '@renderer/lib/components/bridge-platform';
@@ -50,6 +50,8 @@ import { administersWorkspaceInScope } from './workspace-admin';
type ConnectMessagingAppModalArgs = {
/** Attach to this server instead of the active one. */
serverId?: string;
+ /** Only this platform (`slack`), chosen already: the person picked it before opening the dialog. */
+ platform?: string;
/** Run however the dialog goes away. A chat connected from it after the
* first lands on no signal Switch Console receives, so this is when to
* look for it. */
@@ -70,6 +72,7 @@ type Props = BaseModalProps<ConnectedApp> & ConnectMessagingAppModalArgs;
export const ConnectMessagingAppModal = observer(function ConnectMessagingAppModal({
serverId: overrideServerId,
+ platform,
onClosed,
onSuccess,
onClose,
@@ -133,8 +136,12 @@ export const ConnectMessagingAppModal = observer(function ConnectMessagingAppMod
queryFn: () => rpc.workspaces.listMessagingApps(workspaceId as string),
enabled: workspaceId !== null && isAdmin,
});
- const installable = installableQuery.data?.installable ?? [];
- const claimable = (installableQuery.data?.claimable ?? []).filter((c) => c.canAddChat);
+ const installable = (installableQuery.data?.installable ?? []).filter(
+ (p) => platform === undefined || p === platform
+ );
+ const claimable = (installableQuery.data?.claimable ?? []).filter(
+ (c) => c.canAddChat && (platform === undefined || c.platform === platform)
+ );
const [useOwnApp, setUseOwnApp] = useState(false);
// The platform whose link and code are on screen. From then on the dialog is
// about that one chat: the other apps are a different errand, and for a
@@ -192,6 +199,11 @@ export const ConnectMessagingAppModal = observer(function ConnectMessagingAppMod
[types]
);
+ useEffect(() => {
+ if (platform !== undefined && typeKey === null && types.some((t) => t.key === platform))
+ handleTypeChange(platform);
+ }, [platform, typeKey, types, handleTypeChange]);
+
const trimmedName = displayName.trim();
const missingRequired = formFields.some((field) => isMissingRequired(field, config));
// Only what the person can type is named: a field the guide fills in itself