Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix(switchdash): let the onboarding page drag the window (CHOO-1430) (#106)
Louis Amaudruz6aea5852aa5a
diff --git a/dash/apps/switchdash-desktop/src/renderer/app/home-view.tsx b/dash/apps/switchdash-desktop/src/renderer/app/home-view.tsxindex 181bc13d4..6f6fb6599 100644--- a/dash/apps/switchdash-desktop/src/renderer/app/home-view.tsx+++ b/dash/apps/switchdash-desktop/src/renderer/app/home-view.tsx@@ -25,8 +25,12 @@ export function HomeMainPanel() {const isDark = effectiveTheme === 'emdark';return (+ // Home registers no TitlebarSlot, so without a drag region here the whole+ // main pane is dead for moving the window and only the sidebar's+ // SidebarSpace strip drags it. The surface is empty, so it is all drag —+ // any interactive control added below must opt out with `no-drag`.<motion.div- className="flex h-full flex-col overflow-y-auto bg-background text-foreground"+ className="flex h-full flex-col overflow-y-auto bg-background text-foreground [-webkit-app-region:drag]"initial={{ opacity: 0 }}animate={{ opacity: 1 }}transition={{ duration: 0.5, ease: 'easeOut' }}@@ -41,7 +45,7 @@ export function HomeMainPanel() {/></div></div>- <div className="mx-auto mt-8 flex w-full max-w-md flex-col gap-1">+ <div className="mx-auto mt-8 flex w-full max-w-md flex-col gap-1 [-webkit-app-region:no-drag]">{LOCATION_ACTIONS.map((action, i) => (<HomeLocationActionkey={action.label}diff --git a/dash/apps/switchdash-desktop/src/renderer/tests/browser/home-drag-region.test.tsx b/dash/apps/switchdash-desktop/src/renderer/tests/browser/home-drag-region.test.tsxnew file mode 100644index 000000000..9e60a977a--- /dev/null+++ b/dash/apps/switchdash-desktop/src/renderer/tests/browser/home-drag-region.test.tsx@@ -0,0 +1,81 @@+import { act } from 'react';+import { createRoot } from 'react-dom/client';+import { afterEach, beforeAll, describe, expect, it } from 'vitest';+import type * as HomeView from '@renderer/app/home-view';+import type * as ThemeProvider from '@renderer/lib/providers/theme-provider';++/**+ * The home view is the one screen that registers no `TitlebarSlot`, so it has+ * no `Titlebar` supplying a `-webkit-app-region: drag` strip. Without a drag+ * region of its own the frameless window can only be moved by grabbing the+ * sidebar's top strip (CHOO-1430).+ *+ * Electron is the only place a drag region actually does anything, so these+ * assertions are on the markup rather than on behaviour: they exist to catch a+ * restyle or refactor silently dropping the utility classes again.+ */++let ThemeContext: typeof ThemeProvider.ThemeContext;+let HomeMainPanel: typeof HomeView.HomeMainPanel;+let container: HTMLDivElement | null = null;++beforeAll(async () => {+ // `lib/ipc` reads the preload bridge at module scope and the home view pulls+ // it in transitively, so the bridge has to exist before the import runs.+ Object.defineProperty(window, 'electronAPI', {+ configurable: true,+ value: {+ invoke: async () => undefined,+ eventSend: () => {},+ eventOn: () => () => {},+ },+ });+ ({ HomeMainPanel } = await import('@renderer/app/home-view'));+ // The real ThemeProvider resolves the theme over RPC; the panel only reads+ // `effectiveTheme` to pick logo colours, so feed the context directly.+ ({ ThemeContext } = await import('@renderer/lib/providers/theme-provider'));+});++async function renderHome(): Promise<HTMLDivElement> {+ container = document.createElement('div');+ document.body.appendChild(container);+ const root = createRoot(container);+ await act(async () =>+ root.render(+ <ThemeContext.Provider+ value={{+ theme: null,+ setTheme: () => {},+ toggleTheme: () => {},+ effectiveTheme: 'emlight',+ }}+ >+ <HomeMainPanel />+ </ThemeContext.Provider>+ )+ );+ return container;+}++afterEach(() => {+ container?.remove();+ container = null;+});++describe('home view drag region', () => {+ it('makes the whole onboarding surface draggable', async () => {+ const el = await renderHome();+ const surface = el.firstElementChild;++ expect(surface).not.toBeNull();+ expect(surface?.className).toContain('[-webkit-app-region:drag]');+ });++ it('opts the action list out so its buttons stay clickable', async () => {+ const el = await renderHome();+ const action = el.querySelector('button[aria-label="Add Switch agent"]');++ expect(action).not.toBeNull();+ expect(action?.closest('[class*="[-webkit-app-region:no-drag]"]')).not.toBeNull();+ });+});