Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

style(channels):make participants usable on mobile (#7551)

Seamus9e06cb01462e
diff --git a/apps/web/src/features/channel/Bots/BotInviteSelect.tsx b/apps/web/src/features/channel/Bots/BotInviteSelect.tsx
index 999360e52b..c76fc7cbcb 100644
--- a/apps/web/src/features/channel/Bots/BotInviteSelect.tsx
+++ b/apps/web/src/features/channel/Bots/BotInviteSelect.tsx
@@ -50,6 +50,7 @@ export function BotInviteSelect(props: {
channelId: string;
channelBotIds: string[];
focusRequest: number;
+ onInvited?: () => void;
}) {
const botsQuery = useBotsQuery();
const addBotMutation = useAddBotToChannelMutation();
@@ -90,7 +91,8 @@ export function BotInviteSelect(props: {
});
setSelectedBot(undefined);
toast.success(`${bot.name} invited to channel`);
- focusInput();
+ if (props.onInvited) props.onInvited();
+ else focusInput();
} catch {
toast.failure('Failed to invite bot');
}
diff --git a/apps/web/src/features/channel/Participants/ChannelBotsPanel.test.tsx b/apps/web/src/features/channel/Participants/ChannelBotsPanel.test.tsx
new file mode 100644
index 0000000000..aa47fedc4a
--- /dev/null
+++ b/apps/web/src/features/channel/Participants/ChannelBotsPanel.test.tsx
@@ -0,0 +1,112 @@
+/** @vitest-environment jsdom */
+
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { type JSX, Show } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import { ChannelBotsPanel } from './ChannelBotsPanel';
+
+const mocks = vi.hoisted(() => ({ remove: vi.fn() }));
+vi.mock('@core/mobile/isTouchDevice', () => ({ isTouchDevice: () => true }));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: vi.fn(), failure: vi.fn() },
+}));
+vi.mock('@queries/channel/channel-bots', () => ({
+ useChannelBotsQuery: () => ({
+ isSuccess: true,
+ isLoading: false,
+ data: [
+ {
+ id: 'teo',
+ name: 'Teobot',
+ handle: 'teobot',
+ description: 'Repeats messages',
+ avatar_url: null,
+ },
+ {
+ id: 'helper',
+ name: 'Helper',
+ handle: 'assistant',
+ description: 'Summarizes threads',
+ avatar_url: null,
+ },
+ ],
+ }),
+ useRemoveBotFromChannelMutation: () => ({
+ mutate: mocks.remove,
+ isPending: false,
+ }),
+}));
+vi.mock('@ui', async () => ({
+ ...(await import('@ui/components/Button')),
+ ...(await import('@ui/components/InputGroup')),
+ ...(await import('@ui/components/Avatar')),
+ ...(await import('@ui/components/Badge')),
+ ...(await import('@ui/components/Item')),
+}));
+vi.mock('./ParticipantsActionSheet', () => ({
+ ParticipantsActionSheet: (props: {
+ open: boolean;
+ children: JSX.Element;
+ }) => (
+ <Show when={props.open}>
+ <div role="dialog">{props.children}</div>
+ </Show>
+ ),
+}));
+vi.mock('../Bots/BotInviteSelect', () => ({
+ BotInviteSelect: (props: { onInvited?: () => void }) => (
+ <button onClick={props.onInvited}>Confirm invitation</button>
+ ),
+}));
+afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+});
+
+it('filters existing bots and keeps row actions separate from opening a bot', () => {
+ const open = vi.fn();
+ render(() => (
+ <ChannelBotsPanel
+ channelId="channel"
+ editable
+ inviteFocusRequest={0}
+ onCreateBot={vi.fn()}
+ onOpenBot={open}
+ />
+ ));
+ const search = screen.getByRole('searchbox', { name: 'Search bots' });
+ fireEvent.input(search, { target: { value: 'ASSISTANT' } });
+ expect(screen.queryByRole('link', { name: 'Open Teobot' })).toBeNull();
+ fireEvent.click(screen.getByRole('link', { name: 'Open Helper' }));
+ expect(open).toHaveBeenCalledWith('helper');
+ fireEvent.click(screen.getByRole('button', { name: 'Remove Helper' }));
+ expect(open).toHaveBeenCalledTimes(1);
+ expect(mocks.remove).toHaveBeenCalledWith(
+ { channelId: 'channel', botId: 'helper' },
+ expect.any(Object)
+ );
+ fireEvent.input(search, { target: { value: 'missing' } });
+ expect(screen.getByText('No matching bots')).toBeTruthy();
+ fireEvent.input(search, { target: { value: '' } });
+ expect(screen.getByRole('link', { name: 'Open Teobot' })).toBeTruthy();
+});
+
+it('uses compact create and invite actions and closes the invite sheet on success', () => {
+ const create = vi.fn();
+ render(() => (
+ <ChannelBotsPanel
+ channelId="channel"
+ editable
+ inviteFocusRequest={0}
+ onCreateBot={create}
+ onOpenBot={vi.fn()}
+ />
+ ));
+ expect(screen.queryByRole('dialog')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'New bot' }));
+ expect(create).toHaveBeenCalledOnce();
+ fireEvent.click(screen.getByRole('button', { name: 'Invite bot' }));
+ expect(screen.getByRole('dialog')).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'Confirm invitation' }));
+ expect(screen.queryByRole('dialog')).toBeNull();
+});
diff --git a/apps/web/src/features/channel/Participants/ChannelBotsPanel.tsx b/apps/web/src/features/channel/Participants/ChannelBotsPanel.tsx
index 2c7d664a6e..82959a7406 100644
--- a/apps/web/src/features/channel/Participants/ChannelBotsPanel.tsx
+++ b/apps/web/src/features/channel/Participants/ChannelBotsPanel.tsx
@@ -1,16 +1,20 @@
import { channelWebhookUrl } from '@channel/Bots/webhook';
import { LoadingSpinner } from '@core/component/LoadingSpinner';
import { toast } from '@core/component/Toast/Toast';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import PlusIcon from '@phosphor/plus.svg';
import RobotIcon from '@phosphor/robot.svg';
+import UserPlusIcon from '@phosphor/user-plus.svg';
import {
useChannelBotsQuery,
useRemoveBotFromChannelMutation,
} from '@queries/channel/channel-bots';
-import { Button, Card, Item, Scroll } from '@ui';
-import { For, Show } from 'solid-js';
+import { Button, Panel } from '@ui';
+import { createSignal, For, Show } from 'solid-js';
import { BotInviteSelect } from '../Bots/BotInviteSelect';
import { ChannelBotRow } from './ChannelBotRow';
+import { ParticipantsActionSheet } from './ParticipantsActionSheet';
+import { ParticipantsSearchInput } from './ParticipantsSearchInput';
export function ChannelBotsPanel(props: {
channelId: string;
@@ -21,7 +25,35 @@ export function ChannelBotsPanel(props: {
}) {
const botsQuery = useChannelBotsQuery(() => props.channelId);
const removeBotMutation = useRemoveBotFromChannelMutation();
- const bots = () => botsQuery.data ?? [];
+ const bots = () => (botsQuery.isSuccess ? botsQuery.data : []) ?? [];
+ const [search, setSearch] = createSignal('');
+ const filteredBots = () => {
+ const query = search().trim().toLowerCase();
+ return bots().filter((bot) =>
+ `${bot.name} ${bot.handle} ${bot.description ?? ''}`
+ .toLowerCase()
+ .includes(query)
+ );
+ };
+
+ const [inviteState, setInviteState] = createSignal({
+ open: props.inviteFocusRequest > 0,
+ request: props.inviteFocusRequest,
+ });
+ const inviteOpen = () =>
+ inviteState().open ||
+ (props.inviteFocusRequest > 0 &&
+ props.inviteFocusRequest !== inviteState().request);
+ const setInviteOpen = (open: boolean) =>
+ setInviteState({ open, request: props.inviteFocusRequest });
+ const inviteForm = () => (
+ <BotInviteSelect
+ channelId={props.channelId}
+ channelBotIds={bots().map((bot) => bot.id)}
+ focusRequest={isTouchDevice() ? 0 : props.inviteFocusRequest}
+ onInvited={isTouchDevice() ? () => setInviteOpen(false) : undefined}
+ />
+ );
const copyWebhook = async () => {
try {
@@ -42,72 +74,127 @@ export function ChannelBotsPanel(props: {
);
};
+ const list = () => (
+ <Show
+ when={!botsQuery.isLoading}
+ fallback={
+ <div class="flex min-h-0 flex-1 items-center justify-center">
+ <LoadingSpinner class="size-9 p-2" />
+ </div>
+ }
+ >
+ <Show
+ when={filteredBots().length > 0}
+ fallback={
+ <div class="flex min-h-0 flex-1 flex-col items-center justify-center px-6 text-center">
+ <div class="flex size-9 items-center justify-center rounded-lg bg-hover text-ink-muted">
+ <RobotIcon class="size-5" />
+ </div>
+ <div class="mt-2 text-sm font-medium">
+ {search().trim() ? 'No matching bots' : 'No bots in this channel'}
+ </div>
+ <div class="mt-0.5 text-xs text-ink-muted">
+ {search().trim()
+ ? 'Try a different name or handle.'
+ : 'Invite an existing bot or create a new one.'}
+ </div>
+ </div>
+ }
+ >
+ <div class="min-h-0 flex-1 overflow-y-auto">
+ <For each={filteredBots()}>
+ {(bot) => (
+ <ChannelBotRow
+ bot={bot}
+ editable={props.editable}
+ removing={removeBotMutation.isPending}
+ onOpen={() => props.onOpenBot(bot.id)}
+ onCopyWebhook={() => void copyWebhook()}
+ onRemove={() => removeBot(bot.id, bot.name)}
+ />
+ )}
+ </For>
+ </div>
+ </Show>
+ </Show>
+ );
+
return (
- <Card class="min-h-0 max-h-[40%] shrink-0">
- <Card.Header class="shrink-0">
- <div class="flex flex-wrap items-center justify-between gap-2">
- <Card.Title>Bots</Card.Title>
+ <>
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <Panel
+ depth={2}
+ class="h-[min(42%,22rem)] min-h-52 shrink-0 overflow-hidden text-ink"
+ >
+ <Panel.Header class="h-auto min-h-10 justify-between gap-3 px-6 py-2">
+ <div>
+ <div class="text-sm font-semibold">Bots</div>
+ <div class="text-xs font-normal text-ink-muted">
+ Webhook-powered channel participants
+ </div>
+ </div>
+ <Show when={props.editable}>
+ <div class="flex flex-wrap items-center gap-2">
+ <Button variant="ghost" size="sm" onClick={props.onCreateBot}>
+ <PlusIcon />
+ New bot
+ </Button>
+ </div>
+ </Show>
+ </Panel.Header>
+ <Panel.Body>
+ <div class="flex h-full flex-col">
+ <Show when={props.editable && !isTouchDevice()}>
+ <div class="shrink-0 border-b border-edge-muted px-6 py-3">
+ {inviteForm()}
+ </div>
+ </Show>
+ {list()}
+ </div>
+ </Panel.Body>
+ </Panel>
+ }
+ >
+ <div class="flex shrink-0 items-center gap-2">
+ <div class="min-w-0 flex-1">
+ <ParticipantsSearchInput
+ value={search()}
+ onInput={setSearch}
+ placeholder="Search bots"
+ />
+ </div>
<Show when={props.editable}>
- <Button variant="outline" onClick={props.onCreateBot}>
+ <Button
+ variant="outline"
+ size="icon-md"
+ label="New bot"
+ onClick={props.onCreateBot}
+ >
<PlusIcon />
- New bot
+ </Button>
+ <Button
+ variant="outline"
+ size="icon-md"
+ label="Invite bot"
+ onClick={() => setInviteOpen(true)}
+ >
+ <UserPlusIcon />
</Button>
</Show>
</div>
- <Card.Description>
- Webhook-powered channel participants
- </Card.Description>
- </Card.Header>
- <Card.Body class="flex min-h-0 flex-col gap-3">
- <Show when={props.editable}>
- <div class="shrink-0">
- <BotInviteSelect
- channelId={props.channelId}
- channelBotIds={bots().map((bot) => bot.id)}
- focusRequest={props.inviteFocusRequest}
- />
- </div>
- </Show>
- <div class="min-h-0 flex-1">
- <Scroll aria-label="Bots list">
- <Show when={!botsQuery.isLoading} fallback={<LoadingSpinner />}>
- <Show
- when={bots().length > 0}
- fallback={
- <Item role="status">
- <Item.Media>
- <RobotIcon />
- </Item.Media>
- <Item.Content>
- <Item.Title>No bots in this channel</Item.Title>
- <Show when={props.editable}>
- <Item.Description>
- Select an existing bot above or create a new one.
- </Item.Description>
- </Show>
- </Item.Content>
- </Item>
- }
- >
- <div>
- <For each={bots()}>
- {(bot) => (
- <ChannelBotRow
- bot={bot}
- editable={props.editable}
- removing={removeBotMutation.isPending}
- onOpen={() => props.onOpenBot(bot.id)}
- onCopyWebhook={() => void copyWebhook()}
- onRemove={() => removeBot(bot.id, bot.name)}
- />
- )}
- </For>
- </div>
- </Show>
- </Show>
- </Scroll>
- </div>
- </Card.Body>
- </Card>
+ <div class="flex min-h-0 flex-1 flex-col">{list()}</div>
+ </Show>
+ <Show when={props.editable && isTouchDevice()}>
+ <ParticipantsActionSheet
+ title="Invite bot"
+ open={inviteOpen()}
+ onOpenChange={setInviteOpen}
+ >
+ {inviteForm()}
+ </ParticipantsActionSheet>
+ </Show>
+ </>
);
}
diff --git a/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.test.tsx b/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.test.tsx
index ec81401b3d..f84eeb07ba 100644
--- a/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.test.tsx
+++ b/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.test.tsx
@@ -34,10 +34,16 @@ vi.mock('@queries/channel/join-links', () => ({
vi.mock('@ui', () => ({
Button: (props: {
children: JSX.Element;
+ label?: string;
disabled?: boolean;
onClick?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;
}) => (
- <button type="button" disabled={props.disabled} onClick={props.onClick}>
+ <button
+ type="button"
+ aria-label={props.label}
+ disabled={props.disabled}
+ onClick={props.onClick}
+ >
{props.children}
</button>
),
@@ -55,6 +61,18 @@ beforeEach(() => {
});
describe('ChannelJoinLinkButton', () => {
+ it('keeps the mobile icon button labeled and copies the invite link', async () => {
+ render(() => <ChannelJoinLinkButton channelId="channel-1" iconOnly />);
+ const button = screen.getByRole('button', { name: 'Copy invite link' });
+ expect(button.textContent).toBe('');
+ fireEvent.click(button);
+ await waitFor(() =>
+ expect(mocks.writeText).toHaveBeenCalledWith(
+ 'https://app.example.com/app/channel-invite?code=join-code'
+ )
+ );
+ expect(screen.getByRole('button', { name: 'Copied' })).toBeTruthy();
+ });
it('generates the link lazily and copies the invitation URL', async () => {
render(() => <ChannelJoinLinkButton channelId="channel-1" />);
diff --git a/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.tsx b/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.tsx
index 7ea40bb569..f318219ea2 100644
--- a/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.tsx
+++ b/apps/web/src/features/channel/Participants/ChannelJoinLinkButton.tsx
@@ -7,7 +7,10 @@ import { useGetChannelJoinLinkMutation } from '@queries/channel/join-links';
import { Button } from '@ui';
import { createSignal, onCleanup, Show } from 'solid-js';
-export function ChannelJoinLinkButton(props: { channelId: string }) {
+export function ChannelJoinLinkButton(props: {
+ channelId: string;
+ iconOnly?: boolean;
+}) {
const getJoinLinkMutation = useGetChannelJoinLinkMutation();
const [joinCode, setJoinCode] = createSignal<string>();
const [copied, setCopied] = createSignal(false);
@@ -72,6 +75,8 @@ export function ChannelJoinLinkButton(props: { channelId: string }) {
return (
<Button
variant="outline"
+ size={props.iconOnly ? 'icon-md' : 'sm'}
+ label={buttonLabel()}
disabled={getJoinLinkMutation.isPending}
onClick={() => void copyJoinLink()}
>
@@ -83,7 +88,7 @@ export function ChannelJoinLinkButton(props: { channelId: string }) {
<CheckIcon class="size-4" />
</Show>
</Show>
- {buttonLabel()}
+ <Show when={!props.iconOnly}>{buttonLabel()}</Show>
</Button>
);
}
diff --git a/apps/web/src/features/channel/Participants/ChannelParticipantsTab.tsx b/apps/web/src/features/channel/Participants/ChannelParticipantsTab.tsx
index 5475df67ab..bfa22c468e 100644
--- a/apps/web/src/features/channel/Participants/ChannelParticipantsTab.tsx
+++ b/apps/web/src/features/channel/Participants/ChannelParticipantsTab.tsx
@@ -1,6 +1,7 @@
import { useSplitLayout } from '@components/app/split-layout/layout';
import { useChannel, useChannelType } from '@core/context/channels';
import { useUserId } from '@core/context/user';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { getDisplayName, idToEmail, tryMacroId } from '@core/user';
import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';
@@ -13,13 +14,14 @@ import {
import { useCurrentTeamQuery } from '@queries/team/teams';
import { ChannelType } from '@service-storage/generated/schemas/channelType';
import { ParticipantRole } from '@service-storage/generated/schemas/participantRole';
-import { Card } from '@ui';
+import { Panel } from '@ui';
import { createSignal, Show } from 'solid-js';
import { ChannelBotsPanel } from './ChannelBotsPanel';
import { ChannelJoinLinkButton } from './ChannelJoinLinkButton';
import { ChannelTeamSettingsPanel } from './ChannelTeamSettingsPanel';
import { ParticipantsAddPanel } from './ParticipantsAddPanel';
import { ParticipantsList } from './ParticipantsList';
+import { ParticipantsMobileLayout } from './ParticipantsMobileLayout';
import { ParticipantsSearchInput } from './ParticipantsSearchInput';
export function ChannelParticipantsTab(props: {
@@ -92,13 +94,16 @@ export function ChannelParticipantsTab(props: {
});
};
- const addParticipants = (participantIds: string[]) => {
+ const addParticipants = (participantIds: string[], onAdded?: () => void) => {
if (!isEditable() || participantIds.length === 0) return;
- addParticipantsMutation.mutate({
- channelId: props.channelId,
- participants: participantIds,
- });
+ addParticipantsMutation.mutate(
+ {
+ channelId: props.channelId,
+ participants: participantIds,
+ },
+ { onSuccess: onAdded }
+ );
};
const removeParticipant = (participantId: string) => {
@@ -144,66 +149,122 @@ export function ChannelParticipantsTab(props: {
);
};
+ const teamSettings = () => (
+ <Show when={canManageChannel() && supportsTeamSettings()}>
+ <ChannelTeamSettingsPanel
+ isTeamChannel={isTeamChannel()}
+ autoJoinTeam={autoJoinTeam()}
+ canConvertToTeam={canConvertToTeam()}
+ conversionUnavailableReason={conversionUnavailableReason()}
+ disabled={patchChannelMutation.isPending}
+ onConvertToTeam={convertToTeamChannel}
+ onAutoJoinTeamChange={updateAutoJoinTeam}
+ />
+ </Show>
+ );
+ const bots = (inviteRequest = props.inviteBotFocusRequest) => (
+ <ChannelBotsPanel
+ channelId={props.channelId}
+ editable={isEditable()}
+ inviteFocusRequest={inviteRequest}
+ onCreateBot={props.onCreateBot}
+ onOpenBot={props.onOpenBot}
+ />
+ );
+
+ // The mobile bottom chrome (dock + accessory regions) floats over the
+ // layout, so the panel stack has to end above it for the participants list
+ // to scroll clear of it.
return (
- <div class="min-h-0 flex-1 overflow-hidden">
- <div class="mx-auto flex h-full w-full max-w-3xl flex-col gap-4 p-4 touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+1rem)]">
- <Card class="min-h-0 flex-1">
- <Card.Header class="shrink-0">
- <div class="flex flex-wrap items-center justify-between gap-2">
- <Card.Title>Participants</Card.Title>
- <Show when={channelType() === ChannelType.private}>
- <ChannelJoinLinkButton channelId={props.channelId} />
- </Show>
- </div>
- </Card.Header>
- <Card.Body class="flex min-h-0 flex-1 flex-col gap-3">
- <div class="flex shrink-0 flex-col gap-3">
- <ParticipantsSearchInput
- value={searchQuery()}
- onInput={setSearchQuery}
- />
- <Show when={isEditable()}>
- <div class="-mx-3 border-y border-edge-muted px-3 py-4">
- <ParticipantsAddPanel
- participants={participants}
- onAddParticipants={addParticipants}
- />
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <div class="h-full overflow-hidden flex justify-center p-2 touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+0.5rem)]">
+ <div class="max-w-200 size-full flex flex-col gap-2">
+ <Panel depth={2} class="min-h-0 flex-1 overflow-hidden text-ink">
+ <Panel.Header class="justify-between gap-2 px-6">
+ <div class="text-sm font-semibold">Participants</div>
+ <Show when={channelType() === ChannelType.private}>
+ <ChannelJoinLinkButton channelId={props.channelId} />
+ </Show>
+ </Panel.Header>
+ <Panel.Toolbar class="h-15.25 px-2">
+ <ParticipantsSearchInput
+ value={searchQuery()}
+ onInput={setSearchQuery}
+ />
+ </Panel.Toolbar>
+ <Panel.Body>
+ <div class="flex h-full flex-col">
+ {teamSettings()}
+ <Show when={isEditable()}>
+ <div class="px-6 py-3 border-b border-edge-muted shrink-0">
+ <ParticipantsAddPanel
+ participants={participants}
+ onAddParticipants={addParticipants}
+ />
+ </div>
+ </Show>
+ <div class="relative min-h-0 flex-1">
+ <ParticipantsList
+ participants={filteredParticipants}
+ searchQuery={searchQuery}
+ currentUserId={userId() ?? undefined}
+ editable={isEditable()}
+ onParticipantClick={openDirectMessage}
+ onRemoveParticipant={removeParticipant}
+ />
+ </div>
</div>
- </Show>
- </div>
- <div class="min-h-0 flex-1">
- <ParticipantsList
- participants={filteredParticipants}
- searchQuery={searchQuery}
- currentUserId={userId() ?? undefined}
- editable={isEditable()}
- onParticipantClick={openDirectMessage}
- onRemoveParticipant={removeParticipant}
- />
- </div>
- </Card.Body>
- </Card>
- <Show when={canManageChannel() && supportsTeamSettings()}>
- <ChannelTeamSettingsPanel
- isTeamChannel={isTeamChannel()}
- autoJoinTeam={autoJoinTeam()}
- canConvertToTeam={canConvertToTeam()}
- conversionUnavailableReason={conversionUnavailableReason()}
- disabled={patchChannelMutation.isPending}
- onConvertToTeam={convertToTeamChannel}
- onAutoJoinTeamChange={updateAutoJoinTeam}
+ </Panel.Body>
+ </Panel>
+ <Show when={props.botManagementEnabled}>{bots()}</Show>
+ </div>
+ </div>
+ }
+ >
+ <ParticipantsMobileLayout
+ search={() => (
+ <ParticipantsSearchInput
+ value={searchQuery()}
+ onInput={setSearchQuery}
/>
- </Show>
- <Show when={props.botManagementEnabled}>
- <ChannelBotsPanel
- channelId={props.channelId}
+ )}
+ list={() => (
+ <ParticipantsList
+ participants={filteredParticipants}
+ searchQuery={searchQuery}
+ currentUserId={userId() ?? undefined}
editable={isEditable()}
- inviteFocusRequest={props.inviteBotFocusRequest}
- onCreateBot={props.onCreateBot}
- onOpenBot={props.onOpenBot}
+ onParticipantClick={openDirectMessage}
+ onRemoveParticipant={removeParticipant}
/>
- </Show>
- </div>
- </div>
+ )}
+ inviteLink={
+ channelType() === ChannelType.private
+ ? () => (
+ <ChannelJoinLinkButton channelId={props.channelId} iconOnly />
+ )
+ : undefined
+ }
+ addParticipants={
+ isEditable()
+ ? (onAdded) => (
+ <ParticipantsAddPanel
+ participants={participants}
+ onAddParticipants={(ids) => addParticipants(ids, onAdded)}
+ />
+ )
+ : undefined
+ }
+ bots={props.botManagementEnabled ? bots : undefined}
+ settings={
+ canManageChannel() && supportsTeamSettings()
+ ? teamSettings
+ : undefined
+ }
+ inviteBotFocusRequest={props.inviteBotFocusRequest}
+ />
+ </Show>
);
}
diff --git a/apps/web/src/features/channel/Participants/ParticipantsActionSheet.tsx b/apps/web/src/features/channel/Participants/ParticipantsActionSheet.tsx
new file mode 100644
index 0000000000..a4b6aa73f4
--- /dev/null
+++ b/apps/web/src/features/channel/Participants/ParticipantsActionSheet.tsx
@@ -0,0 +1,43 @@
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import XIcon from '@phosphor/x.svg';
+import { Button } from '@ui';
+import type { ParentProps } from 'solid-js';
+
+export function ParticipantsActionSheet(
+ props: ParentProps<{
+ title: string;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ }>
+) {
+ return (
+ <MobileDrawer
+ side="bottom"
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ >
+ <MobileDrawer.Portal>
+ <MobileDrawer.Overlay />
+ <MobileDrawer.Content aria-label={props.title}>
+ <MobileDrawer.Handle />
+ <div class="flex items-center justify-between gap-2 px-4 pb-3">
+ <MobileDrawer.Title class="text-base font-semibold">
+ {props.title}
+ </MobileDrawer.Title>
+ <Button
+ variant="ghost"
+ size="icon-md"
+ label="Close"
+ onClick={() => props.onOpenChange(false)}
+ >
+ <XIcon />
+ </Button>
+ </div>
+ <MobileDrawer.ScrollBody>
+ <div class="px-4 pb-4">{props.children}</div>
+ </MobileDrawer.ScrollBody>
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ </MobileDrawer>
+ );
+}
diff --git a/apps/web/src/features/channel/Participants/ParticipantsAddPanel.tsx b/apps/web/src/features/channel/Participants/ParticipantsAddPanel.tsx
index 0fc7089b0f..c19cd3e088 100644
--- a/apps/web/src/features/channel/Participants/ParticipantsAddPanel.tsx
+++ b/apps/web/src/features/channel/Participants/ParticipantsAddPanel.tsx
@@ -37,8 +37,8 @@ export function ParticipantsAddPanel(props: {
};
return (
- <div class="flex flex-wrap items-center gap-2">
- <div class="min-w-0 flex-1 basis-60">
+ <div class="flex flex-col gap-2 md:flex-row md:items-center">
+ <div class="min-w-0 flex-1">
<RecipientSelector<'user'>
setSelectedOptions={setSelectedUsers}
selectedOptions={selectedUsers()}
diff --git a/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.test.tsx b/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.test.tsx
new file mode 100644
index 0000000000..5268f7b963
--- /dev/null
+++ b/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.test.tsx
@@ -0,0 +1,164 @@
+/** @vitest-environment jsdom */
+
+import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
+import { FloatRegions } from '@components/app/mobile/float-regions/float-region-state';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { ParticipantsMobileLayout } from './ParticipantsMobileLayout';
+
+vi.mock('@core/mobile/isTouchDevice', () => ({ isTouchDevice: () => true }));
+vi.mock('@components/app/split-layout/layoutUtils', () => ({
+ useSplitPanel: () => undefined,
+}));
+
+vi.mock('@core/mobile/virtualKeyboard', () => ({
+ virtualKeyboardVisible: () => false,
+}));
+vi.mock('@ui', async () => ({
+ ...(await import('@ui/components/Button')),
+ ...(await import('@ui/components/Tabs')),
+}));
+
+let drawerStyles: HTMLStyleElement;
+beforeEach(() => {
+ drawerStyles = document.createElement('style');
+ drawerStyles.textContent =
+ '[data-corvu-drawer-content], [data-corvu-drawer-overlay] { transition-duration: 0s; animation-name: none; }';
+ document.head.append(drawerStyles);
+ vi.stubGlobal(
+ 'ResizeObserver',
+ class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ }
+ );
+ vi.stubGlobal('scrollTo', vi.fn());
+});
+afterEach(() => {
+ cleanup();
+ drawerStyles.remove();
+ vi.unstubAllGlobals();
+});
+
+function setup(manage = true) {
+ const [request, setRequest] = createSignal(0);
+ render(() => (
+ <ParticipantsMobileLayout
+ search={() => <input aria-label="Search participants" />}
+ list={() => <div>People list</div>}
+ bots={(request) => <div data-invite-request={request}>Bots list</div>}
+ settings={manage ? () => <div>Team settings</div> : undefined}
+ addParticipants={
+ manage
+ ? (done) => (
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ done();
+ }}
+ >
+ <input aria-label="People to add" />
+ <button type="submit">Add selected people</button>
+ </form>
+ )
+ : undefined
+ }
+ inviteBotFocusRequest={request()}
+ />
+ ));
+ return { setRequest };
+}
+
+it('gives People, Bots, and Settings separate content areas', () => {
+ setup();
+ expect(screen.getByText('People list')).toBeTruthy();
+ expect(screen.queryByText('Bots list')).toBeNull();
+ expect(screen.queryByText('Team settings')).toBeNull();
+ fireEvent.click(screen.getByRole('radio', { name: 'Bots' }));
+ expect(screen.getByText('Bots list')).toBeTruthy();
+ expect(screen.queryByText('People list')).toBeNull();
+ fireEvent.click(screen.getByRole('radio', { name: 'Settings' }));
+ expect(screen.getByText('Team settings')).toBeTruthy();
+ expect(screen.queryByText('Bots list')).toBeNull();
+});
+
+it('keeps the add form out of the list and supports dismissing and reopening the sheet', async () => {
+ setup();
+ expect(screen.queryByRole('dialog')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'Add participants' }));
+ expect(
+ await screen.findByRole('dialog', { name: 'Add participants' })
+ ).toBeTruthy();
+ expect(screen.getByRole('textbox', { name: 'People to add' })).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+ fireEvent.click(screen.getByRole('button', { name: 'Add participants' }));
+ expect(await screen.findByRole('dialog')).toBeTruthy();
+ fireEvent.click(screen.getByRole('button', { name: 'Add selected people' }));
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+});
+
+it('opens Bots for a new invite request and allows returning to People', () => {
+ const { setRequest } = setup(false);
+ expect(screen.queryByRole('radio', { name: 'Settings' })).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Add participants' })).toBeNull();
+ setRequest(1);
+ expect(screen.getByText('Bots list')).toBeTruthy();
+ expect(
+ screen.getByText('Bots list').getAttribute('data-invite-request')
+ ).toBe('1');
+ fireEvent.click(screen.getByRole('radio', { name: 'People' }));
+ expect(screen.getByText('People list')).toBeTruthy();
+ fireEvent.click(screen.getByRole('radio', { name: 'Bots' }));
+ expect(
+ screen.getByText('Bots list').getAttribute('data-invite-request')
+ ).toBe('0');
+ setRequest(2);
+ expect(screen.getByText('Bots list')).toBeTruthy();
+ expect(
+ screen.getByText('Bots list').getAttribute('data-invite-request')
+ ).toBe('2');
+});
+
+it('hides the fallback accessory on People and Bots and restores it on exit', () => {
+ const mount = document.createElement('div');
+ document.body.append(mount);
+ FloatRegions.setMount('accessory', mount);
+ render(() => (
+ <FloatRegion region="accessory" priority={-1}>
+ <button>AI composer</button>
+ </FloatRegion>
+ ));
+ expect(screen.getByRole('button', { name: 'AI composer' })).toBeTruthy();
+ const page = render(() => (
+ <ParticipantsMobileLayout
+ search={() => <input aria-label="Search participants" />}
+ list={() => <div>People list</div>}
+ bots={() => <div>Bots list</div>}
+ inviteBotFocusRequest={0}
+ />
+ ));
+ expect(screen.queryByRole('button', { name: 'AI composer' })).toBeNull();
+ fireEvent.click(screen.getByRole('radio', { name: 'Bots' }));
+ expect(screen.queryByRole('button', { name: 'AI composer' })).toBeNull();
+ const search = render(() => (
+ <FloatRegion region="accessory" priority={100}>
+ <button>Global search</button>
+ </FloatRegion>
+ ));
+ expect(screen.getByRole('button', { name: 'Global search' })).toBeTruthy();
+ search.unmount();
+ expect(screen.queryByRole('button', { name: 'AI composer' })).toBeNull();
+ page.unmount();
+ expect(screen.getByRole('button', { name: 'AI composer' })).toBeTruthy();
+ cleanup();
+ mount.remove();
+});
diff --git a/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.tsx b/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.tsx
new file mode 100644
index 0000000000..c329614e3e
--- /dev/null
+++ b/apps/web/src/features/channel/Participants/ParticipantsMobileLayout.tsx
@@ -0,0 +1,91 @@
+import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
+import UserPlusIcon from '@phosphor/user-plus.svg';
+import { Button, Tabs } from '@ui';
+import { createSignal, type JSX, Match, Show, Switch } from 'solid-js';
+import { ParticipantsActionSheet } from './ParticipantsActionSheet';
+
+export function ParticipantsMobileLayout(props: {
+ search: () => JSX.Element;
+ list: () => JSX.Element;
+ inviteLink?: () => JSX.Element;
+ addParticipants?: (onAdded: () => void) => JSX.Element;
+ bots?: (inviteRequest: number) => JSX.Element;
+ settings?: () => JSX.Element;
+ inviteBotFocusRequest: number;
+}) {
+ const [selection, setSelection] = createSignal({
+ tab: props.inviteBotFocusRequest > 0 && props.bots ? 'bots' : 'people',
+ request: 0,
+ });
+ const [adding, setAdding] = createSignal(false);
+ // A request from the channel's invite menu opens Bots even if People was selected.
+ const tab = () =>
+ props.bots && props.inviteBotFocusRequest !== selection().request
+ ? 'bots'
+ : selection().tab;
+
+ return (
+ <div class="flex h-full min-h-0 flex-col gap-2 px-3 pt-2 pb-[calc(var(--mobile-content-inset-bottom,0px)+0.5rem)]">
+ {/* Management screens reserve no space for the fallback AI composer. */}
+ <FloatRegion region="accessory" />
+ <div class="shrink-0 overflow-x-auto scrollbar-hidden">
+ <Tabs
+ aria-label="Channel participants"
+ list={[
+ { value: 'people', label: 'People' },
+ ...(props.bots ? [{ value: 'bots', label: 'Bots' }] : []),
+ ...(props.settings
+ ? [{ value: 'settings', label: 'Settings' }]
+ : []),
+ ]}
+ value={tab()}
+ onChange={(tab) =>
+ setSelection({ tab, request: props.inviteBotFocusRequest })
+ }
+ class="h-11"
+ labelClass="h-11"
+ />
+ </div>
+ <Switch>
+ <Match when={tab() === 'people'}>
+ <div class="flex shrink-0 items-center gap-2">
+ <div class="min-w-0 flex-1">{props.search()}</div>
+ {props.inviteLink?.()}
+ <Show when={props.addParticipants}>
+ <Button
+ variant="outline"
+ size="icon-md"
+ label="Add participants"
+ onClick={() => setAdding(true)}
+ >
+ <UserPlusIcon />
+ </Button>
+ </Show>
+ </div>
+ <div class="min-h-0 flex-1">{props.list()}</div>
+ </Match>
+ <Match when={tab() === 'bots'}>
+ {props.bots?.(
+ props.inviteBotFocusRequest !== selection().request
+ ? props.inviteBotFocusRequest
+ : 0
+ )}
+ </Match>
+ <Match when={tab() === 'settings'}>
+ <div class="min-h-0 flex-1 overflow-y-auto">{props.settings?.()}</div>
+ </Match>
+ </Switch>
+ <Show when={props.addParticipants}>
+ {(add) => (
+ <ParticipantsActionSheet
+ title="Add participants"
+ open={adding()}
+ onOpenChange={setAdding}
+ >
+ {add()(() => setAdding(false))}
+ </ParticipantsActionSheet>
+ )}
+ </Show>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/channel/Participants/ParticipantsSearchInput.tsx b/apps/web/src/features/channel/Participants/ParticipantsSearchInput.tsx
index f9c722628d..1f8556eaa4 100644
--- a/apps/web/src/features/channel/Participants/ParticipantsSearchInput.tsx
+++ b/apps/web/src/features/channel/Participants/ParticipantsSearchInput.tsx
@@ -3,20 +3,21 @@ import { InputGroup } from '@ui';
export function ParticipantsSearchInput(props: {
value: string;
+ placeholder?: string;
onInput: (value: string) => void;
}) {
return (
- <InputGroup class="rounded-full">
+ <InputGroup size="lg" class="rounded-full">
+ <InputGroup.Addon>
+ <MagnifyingGlassIcon />
+ </InputGroup.Addon>
<InputGroup.Input
type="search"
- aria-label="Search participants"
value={props.value}
onInput={(event) => props.onInput(event.currentTarget.value)}
- placeholder="Search participants"
+ placeholder={props.placeholder ?? 'Search participants'}
+ aria-label={props.placeholder ?? 'Search participants'}
/>
- <InputGroup.Addon>
- <MagnifyingGlassIcon />
- </InputGroup.Addon>
<InputGroup.Addon align="inline-end">
<InputGroup.ClearButton />
</InputGroup.Addon>
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index bf55696c67..40b5d86bd7 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -961,6 +961,20 @@ list must leave the bots section and participant controls visible.
a `Bot` badge, and a row link that opens the bot. Copy webhook and Remove are
separate actions that do not open the bot.
+On touch devices, this page uses `People` / `Bots` / `Settings` bubble tabs.
+Bots appears when bot management is enabled; Settings appears for channel owners
+and admins when team settings are available. People keeps search and the compact
+`Copy invite link` / `Add participants` buttons above a virtualized scrolling list.
+`Add participants` opens a bottom sheet; Bots has its own full-height list and an
+`Invite bot` sheet. Bots uses the same search toolbar and plain rows as People;
+`Search bots` filters existing bots by name, handle, or description, with compact
+`New bot` and `Invite bot` actions beside it. The fallback AI composer and New
+button are hidden throughout this page and return when leaving it. Both sheets use the standard mobile keyboard-aware layout and
+close after a successful add. Check switching tabs, closing/reopening both sheets,
+and scrolling a long participant list above the bottom dock, with and without the
+keyboard open. An invite-bot request from the channel menu opens the Bots tab and
+its invite sheet.
+
## Incoming call ringing
For cross-tab ringing checks, sign the recipient into two tabs and start a call