Skip to content

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

fix(console): Add participants opens its field above the participants

raullopez-sandbox9de57b835c45
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx
index a74fa1589..754d27657 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx
@@ -185,11 +185,21 @@ const ChatParticipantsSection = observer(function ChatParticipantsSection({
onClick={() => setAdding((v) => !v)}
>
<Plus className="size-3.5" />
- Add participant
+ Add participants
</Button>
)}
</div>
+ {adding && (
+ <ChatAddParticipantPanel
+ serverId={serverId}
+ workspaceId={workspaceId}
+ chat={chat}
+ memberIds={new Set(people.map((person) => person.userId))}
+ onAddedPeople={(next) => queryClient.setQueryData(membersKey, next)}
+ />
+ )}
+
{members.isError && (
<p className="text-xs text-destructive">{chatFailure(members.error).message}</p>
)}
@@ -206,16 +216,6 @@ const ChatParticipantsSection = observer(function ChatParticipantsSection({
}))}
manage={manage}
/>
-
- {adding && (
- <ChatAddParticipantPanel
- serverId={serverId}
- workspaceId={workspaceId}
- chat={chat}
- memberIds={new Set(people.map((person) => person.userId))}
- onAddedPeople={(next) => queryClient.setQueryData(membersKey, next)}
- />
- )}
</section>
);
});
@@ -296,6 +296,7 @@ const ChatAddParticipantPanel = observer(function ChatAddParticipantPanel({
inputId="chat-add-participant"
autoFocus
busy={adding !== null}
+ overlay
candidates={candidates}
picked={[]}
onChange={(next) => {
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
index 6eed816ba..118392fd9 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/CreateRoomModal.tsx
@@ -243,6 +243,7 @@ export const CreateRoomModal = observer(function CreateRoomModal({
inputId="new-room-participants"
autoFocus={false}
busy={isSubmitting}
+ overlay={false}
candidates={candidates}
picked={picked}
onChange={setPicked}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts
index 44cf2e369..c1d42d13a 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/new-room-dialog.test.ts
@@ -86,6 +86,7 @@ describe('ParticipantPicker', () => {
inputId: 'participants',
autoFocus: false,
busy: false,
+ overlay: false,
})
);
expect(html).toContain('aria-label="Remove helper"');
diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx b/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx
index 07c85c54e..9af729cfb 100644
--- a/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/lib/components/participant-picker.tsx
@@ -89,6 +89,7 @@ export function ParticipantPicker({
inputId,
autoFocus,
busy,
+ overlay,
}: {
candidates: Participant[];
picked: Participant[];
@@ -100,6 +101,8 @@ export function ParticipantPicker({
autoFocus: boolean;
/** A pick is being applied: the field takes no other until it is, and says so. */
busy: boolean;
+ /** The results float over what follows the field; otherwise they push it down, as a dialog needs. */
+ overlay: boolean;
}) {
const [query, setQuery] = useState('');
const [open, setOpen] = useState(false);
@@ -115,7 +118,7 @@ export function ParticipantPicker({
};
return (
- <div>
+ <div className={cn(overlay && 'relative')}>
<div
// The standard input's border, radius and focus ring, around chips that wrap.
className="focus-within:ring-primary/30 dark:bg-input/30 flex min-h-8 w-full flex-wrap items-center gap-1 rounded-md border border-border bg-transparent px-1 py-0.5 transition-[color,box-shadow] focus-within:border-border-primary focus-within:ring-2 hover:border-border-1"
@@ -183,11 +186,14 @@ export function ParticipantPicker({
)}
</div>
{open && (
- // In the flow rather than floating: the dialog clips what overflows it, so the list grows it instead.
+ // A dialog clips what overflows it, so there the list grows it instead of floating.
<div
id={`${inputId}-results`}
role="listbox"
- className="mt-1 max-h-60 overflow-y-auto rounded-[10px] border border-border bg-background p-1 shadow-sm"
+ className={cn(
+ 'mt-1 max-h-60 overflow-y-auto rounded-[10px] border border-border bg-background p-1',
+ overlay ? 'absolute inset-x-0 top-full z-20 shadow-lg' : 'shadow-sm'
+ )}
>
{loading ? (
<p className="px-2.5 py-2 text-sm text-foreground-muted">Loading…</p>
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx
index 43e17d8f5..82f844460 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/new-room-ime.test.tsx
@@ -57,6 +57,7 @@ describe('New room IME', () => {
inputId="participants"
autoFocus={false}
busy={false}
+ overlay={false}
/>
);
await act(async () => input.focus());
@@ -103,6 +104,7 @@ describe('Participant field while a pick is being added', () => {
inputId="add"
autoFocus={false}
busy={busy}
+ overlay={false}
/>
);
}
@@ -120,3 +122,29 @@ describe('Participant field while a pick is being added', () => {
expect(added).toEqual(['a1', 'a1']);
});
});
+
+describe('Participant field results', () => {
+ it('float over what follows when asked to, and push it down otherwise', async () => {
+ for (const overlay of [true, false]) {
+ const input = await render(
+ <ParticipantPicker
+ candidates={[helper]}
+ picked={[]}
+ onChange={() => {}}
+ serverId={null}
+ loading={false}
+ inputId="p"
+ autoFocus={false}
+ busy={false}
+ overlay={overlay}
+ />
+ );
+ await act(async () => input.focus());
+ const list = container!.querySelector('[role="listbox"]')!;
+ expect(list.classList.contains('absolute')).toBe(overlay);
+ await act(async () => root!.unmount());
+ root = null;
+ container!.remove();
+ }
+ });
+});
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-configuration.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-configuration.test.ts
index 42b2022df..44a19cec9 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-configuration.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-configuration.test.ts
@@ -69,7 +69,7 @@ describe('RoomConfigurationPanel for a group chat', () => {
expect(html).toContain('Planning');
expect(html).toContain('Helper');
expect(html).toContain('1 agent · 2 people');
- expect(html).toContain('Add participant');
+ expect(html).toContain('Add participants');
expect(html).not.toContain('Add agent');
expect(html).not.toContain('Add person');
expect(html).not.toContain('From a template');
@@ -81,7 +81,7 @@ describe('RoomConfigurationPanel for a group chat', () => {
it('shows the participants without controls to someone who cannot manage', () => {
const html = render(false);
expect(html).toContain('Bob');
- expect(html).not.toContain('Add participant');
+ expect(html).not.toContain('Add participants');
expect(html).not.toContain('aria-label="Remove');
});
});