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.

feat(calls): improve chat layout and mobile call controls (#9076)

dev-rb7117873e9746
diff --git a/.agents/rules/web/mobile.md b/.agents/rules/web/mobile.md
index 612e140fe7..74a0b29175 100644
--- a/.agents/rules/web/mobile.md
+++ b/.agents/rules/web/mobile.md
@@ -139,7 +139,7 @@ read their code, and follow that pattern rather than inventing a new one.
ignores taps outside islands). Bottom chrome goes through `FloatRegion` or
`FloatRegionOrInline` with `px-(--mobile-chrome-gutter)` and
`pointer-events-auto`. Style it with `island` / `glass`, size it with the
- px `--mobile-chrome-*` tokens (not rem), and pass Button a `depth`.
+ px `--mobile-chrome-*` tokens (not rem), and use Button's size and finish props.
- Mark selection with `ink`, never `accent`: a selected pill is `bg-ink
text-surface`, a selected dock button or drawer row stays at full ink while
its siblings dim (`text-ink-extra-muted`, `aria-current="page"`). Keep the
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index caad395c95..67a87c1d81 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -607,6 +607,10 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription to
calls open their record; ongoing channel and scheduled calls return to the
channel and Calendar. Leaving from a channel's Call tab stays in the channel. Preserve the session ID and send the server leave before media
teardown; once the last participant drops, the server ends the call first.
+- Keep active phone calls viewport-filling with visible header islands and idle
+ controls below the video; Back dismisses without leaving, while setup and
+ tablet/desktop chrome stay unchanged.
+ See [Calls](../../docs/agent-guide/calls.md).
- Diagnose browser call media with `call.media.*` spans and the `meeting.setup.id`
on `meeting.join`; keep provider messages, device labels/IDs, and call-link
tokens out of telemetry. See [call diagnostics](../../docs/agent-guide/calls.md#browser-call-diagnostics).
diff --git a/apps/web/src/components/ui/components/Tabs.tsx b/apps/web/src/components/ui/components/Tabs.tsx
index 56c15395b2..52444a4708 100644
--- a/apps/web/src/components/ui/components/Tabs.tsx
+++ b/apps/web/src/components/ui/components/Tabs.tsx
@@ -17,8 +17,8 @@ export type TabOption<T extends string> = {
/** Accessible name, and the tooltip when the group is icon-only. */
label: string;
icon?: Component<{ class?: string }>;
- /** Shown after the label in muted figures. */
- count?: number;
+ /** Shown after the label in muted figures; strings retain caller formatting. */
+ count?: number | string;
disabled?: boolean;
};
diff --git a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
index 702351fd02..ae1e26e1c4 100644
--- a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
+++ b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
@@ -8,6 +8,7 @@ import {
makeRenameAction,
useBlockEntityCommands,
} from '@app/features/next-soup/actions';
+import { t } from '@app/lib/i18n';
import { createSearchParams } from '@app/lib/split-router';
import { TraceFlow } from '@app/observability/flow';
import { URL_PARAMS } from '@block-channel/constants';
@@ -56,7 +57,10 @@ import { useChannelPictureActions } from '@channel/channel-picture';
import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';
import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
import { BlockSplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';
-import { SplitHeaderRight } from '@components/app/split-layout/components/SplitHeader';
+import {
+ SplitHeaderLeft,
+ SplitHeaderRight,
+} from '@components/app/split-layout/components/SplitHeader';
import { SplitTitleFileMenu } from '@components/app/split-layout/components/SplitLabel';
import { SplitLayoutContext } from '@components/app/split-layout/context';
import {
@@ -80,13 +84,14 @@ import { blockHotkeyScopeSignal } from '@core/signal/blockElement';
import { blockHandleSignal } from '@core/signal/load';
import { fireAndForget } from '@core/util/fireAndForget';
import { buildEntityData, canEditChannelIdentity } from '@entity';
+import CaretLeft from '@icon/system/regular/caret-left.svg';
import PictureIcon from '@icon/system/regular/image.svg';
import RenameIcon from '@icon/system/regular/pencil-line.svg';
import TrashIcon from '@icon/system/regular/trash.svg';
import { useActiveCallQuery } from '@queries/call/call';
import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';
import { useSearchParams } from '@solidjs/router';
-import { cn } from '@ui';
+import { Button, cn } from '@ui';
import {
createComputed,
createEffect,
@@ -131,6 +136,7 @@ const initialChannelTab = (options: {
function NewTop(props: { channelId: string }) {
const { activeTab, setActiveTab } = useChannelTab();
+ const panel = useSplitPanelOrThrow();
const channelName = useChannelName(props.channelId);
const channelType = useChannelType(props.channelId);
const channel = useChannel(props.channelId);
@@ -139,6 +145,8 @@ function NewTop(props: { channelId: string }) {
const participantsQuery = useChannelParticipantsQuery(() => props.channelId);
const call = useCall(() => props.channelId);
const activeCallQuery = useActiveCallQuery(() => props.channelId);
+ const isActivePhoneCall = () =>
+ isMobile() && activeTab() === 'call' && call.isInThisChannel();
const participants = () =>
participantsQuery.isLoading ? [] : participantsQuery.data;
const tabs = useChannelTabItems(props.channelId);
@@ -198,6 +206,20 @@ function NewTop(props: { channelId: string }) {
return (
<Suspense>
+ <Show when={isActivePhoneCall() && !panel.handle.canGoBack()}>
+ <SplitHeaderLeft>
+ <HeaderIsland class="order-first gap-0 px-1">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('splitMenu.goBack')}
+ onClick={() => setActiveTab('messages')}
+ >
+ <CaretLeft class="size-6" />
+ </Button>
+ </HeaderIsland>
+ </SplitHeaderLeft>
+ </Show>
<ChannelTopLeft
channelId={props.channelId}
channelType={channelType()!}
@@ -261,18 +283,18 @@ function NewTop(props: { channelId: string }) {
]}
/>
</SplitTitleFileMenu>
- <SplitHeaderRight>
- {/* On mobile the split header is pointer-events-none; only islands
- (glass pills) take taps. `empty:hidden` drops the pill when the
- button is not offered (DMs, non-participants). */}
- <HeaderIsland class="px-1">
- <ChannelInviteButton
- channelId={props.channelId}
- channelName={channelName() ?? 'New Channel'}
- channelType={channelType()}
- />
- </HeaderIsland>
- </SplitHeaderRight>
+ <Show when={!isActivePhoneCall()}>
+ <SplitHeaderRight>
+ {/* Only header islands receive taps on touch screens. */}
+ <HeaderIsland class="px-1">
+ <ChannelInviteButton
+ channelId={props.channelId}
+ channelName={channelName() ?? 'New Channel'}
+ channelType={channelType()}
+ />
+ </HeaderIsland>
+ </SplitHeaderRight>
+ </Show>
{/* Desktop only: on mobile the action lives in the title drawer above. */}
<Show when={!isMobile() && askMacroEntity()}>
{(entity) => (
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
index 780b9eb68f..85b12d3910 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
@@ -1,3 +1,4 @@
+import { isMobile } from '@core/mobile/isMobile';
import CaretUp from '@icon/system/regular/caret-up.svg';
import Microphone from '@icon/system/regular/microphone.svg';
import MicrophoneSlash from '@icon/system/regular/microphone-slash.svg';
@@ -5,13 +6,14 @@ import PhoneDisconnect from '@icon/system/regular/phone-disconnect.svg';
import Screencast from '@icon/system/regular/screencast.svg';
import VideoCamera from '@icon/system/regular/video-camera.svg';
import VideoCameraSlash from '@icon/system/regular/video-camera-slash.svg';
-import { Button, ButtonGroup, Dropdown } from '@ui';
+import { Button, ButtonGroup } from '@ui';
import { createSignal, type JSX, Show } from 'solid-js';
+import { CallSettingsMenu } from './CallSettingsMenu';
/**
* A media toggle split from its settings menu: the left half turns the device
* on or off, the caret opens its menu on click. The toggle keeps one fill and
- * shows its state through the icon.
+ * shows its state through the icon, with failure color when the device is off.
*/
function MediaSplitButton(props: {
label: string;
@@ -23,43 +25,57 @@ function MediaSplitButton(props: {
onToggle: () => void;
icon: JSX.Element;
children: JSX.Element;
+ mobileContent: JSX.Element;
+ onOpenChange?: (open: boolean) => void;
}) {
const [open, setOpen] = createSignal(false);
return (
- <Dropdown placement="top-start" open={open()} onOpenChange={setOpen}>
- <ButtonGroup size="icon-lg" aria-label={props.label}>
- <ButtonGroup.Button
- aria-label={props.toggleLabel}
- tooltip={{ content: props.toggleLabel, placement: 'top' }}
- aria-pressed={props.pressed}
- disabled={props.disabled}
- onClick={props.onToggle}
- >
- {props.icon}
- </ButtonGroup.Button>
- <ButtonGroup.Divider />
- <Dropdown.Trigger
- as={ButtonGroup.Button}
- variant="ghost"
- size="icon-lg"
- aria-label={props.menuLabel}
- tooltip={{
- content: props.menuLabel,
- placement: 'top',
- disabled: open(),
- }}
- class="w-6"
+ <CallSettingsMenu
+ title={props.menuLabel}
+ open={open()}
+ onOpenChange={(open) => {
+ setOpen(open);
+ props.onOpenChange?.(open);
+ }}
+ mobileContent={props.mobileContent}
+ trigger={(triggerProps) => (
+ <ButtonGroup
+ size={isMobile() ? 'icon-md' : 'icon-lg'}
+ aria-label={props.label}
+ class="shrink-0"
>
- <CaretUp
- class="size-3 transition-transform duration-200 ease-out motion-reduce:transition-none"
- classList={{ 'rotate-180': open() }}
- />
- </Dropdown.Trigger>
- </ButtonGroup>
- <Dropdown.Content class="w-72 max-w-[calc(100vw-2rem)]">
- {props.children}
- </Dropdown.Content>
- </Dropdown>
+ <ButtonGroup.Button
+ aria-label={props.toggleLabel}
+ tooltip={{ content: props.toggleLabel, placement: 'top' }}
+ aria-pressed={props.pressed}
+ disabled={props.disabled}
+ onClick={props.onToggle}
+ >
+ {props.icon}
+ </ButtonGroup.Button>
+ <ButtonGroup.Divider />
+ <ButtonGroup.Button
+ {...triggerProps}
+ variant="ghost"
+ size={isMobile() ? 'icon-md' : 'icon-lg'}
+ aria-label={props.menuLabel}
+ tooltip={{
+ content: props.menuLabel,
+ placement: 'top',
+ disabled: open(),
+ }}
+ class="w-6 mobile:@max-[20rem]:min-w-6"
+ >
+ <CaretUp
+ class="size-3 transition-transform duration-200 ease-out motion-reduce:transition-none"
+ classList={{ 'rotate-180': open() }}
+ />
+ </ButtonGroup.Button>
+ </ButtonGroup>
+ )}
+ >
+ {props.children}
+ </CallSettingsMenu>
);
}
@@ -76,19 +92,35 @@ export function CallControlBar(props: {
audioMenu: JSX.Element;
/** Dropdown items for the camera and its background effect. */
videoMenu: JSX.Element;
+ audioDrawer: JSX.Element;
+ videoDrawer: JSX.Element;
/** Dropdown items for what a screen share captures. */
screenMenu: JSX.Element;
+ screenDrawer: JSX.Element;
error?: string;
+ onSettingsOpenChange?: (open: boolean) => void;
+ children?: JSX.Element;
}) {
+ let audioOpen = false;
+ let videoOpen = false;
+ let screenOpen = false;
return (
- <div data-call-controls class="@container relative z-20 w-full max-w-xl">
- <div class="mx-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-1 rounded-xl bg-menu-glass p-1.5 text-ink glass @sm:gap-2">
+ <div
+ data-call-controls
+ class="@container relative z-20 w-full max-w-xl mobile:max-w-none"
+ >
+ <div class="mx-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-2 rounded-full bg-menu-glass p-1.5 text-ink glass mobile:@max-[20rem]:px-0 @max-xs:gap-1 @max-3xs:gap-0 @max-3xs:px-0 @sm:gap-3">
<MediaSplitButton
label="Microphone"
+ onOpenChange={(open) => {
+ audioOpen = open;
+ props.onSettingsOpenChange?.(audioOpen || videoOpen || screenOpen);
+ }}
toggleLabel={
props.audioMuted ? 'Unmute microphone' : 'Mute microphone'
}
menuLabel="Audio settings"
+ mobileContent={props.audioDrawer}
disabled={props.disabled}
onToggle={props.onToggleAudio}
icon={
@@ -96,7 +128,7 @@ export function CallControlBar(props: {
when={props.audioMuted}
fallback={<Microphone class="size-5" />}
>
- <MicrophoneSlash class="size-5" />
+ <MicrophoneSlash class="size-5 text-failure" />
</Show>
}
>
@@ -104,7 +136,12 @@ export function CallControlBar(props: {
</MediaSplitButton>
<MediaSplitButton
label="Camera"
+ onOpenChange={(open) => {
+ videoOpen = open;
+ props.onSettingsOpenChange?.(audioOpen || videoOpen || screenOpen);
+ }}
toggleLabel={props.videoMuted ? 'Turn on camera' : 'Turn off camera'}
+ mobileContent={props.videoDrawer}
menuLabel="Video settings"
disabled={props.disabled}
onToggle={props.onToggleVideo}
@@ -113,7 +150,7 @@ export function CallControlBar(props: {
when={props.videoMuted}
fallback={<VideoCamera class="size-5" />}
>
- <VideoCameraSlash class="size-5" />
+ <VideoCameraSlash class="size-5 text-failure" />
</Show>
}
>
@@ -121,6 +158,11 @@ export function CallControlBar(props: {
</MediaSplitButton>
<MediaSplitButton
label="Screen share"
+ onOpenChange={(open) => {
+ screenOpen = open;
+ props.onSettingsOpenChange?.(audioOpen || videoOpen || screenOpen);
+ }}
+ mobileContent={props.screenDrawer}
toggleLabel={
props.screenSharing ? 'Stop sharing screen' : 'Share screen'
}
@@ -132,8 +174,9 @@ export function CallControlBar(props: {
>
{props.screenMenu}
</MediaSplitButton>
+ {props.children}
<Button
- size="icon-lg"
+ size={isMobile() ? 'icon-md' : 'icon-lg'}
variant="danger"
aria-label="Leave call"
tooltip={{ content: 'Leave call', placement: 'top' }}
@@ -145,7 +188,7 @@ export function CallControlBar(props: {
<Show when={props.error}>
<p
role="alert"
- class="absolute inset-x-0 top-full rounded-lg bg-panel p-2 text-center text-xs text-failure"
+ class="absolute inset-x-0 top-full rounded-lg bg-panel p-2 text-center text-xs text-failure mobile:top-auto mobile:bottom-full mobile:mb-2"
>
{props.error}
</p>
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControls.tsx b/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
index 73b0a0bf62..f1ce6507ac 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControls.tsx
@@ -1,6 +1,6 @@
import { fireAndForget } from '@core/util/fireAndForget';
import { isPlatform } from '@core/util/platform';
-import { type Accessor, Show } from 'solid-js';
+import { type Accessor, type JSX, Show } from 'solid-js';
import { useMaybeNativeCallState } from '../native-call-state';
import { setNativeCallKitVideoOverlayMode } from '../use-callkit';
import { CallControlsDefaultAndPanelRow } from './CallControlsDefaultAndPanelRow';
@@ -8,7 +8,9 @@ import { CallControlsDefaultAndPanelRow } from './CallControlsDefaultAndPanelRow
export type CallControlsProps = {
/** Leave / hang up — parent supplies tab switch, `leaveCall()`, etc. */
onLeave: () => void | Promise<void>;
+ onSettingsOpenChange?: (open: boolean) => void;
when?: boolean | Accessor<boolean>;
+ children?: JSX.Element;
};
function readWhen(when: boolean | Accessor<boolean> | undefined): boolean {
@@ -41,10 +43,16 @@ export function CallControls(props: CallControlsProps) {
>
End call
</button>
+ {props.children}
</div>
</Show>
<Show when={!nativeCall?.snapshot()}>
- <CallControlsDefaultAndPanelRow onLeave={props.onLeave} />
+ <CallControlsDefaultAndPanelRow
+ onLeave={props.onLeave}
+ onSettingsOpenChange={props.onSettingsOpenChange}
+ >
+ {props.children}
+ </CallControlsDefaultAndPanelRow>
</Show>
</Show>
);
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx b/apps/web/src/features/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
index 9697bc6324..bbfe6f41b7 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
@@ -1,8 +1,19 @@
+import type { JSX } from 'solid-js';
import { useCallContext } from '../CallContext';
import { CallMediaControls } from './CallMediaControls';
export function CallControlsDefaultAndPanelRow(props: {
onLeave: () => void | Promise<void>;
+ onSettingsOpenChange?: (open: boolean) => void;
+ children?: JSX.Element;
}) {
- return <CallMediaControls media={useCallContext()} onLeave={props.onLeave} />;
+ return (
+ <CallMediaControls
+ media={useCallContext()}
+ onLeave={props.onLeave}
+ onSettingsOpenChange={props.onSettingsOpenChange}
+ >
+ {props.children}
+ </CallMediaControls>
+ );
}
diff --git a/apps/web/src/features/channel/Call/CallControls/CallMediaControls.tsx b/apps/web/src/features/channel/Call/CallControls/CallMediaControls.tsx
index 63ac1699a9..ba5d95cc7f 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallMediaControls.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallMediaControls.tsx
@@ -1,3 +1,4 @@
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
import { BlurIcon } from '@core/component/media/media-background-picker';
import { MediaDeviceRadioItems } from '@core/component/media/media-device-picker';
import type { BackgroundEffect } from '@core/media/background-effect';
@@ -6,8 +7,8 @@ import { fireAndForget } from '@core/util/fireAndForget';
import Image from '@icon/system/regular/image.svg';
import Prohibit from '@icon/system/regular/prohibit.svg';
import Upload from '@icon/system/regular/upload-simple.svg';
-import { Dropdown } from '@ui';
-import { createSignal, type JSX, onCleanup, Show } from 'solid-js';
+import { Dropdown, SingleSelectCheck, ToggleSwitch } from '@ui';
+import { createSignal, For, type JSX, onCleanup, Show } from 'solid-js';
import type { CallState } from '../CallContext';
import { CallControlBar } from './CallControlBar';
@@ -48,6 +49,8 @@ function backgroundChoice(effect: BackgroundEffect): BackgroundChoice {
export function CallMediaControls(props: {
media: CallMediaControlsState;
onLeave: () => void | Promise<void>;
+ onSettingsOpenChange?: (open: boolean) => void;
+ children?: JSX.Element;
}) {
const call = props.media;
const [applyingBackground, setApplyingBackground] = createSignal(false);
@@ -97,10 +100,19 @@ export function CallMediaControls(props: {
}
const backgroundDisabled = () => call.isConnecting() || applyingBackground();
+ const selectMicrophone = (id: string) =>
+ fire(() => call.switchAudioInput(id || 'default'));
+ const selectSpeaker = (id: string) =>
+ fire(() => call.switchAudioOutput(id || 'default'));
+ const selectCamera = (id: string) =>
+ fire(() =>
+ call.switchVideoInput(id || call.videoInputDevices()[0]?.deviceId || '')
+ );
return (
<>
<CallControlBar
+ onSettingsOpenChange={props.onSettingsOpenChange}
disabled={call.isConnecting()}
audioMuted={call.isAudioMuted()}
videoMuted={call.isVideoMuted()}
@@ -119,9 +131,7 @@ export function CallMediaControls(props: {
devices={call.audioInputDevices()}
selected={call.activeAudioInputDeviceId() ?? ''}
disabled={call.isConnecting()}
- onSelect={(id) =>
- fire(() => call.switchAudioInput(id || 'default'))
- }
+ onSelect={selectMicrophone}
/>
</Dropdown.Group>
<Show when={'setSinkId' in HTMLMediaElement.prototype}>
@@ -133,21 +143,28 @@ export function CallMediaControls(props: {
devices={call.audioOutputDevices()}
selected={call.activeAudioOutputDeviceId() ?? ''}
disabled={call.isConnecting()}
- onSelect={(id) =>
- fire(() => call.switchAudioOutput(id || 'default'))
- }
+ onSelect={selectSpeaker}
/>
</Dropdown.Group>
</Show>
<Dropdown.Separator />
<Dropdown.Group>
<Dropdown.CheckboxItem
+ class="flex-row-reverse"
checked={call.isNoiseSuppressed()}
disabled={call.isConnecting()}
closeOnSelect={false}
onChange={() => fire(call.toggleNoiseSuppression)}
+ indicator={
+ <span inert aria-hidden="true">
+ <ToggleSwitch
+ size="md"
+ checked={call.isNoiseSuppressed()}
+ />
+ </span>
+ }
>
- Noise suppression
+ <span class="flex-1">Noise suppression</span>
</Dropdown.CheckboxItem>
</Dropdown.Group>
</>
@@ -169,6 +186,26 @@ export function CallMediaControls(props: {
</p>
</Dropdown.Group>
}
+ screenDrawer={
+ <>
+ <MobileDrawer.Section>
+ <ToggleSwitch
+ size="md"
+ label="Share audio"
+ labelClass="order-first flex-1"
+ class="min-h-11 w-full px-3 py-2.5 text-sm"
+ checked={call.shareScreenAudio()}
+ disabled={call.isConnecting() || call.isScreenSharing()}
+ onChange={(checked) => call.setShareScreenAudio(checked)}
+ />
+ </MobileDrawer.Section>
+ <p class="mt-2 px-3 text-xs text-ink-muted">
+ {call.isScreenSharing()
+ ? 'Stop sharing to change this.'
+ : 'Shares audio from a tab, or from your whole system where the browser supports it.'}
+ </p>
+ </>
+ }
videoMenu={
<>
<Dropdown.Group>
@@ -178,13 +215,7 @@ export function CallMediaControls(props: {
devices={call.videoInputDevices()}
selected={call.activeVideoInputDeviceId() ?? ''}
disabled={call.isConnecting()}
- onSelect={(id) =>
- fire(() =>
- call.switchVideoInput(
- id || call.videoInputDevices()[0]?.deviceId || ''
- )
- )
- }
+ onSelect={selectCamera}
/>
</Dropdown.Group>
<Dropdown.Separator />
@@ -243,7 +274,125 @@ export function CallMediaControls(props: {
</Dropdown.Group>
</>
}
- />
+ audioDrawer={
+ <div class="space-y-4">
+ <div>
+ <MobileDrawer.Label>Microphone</MobileDrawer.Label>
+ <MobileDrawer.Section>
+ <DeviceDrawerOptions
+ label="Microphone"
+ devices={call.audioInputDevices()}
+ selected={call.activeAudioInputDeviceId() ?? ''}
+ disabled={call.isConnecting()}
+ onSelect={selectMicrophone}
+ />
+ </MobileDrawer.Section>
+ </div>
+ <Show when={'setSinkId' in HTMLMediaElement.prototype}>
+ <div>
+ <MobileDrawer.Label>Speaker</MobileDrawer.Label>
+ <MobileDrawer.Section>
+ <DeviceDrawerOptions
+ label="Speaker"
+ devices={call.audioOutputDevices()}
+ selected={call.activeAudioOutputDeviceId() ?? ''}
+ disabled={call.isConnecting()}
+ onSelect={selectSpeaker}
+ />
+ </MobileDrawer.Section>
+ </div>
+ </Show>
+ <MobileDrawer.Section>
+ <ToggleSwitch
+ size="md"
+ label="Noise suppression"
+ labelClass="order-first flex-1"
+ class="min-h-11 w-full px-3 py-2.5 text-sm"
+ checked={call.isNoiseSuppressed()}
+ disabled={call.isConnecting()}
+ onChange={() => fire(call.toggleNoiseSuppression)}
+ />
+ </MobileDrawer.Section>
+ </div>
+ }
+ videoDrawer={
+ <div class="space-y-4">
+ <div>
+ <MobileDrawer.Label>Camera</MobileDrawer.Label>
+ <MobileDrawer.Section>
+ <DeviceDrawerOptions
+ label="Camera"
+ devices={call.videoInputDevices()}
+ selected={call.activeVideoInputDeviceId() ?? ''}
+ disabled={call.isConnecting()}
+ onSelect={selectCamera}
+ />
+ </MobileDrawer.Section>
+ </div>
+ <div>
+ <MobileDrawer.Label>Background</MobileDrawer.Label>
+ <MobileDrawer.Section role="radiogroup" aria-label="Background">
+ <For
+ each={[
+ { value: 'none', label: 'None' },
+ { value: 'light', label: 'Light blur' },
+ { value: 'heavy', label: 'Strong blur' },
+ ]}
+ >
+ {(option) => (
+ <MobileDrawer.Item
+ role="radio"
+ aria-checked={
+ backgroundChoice(call.backgroundEffect()) ===
+ option.value
+ }
+ disabled={backgroundDisabled()}
+ onClick={() =>
+ fireAndForget(
+ selectBackground(option.value),
+ 'channel-call'
+ )
+ }
+ >
+ <span class="flex-1">{option.label}</span>
+ <SingleSelectCheck
+ active={
+ backgroundChoice(call.backgroundEffect()) ===
+ option.value
+ }
+ />
+ </MobileDrawer.Item>
+ )}
+ </For>
+ <Show when={call.backgroundEffect().type === 'image'}>
+ <MobileDrawer.Item
+ role="radio"
+ aria-checked="true"
+ disabled={backgroundDisabled()}
+ >
+ <Image class="size-4" />
+ <span class="flex-1">Custom image</span>
+ <SingleSelectCheck active />
+ </MobileDrawer.Item>
+ </Show>
+ </MobileDrawer.Section>
+ <MobileDrawer.Section class="mt-2">
+ <MobileDrawer.Item
+ disabled={backgroundDisabled()}
+ onClick={() => upload?.click()}
+ >
+ <Upload class="size-4" />
+ <span>
+ {applyingBackground() ? 'Loading…' : 'Upload image'}
+ </span>
+ </MobileDrawer.Item>
+ </MobileDrawer.Section>
+ </div>
+ </div>
+ }
+ >
+ {props.children}
+ </CallControlBar>
<input
ref={upload}
type="file"
@@ -261,6 +410,40 @@ export function CallMediaControls(props: {
);
}
+function DeviceDrawerOptions(props: {
+ label: string;
+ devices: ReadonlyArray<Pick<MediaDeviceInfo, 'deviceId' | 'label'>>;
+ selected: string;
+ disabled: boolean;
+ onSelect: (id: string) => void;
+}) {
+ const options = () => [
+ { deviceId: '', label: 'System default' },
+ ...props.devices
+ .filter((device) => device.deviceId !== '')
+ .map((device, index) => ({
+ deviceId: device.deviceId,
+ label: device.label || `${props.label} ${index + 1}`,
+ })),
+ ];
+ return (
+ <div role="radiogroup" aria-label={props.label}>
+ <For each={options()}>
+ {(device) => (
+ <MobileDrawer.Item
+ role="radio"
+ aria-checked={props.selected === device.deviceId}
+ disabled={props.disabled}
+ onClick={() => props.onSelect(device.deviceId)}
+ >
+ <span class="min-w-0 flex-1 truncate">{device.label}</span>
+ <SingleSelectCheck active={props.selected === device.deviceId} />
+ </MobileDrawer.Item>
+ )}
+ </For>
+ </div>
+ );
+}
/** One background choice as a small tile; `caption` shortens the visible name. */
function BackgroundTile(props: {
value: BackgroundChoice;
diff --git a/apps/web/src/features/channel/Call/CallControls/CallSettingsMenu.tsx b/apps/web/src/features/channel/Call/CallControls/CallSettingsMenu.tsx
new file mode 100644
index 0000000000..3b3722b872
--- /dev/null
+++ b/apps/web/src/features/channel/Call/CallControls/CallSettingsMenu.tsx
@@ -0,0 +1,59 @@
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { isMobile } from '@core/mobile/isMobile';
+import { type ButtonProps, Dropdown } from '@ui';
+import { type Component, type JSX, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+
+/** Call settings use anchored desktop menus and the shared phone drawer. */
+export function CallSettingsMenu(props: {
+ title: string;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ trigger: Component<ButtonProps>;
+ children: JSX.Element;
+ mobileContent: JSX.Element;
+}) {
+ return (
+ <Show
+ when={isMobile()}
+ fallback={
+ <Dropdown
+ placement="top-start"
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ >
+ <Dropdown.Trigger as={props.trigger} />
+ <Dropdown.Content class="w-80 max-w-[calc(100vw-2rem)]">
+ {props.children}
+ </Dropdown.Content>
+ </Dropdown>
+ }
+ >
+ <MobileDrawer
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ restoreFocus
+ noOutsidePointerEvents
+ >
+ <Dynamic
+ component={props.trigger}
+ aria-haspopup="dialog"
+ aria-expanded={props.open}
+ onClick={() => props.onOpenChange(!props.open)}
+ />
+ <MobileDrawer.Portal>
+ <MobileDrawer.Overlay />
+ <MobileDrawer.Content>
+ <MobileDrawer.Handle />
+ <MobileDrawer.Title class="px-6 pb-3 text-sm font-medium">
+ {props.title}
+ </MobileDrawer.Title>
+ <MobileDrawer.ScrollBody>
+ {props.mobileContent}
+ </MobileDrawer.ScrollBody>
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ </MobileDrawer>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/channel/Call/CallControls/CallSharingMenu.tsx b/apps/web/src/features/channel/Call/CallControls/CallSharingMenu.tsx
new file mode 100644
index 0000000000..47fe158677
--- /dev/null
+++ b/apps/web/src/features/channel/Call/CallControls/CallSharingMenu.tsx
@@ -0,0 +1,139 @@
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { isMobile } from '@core/mobile/isMobile';
+import Lock from '@icon/system/regular/lock-simple.svg';
+import Users from '@icon/system/regular/users-three.svg';
+import { Button, Dropdown, SingleSelectCheck } from '@ui';
+import { createSignal, createUniqueId, For, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import { CallSettingsMenu } from './CallSettingsMenu';
+
+const sharingOptions = [
+ {
+ value: 'team',
+ label: 'Team sharing',
+ description: "Share with the creator's team after the call.",
+ icon: Users,
+ },
+ {
+ value: 'private',
+ label: 'Private',
+ description: 'No automatic team access.',
+ icon: Lock,
+ },
+] as const;
+
+type SharingOption = (typeof sharingOptions)[number];
+
+function SharingOptionContent(props: {
+ option: SharingOption;
+ descriptionId: string;
+ selected: boolean;
+}) {
+ return (
+ <>
+ <Dynamic
+ component={props.option.icon}
+ class="mt-0.5 size-4 shrink-0 self-start"
+ />
+ <div class="min-w-0 flex-1">
+ <span class="block">{props.option.label}</span>
+ <span id={props.descriptionId} class="block text-xs text-ink-muted">
+ {props.option.description}
+ </span>
+ </div>
+ <span class="mt-1 size-3 shrink-0 self-start" aria-hidden="true">
+ <SingleSelectCheck active={props.selected} />
+ </span>
+ </>
+ );
+}
+
+export function CallSharingMenu(props: {
+ sharedWithTeam: boolean;
+ disabled: boolean;
+ onToggle: () => void;
+ onOpenChange: (open: boolean) => void;
+}) {
+ const [open, setOpen] = createSignal(false);
+ const id = createUniqueId();
+ const selected = () => (props.sharedWithTeam ? 'team' : 'private');
+ const label = () =>
+ props.sharedWithTeam
+ ? 'Call sharing: Team sharing'
+ : 'Call sharing: Private';
+ const setMenuOpen = (open: boolean) => {
+ setOpen(open);
+ props.onOpenChange(open);
+ };
+ const select = (value: string) => {
+ if (props.disabled) return;
+ if (value !== selected()) props.onToggle();
+ setMenuOpen(false);
+ };
+
+ return (
+ <CallSettingsMenu
+ title="Call sharing"
+ open={open()}
+ onOpenChange={setMenuOpen}
+ trigger={(triggerProps) => (
+ <Button
+ {...triggerProps}
+ size={isMobile() ? 'icon-md' : 'icon-lg'}
+ aria-label={label()}
+ disabled={props.disabled}
+ tooltip={{ content: label(), placement: 'top', disabled: open() }}
+ >
+ <Show when={props.sharedWithTeam} fallback={<Lock class="size-5" />}>
+ <Users class="size-5" />
+ </Show>
+ </Button>
+ )}
+ mobileContent={
+ <MobileDrawer.Section role="radiogroup" aria-label="Call sharing">
+ <For each={sharingOptions}>
+ {(option) => (
+ <MobileDrawer.Item
+ role="radio"
+ aria-label={option.label}
+ aria-describedby={`${id}-${option.value}`}
+ aria-checked={selected() === option.value}
+ disabled={props.disabled}
+ onClick={() => select(option.value)}
+ >
+ <SharingOptionContent
+ option={option}
+ descriptionId={`${id}-${option.value}`}
+ selected={selected() === option.value}
+ />
+ </MobileDrawer.Item>
+ )}
+ </For>
+ </MobileDrawer.Section>
+ }
+ >
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Call sharing</Dropdown.GroupLabel>
+ <Dropdown.RadioGroup value={selected()} onChange={select}>
+ <For each={sharingOptions}>
+ {(option) => (
+ <Dropdown.RadioItem
+ value={option.value}
+ textValue={option.label}
+ aria-label={option.label}
+ aria-describedby={`${id}-${option.value}`}
+ disabled={props.disabled}
+ >
+ <SharingOptionContent
+ option={option}
+ descriptionId={`${id}-${option.value}`}
+ selected={selected() === option.value}
+ />
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Dropdown.Group>
+ </CallSettingsMenu>
+ );
+}
diff --git a/apps/web/src/features/channel/Call/CallOverlay.tsx b/apps/web/src/features/channel/Call/CallOverlay.tsx
index c118aba686..dd33cfe183 100644
--- a/apps/web/src/features/channel/Call/CallOverlay.tsx
+++ b/apps/web/src/features/channel/Call/CallOverlay.tsx
@@ -1,13 +1,20 @@
-import { useSplitPanel } from '@components/app/split-layout/layoutUtils';
+import { t } from '@app/lib/i18n';
+import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
+import { Resize } from '@core/component/Resize';
+import type { ResizeZoneCtx } from '@core/component/Resize/types';
import { UserIcon } from '@core/component/UserIcon';
import { useAuthor, useUserId } from '@core/context/user';
+import { isMobile } from '@core/mobile/isMobile';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
import { getDisplayName, tryMacroId } from '@core/user';
import { fireAndForget } from '@core/util/fireAndForget';
import ChatIcon from '@icon/system/regular/chat-circle.svg';
-import { cn, InlineCheckbox, Tooltip } from '@ui';
+import UsersIcon from '@icon/system/regular/users.svg';
+import { Button, cn } from '@ui';
import type { RemoteParticipant, Track } from 'livekit-client';
import {
+ createEffect,
createSignal,
createUniqueId,
For,
@@ -18,10 +25,13 @@ import {
} from 'solid-js';
import { useCallContext } from './CallContext';
import { CallControls } from './CallControls/CallControls';
+import { CallSharingMenu } from './CallControls/CallSharingMenu';
+import { CallParticipantsList } from './CallParticipantsList';
import {
- CALL_PANEL_MEDIUM_NARROW_PX,
- CALL_PANEL_VERY_NARROW_PX,
-} from './call-panel-breakpoints';
+ CallChatPanel,
+ type CallPanelTab,
+} from './chat/components/CallChatPanel';
+import { createControlsVisibility } from './create-controls-visibility';
import { LK_TRACK_SOURCE } from './livekit-loader';
import { MutedMicrophoneBadge } from './MutedMicrophoneBadge';
import { ParticipantAvatarBackground } from './ParticipantAvatarBackground';
@@ -53,27 +63,56 @@ function ParticipantTileWrapper(props: {
isSpeaking: boolean;
children: JSXElement;
isConnecting?: boolean;
+ isFocused?: boolean;
+ onToggleFocus?: () => void;
+ focusLabel?: string;
+ hidden?: boolean;
class?: string;
}) {
// Fills its cell, but never wider than 16:9: on a wide panel a full-width
// tile crops a 16:9 camera to a zoomed-in strip. Taller cells (phones,
// grids) still fill, so portrait video keeps the space.
- // The minimum height sits on the cell: size containment ignores content.
+ // Cells can shrink to fit the screen-share strip and picture-in-picture grid.
return (
<div
+ hidden={props.hidden}
class={cn(
- 'flex size-full min-h-30 items-center justify-center [container-type:size]',
+ 'flex size-full min-h-0 items-center justify-center [container-type:size]',
props.class
)}
>
<div
class={cn(
- 'relative flex h-full w-[min(100cqw,calc(100cqh*16/9))] items-center justify-center rounded-lg overflow-hidden bg-panel border border-edge-muted',
- props.isSpeaking && 'ring-inset ring-2 ring-accent',
+ 'relative isolate flex h-full w-[min(100cqw,calc(100cqh*16/9))] items-center justify-center rounded-lg overflow-hidden bg-panel border border-edge-muted',
props.isConnecting && 'animate-pulse'
)}
>
{props.children}
+ <Show when={props.isSpeaking}>
+ <div
+ aria-hidden="true"
+ class="pointer-events-none absolute inset-0 z-20 rounded-[inherit] border-2 border-accent"
+ />
+ </Show>
+ <Show when={props.onToggleFocus}>
+ <button
+ type="button"
+ class="absolute inset-0 z-30 rounded-[inherit] focus-visible:outline-2 focus-visible:-outline-offset-4 focus-visible:outline-accent"
+ aria-label={props.focusLabel}
+ aria-pressed={props.isFocused ?? false}
+ onClick={props.onToggleFocus}
+ />
+ </Show>
+ <Show when={props.isFocused && props.onToggleFocus}>
+ <Button
+ variant="primary"
+ size="sm"
+ class="absolute right-2 top-2 z-40"
+ onClick={props.onToggleFocus}
+ >
+ Back to grid
+ </Button>
+ </Show>
</div>
</div>
);
@@ -139,12 +178,17 @@ function LocalParticipantTile(props: {
fallbackName: string | undefined;
avatarSize?: 'sm' | 'md';
class?: string;
+ isFocused?: boolean;
+ onToggleFocus?: () => void;
}) {
return (
<ParticipantTileWrapper
isSpeaking={props.isSpeaking}
isConnecting={props.isConnecting}
class={props.class}
+ isFocused={props.isFocused}
+ onToggleFocus={props.onToggleFocus}
+ focusLabel={props.isFocused ? 'Unfocus yourself' : 'Focus yourself'}
>
<Show
when={!props.isConnecting && !props.isVideoMuted}
@@ -170,7 +214,13 @@ function LocalParticipantTile(props: {
);
}
-function ParticipantTile(props: { participant: RemoteParticipant }) {
+function ParticipantTile(props: {
+ participant: RemoteParticipant;
+ avatarSize?: 'sm' | 'md';
+ isFocused: boolean;
+ hidden: boolean;
+ onToggleFocus: () => void;
+}) {
const callCtx = useCallContext();
const macroId = () => tryMacroId(props.participant.identity);
const displayName = () =>
@@ -194,11 +244,22 @@ function ParticipantTile(props: { participant: RemoteParticipant }) {
const isSpeaking = () => callCtx.isParticipantSpeaking(props.participant);
return (
- <ParticipantTileWrapper isSpeaking={isSpeaking()}>
+ <ParticipantTileWrapper
+ isSpeaking={isSpeaking()}
+ isFocused={props.isFocused}
+ onToggleFocus={props.onToggleFocus}
+ focusLabel={`${props.isFocused ? 'Unfocus' : 'Focus'} ${displayName()}`}
+ hidden={props.hidden}
+ class={cn('min-w-0', props.hidden && 'hidden')}
+ >
<Show
when={cameraTrack()}
fallback={
- <ParticipantAvatar userId={macroId()} fallbackName={displayName()} />
+ <ParticipantAvatar
+ userId={macroId()}
+ fallbackName={displayName()}
+ avatarSize={props.avatarSize}
+ />
}
>
<TrackView track={cameraTrack()} />
@@ -242,6 +303,8 @@ export function CallOverlay(props: {
localName?: string;
/** The host may hide chat until account or guest session credentials are ready. */
showChat?: boolean;
+ /** Host-owned action aligned to the left of the media controls. */
+ footerLeading?: JSXElement;
/** Narrow RTC credential for a guest; never an account bearer. */
guestChatSession?: { token: string; participantId: string };
}) {
@@ -252,31 +315,92 @@ export function CallOverlay(props: {
const teamShare = useActiveCallTeamShare();
const sharedWithTeam = () =>
props.sharedWithTeam ?? callCtx.isSharedWithTeam();
- const [chatOpen, setChatOpen] = createSignal(false);
- const [chatMounted, setChatMounted] = createSignal(false);
- const chatId = createUniqueId();
- let chatButton: HTMLButtonElement | undefined;
- const closeChat = () => {
- setChatOpen(false);
- chatButton?.focus();
+ const [panelOpen, setPanelOpen] = createSignal(false);
+ const [panelMounted, setPanelMounted] = createSignal(false);
+ const [selectedTab, setSelectedTab] = createSignal<CallPanelTab>('chat');
+ const [focusChatOnOpen, setFocusChatOnOpen] = createSignal(true);
+ const [resizeContext, setResizeContext] = createSignal<ResizeZoneCtx>();
+ const [panelWidth, setPanelWidth] = createSignal(360);
+ const [sidebarMount, setSidebarMount] = createSignal<HTMLDivElement>();
+ const [overlayMount, setOverlayMount] = createSignal<HTMLDivElement>();
+ const widePanel = () => !isMobile() && (resizeContext()?.size() ?? 0) >= 800;
+ const activeTab = () => (canChat() ? selectedTab() : 'participants');
+ const [settingsOpen, setSettingsOpen] = createSignal(false);
+ const [sharingOpen, setSharingOpen] = createSignal(false);
+ const [keyboardFocus, setKeyboardFocus] = createSignal(false);
+ const controls = createControlsVisibility({
+ // Keep controls visible until idle hiding is reintroduced.
+ enabled: () => false,
+ keepVisible: () =>
+ panelOpen() ||
+ settingsOpen() ||
+ sharingOpen() ||
+ keyboardFocus() ||
+ virtualKeyboardVisible(),
+ });
+ const controlsHidden = () => isMobile() && !controls.visible();
+ const panelId = createUniqueId();
+ let panelButton: HTMLButtonElement | undefined;
+ const closePanel = () => {
+ setPanelOpen(false);
+ panelButton?.focus();
};
- const toggleChat = () => {
- if (chatOpen()) return closeChat();
- setChatMounted(true);
- setChatOpen(true);
+ const togglePanel = () => {
+ if (panelOpen()) return closePanel();
+ setFocusChatOnOpen(true);
+ setPanelMounted(true);
+ setPanelOpen(true);
};
const canChat = () => props.showChat !== false && !!callCtx.activeCallId();
+ const canShareWithTeam = () =>
+ callCtx.activeChannelId() !== null && props.showTeamSharing !== false;
const teamShareLocked = () =>
isConnecting() || !teamShare.canToggle() || teamShare.isPending();
- const splitPanel = useSplitPanel();
- const panelWidth = () => splitPanel?.panelSize.width ?? Infinity;
- const isMediumNarrow = () => panelWidth() < CALL_PANEL_MEDIUM_NARROW_PX;
- const isVeryNarrow = () => panelWidth() < CALL_PANEL_VERY_NARROW_PX;
+ const PanelToggle = () => (
+ <Button
+ ref={panelButton}
+ variant="secondary"
+ size={isMobile() ? 'icon-xl' : 'icon-lg'}
+ aria-label={panelOpen() ? t('calls.closePanel') : t('calls.openPanel')}
+ tooltip={{
+ content: panelOpen() ? t('calls.closePanel') : t('calls.openPanel'),
+ placement: 'top',
+ }}
+ aria-expanded={panelOpen()}
+ aria-controls={panelId}
+ onClick={togglePanel}
+ >
+ <Show
+ when={canChat()}
+ fallback={<UsersIcon class="size-4 mobile:size-6" />}
+ >
+ <ChatIcon class="size-4 mobile:size-6" />
+ </Show>
+ </Button>
+ );
const participants = () =>
Array.from(callCtx.remoteParticipants().values()).filter((p) => !p.isAgent);
+ const [selectedParticipant, setSelectedParticipant] = createSignal<
+ RemoteParticipant | 'local'
+ >();
+ createEffect(() => {
+ if (participants().length === 0) setSelectedParticipant(undefined);
+ });
+ const focusedParticipant = () => {
+ const selected = selectedParticipant();
+ return selected === 'local' ||
+ (selected && participants().includes(selected))
+ ? selected
+ : undefined;
+ };
+ const toggleParticipantFocus = (participant: RemoteParticipant | 'local') =>
+ setSelectedParticipant((selected) =>
+ selected === participant ? undefined : participant
+ );
+
const isLocalSpeaking = () => callCtx.isLocalSpeaking();
const localUserId = () => {
@@ -317,6 +441,8 @@ export function CallOverlay(props: {
callCtx.isScreenSharing() || remoteScreenShares().length > 0;
const gridCols = () => {
+ if (focusedParticipant() && focusedParticipant() !== 'local')
+ return 'grid-cols-1';
const count = participants().length;
if (count <= 1) return 'grid-cols-1';
if (count <= 4) return 'grid-cols-2';
@@ -324,194 +450,261 @@ export function CallOverlay(props: {
};
return (
- <div class="flex flex-col h-full min-h-0 @container/call touch:pb-(--mobile-content-inset-bottom)">
- <div class="relative flex min-h-0 flex-1 overflow-hidden">
- <div class="flex min-w-0 flex-1 flex-col">
- {/* Screen share area */}
- <Show when={hasAnyScreenShare()}>
- <div class="flex-1 min-h-0 pt-2">
- <div class="h-full rounded-lg overflow-hidden bg-surface-2 flex items-center justify-center">
- <Show when={callCtx.isScreenSharing()}>
- <div class="relative size-full">
- <TrackView track={localScreenTrack()} fit="contain" />
-
- <VideoTag>Your screen</VideoTag>
+ <div
+ class="relative flex h-full min-h-0 flex-col @container/call touch:pt-[var(--mobile-content-inset-top,0px)] touch:pb-(--mobile-content-inset-bottom) mobile:pb-0"
+ data-call-fullscreen={isMobile() ? '' : undefined}
+ onPointerDown={() => {
+ setKeyboardFocus(false);
+ controls.reveal();
+ }}
+ onKeyDown={() => {
+ setKeyboardFocus(true);
+ controls.reveal();
+ }}
+ onFocusIn={(event) => {
+ if (
+ event.target instanceof HTMLElement &&
+ event.target.matches(':focus-visible')
+ ) {
+ setKeyboardFocus(true);
+ }
+ }}
+ onFocusOut={(event) => {
+ if (
+ !(event.relatedTarget instanceof Node) ||
+ !event.currentTarget.contains(event.relatedTarget)
+ )
+ setKeyboardFocus(false);
+ }}
+ >
+ {/* The call owns its controls instead of the mobile New action. */}
+ <FloatRegion region="accessory" />
+ <FloatRegion region="dock" priority={100} active={isMobile} />
+ <div
+ ref={setOverlayMount}
+ class="relative min-h-0 flex-1 overflow-hidden"
+ >
+ <Resize.Zone
+ direction="horizontal"
+ gutter={12}
+ showDividers={false}
+ captureResizeCtx={setResizeContext}
+ class={cn(
+ // Hidden resize panels reset their left offset; keep chat at the right edge.
+ '[&>[data-resize-panel]:has(>[data-call-sidebar])]:left-auto! [&>[data-resize-panel]:has(>[data-call-sidebar])]:right-0',
+ !isMobile() &&
+ panelMounted() && [
+ '[&>[data-resize-panel]]:transition-[width] [&>[data-resize-panel]]:duration-200 [&>[data-resize-panel]]:ease-out [&>[data-resize-panel]]:motion-reduce:transition-none',
+ '[&>[role=separator]]:transition-[left] [&>[role=separator]]:duration-200 [&>[role=separator]]:ease-out [&>[role=separator]]:motion-reduce:transition-none',
+ '[&:has(>[role=separator]:active)>*]:transition-none',
+ ]
+ )}
+ >
+ <Resize.Panel id="call-stage" minSize={widePanel() ? 320 : 0}>
+ <div class="flex h-full min-h-0 min-w-0 flex-col @container/call-stage">
+ {/* Screen share area */}
+ <Show when={hasAnyScreenShare()}>
+ <div
+ class="flex-1 min-h-0 pt-2"
+ classList={{ hidden: !!focusedParticipant() }}
+ >
+ <div class="h-full rounded-lg overflow-hidden bg-surface-2 flex items-center justify-center">
+ <Show when={callCtx.isScreenSharing()}>
+ <div class="relative size-full">
+ <TrackView track={localScreenTrack()} fit="contain" />
+
+ <VideoTag>Your screen</VideoTag>
+ </div>
+ </Show>
+ <For each={remoteScreenShares()}>
+ {(participant) => (
+ <ScreenShareTile participant={participant} />
+ )}
+ </For>
</div>
- </Show>
- <For each={remoteScreenShares()}>
- {(participant) => (
- <ScreenShareTile participant={participant} />
- )}
- </For>
- </div>
- </div>
- </Show>
+ </div>
+ </Show>
- {/* Participants area */}
- <div
- class={`${hasAnyScreenShare() ? 'h-45 shrink-0' : 'flex-1 min-h-0'} relative pt-2`}
- >
- <Show
- when={participants().length > 0}
- fallback={
- <LocalParticipantTile
- isSpeaking={isLocalSpeaking()}
- isConnecting={isConnecting()}
- isAudioMuted={callCtx.isAudioMuted()}
- isVideoMuted={callCtx.isVideoMuted()}
- track={localVideoTrack()}
- userId={localUserId()}
- fallbackName={
- props.localName ||
- callCtx.room()?.localParticipant.name ||
- currentUserName()
- }
- />
- }
- >
- {/* Remote participants grid */}
+ {/* Participants area */}
<div
- class={`size-full grid ${gridCols()} gap-2 auto-rows-fr overflow-hidden`}
+ class={`${hasAnyScreenShare() && !focusedParticipant() ? 'h-45 shrink-0' : 'flex-1 min-h-0'} relative pt-2 mobile:pt-0`}
>
- <For each={participants()}>
- {(participant) => (
- <ParticipantTile participant={participant} />
- )}
- </For>
- </div>
-
- {/* Local participant PIP (Google Meet style: small, bottom-right) */}
- <div class="absolute bottom-4 right-4 w-40 aspect-video shadow-lg z-10 sm:w-48">
- <LocalParticipantTile
- class="min-h-0"
- isSpeaking={isLocalSpeaking()}
- isConnecting={isConnecting()}
- isAudioMuted={callCtx.isAudioMuted()}
- isVideoMuted={callCtx.isVideoMuted()}
- track={localVideoTrack()}
- userId={localUserId()}
- fallbackName={
- props.localName ||
- callCtx.room()?.localParticipant.name ||
- currentUserName()
- }
- avatarSize="sm"
- />
- </div>
- </Show>
- </div>
- </div>
- <Show when={canChat() && chatMounted()}>
- <Show when={callCtx.activeCallId()} keyed>
- {(callId) => (
- <Suspense>
<Show
- when={props.guestChatSession}
- keyed
+ when={participants().length > 0}
fallback={
- <CallChat
- callId={callId}
- id={chatId}
- open={chatOpen()}
- onClose={closeChat}
+ <LocalParticipantTile
+ class="size-full"
+ isSpeaking={isLocalSpeaking()}
+ isConnecting={isConnecting()}
+ isAudioMuted={callCtx.isAudioMuted()}
+ isVideoMuted={callCtx.isVideoMuted()}
+ track={localVideoTrack()}
+ userId={localUserId()}
+ fallbackName={
+ props.localName ||
+ callCtx.room()?.localParticipant.name ||
+ currentUserName()
+ }
+ isFocused={focusedParticipant() === 'local'}
/>
}
>
- {(session) => (
- <GuestCallChat
- callId={callId}
- session={session}
- id={chatId}
- open={chatOpen()}
- onClose={closeChat}
+ {/* Remote participants grid */}
+ <div
+ class={cn(
+ `grid ${gridCols()} gap-2 auto-rows-fr overflow-hidden`,
+ focusedParticipant() === 'local'
+ ? 'absolute bottom-4 right-4 z-20 w-40 aspect-video shadow-lg sm:w-48'
+ : 'size-full'
+ )}
+ >
+ <For each={participants()}>
+ {(participant) => (
+ <ParticipantTile
+ participant={participant}
+ avatarSize={
+ focusedParticipant() === 'local' ? 'sm' : 'md'
+ }
+ isFocused={focusedParticipant() === participant}
+ hidden={
+ !!focusedParticipant() &&
+ focusedParticipant() !== 'local' &&
+ focusedParticipant() !== participant
+ }
+ onToggleFocus={() =>
+ toggleParticipantFocus(participant)
+ }
+ />
+ )}
+ </For>
+ </div>
+
+ {/* Local participant PIP (Google Meet style: small, bottom-right) */}
+ <div
+ class={cn(
+ 'absolute z-10',
+ focusedParticipant() === 'local'
+ ? 'inset-0'
+ : 'bottom-4 right-4 w-40 aspect-video shadow-lg sm:w-48'
+ )}
+ >
+ <LocalParticipantTile
+ class="size-full min-h-0"
+ isSpeaking={isLocalSpeaking()}
+ isConnecting={isConnecting()}
+ isAudioMuted={callCtx.isAudioMuted()}
+ isVideoMuted={callCtx.isVideoMuted()}
+ track={localVideoTrack()}
+ userId={localUserId()}
+ fallbackName={
+ props.localName ||
+ callCtx.room()?.localParticipant.name ||
+ currentUserName()
+ }
+ avatarSize="sm"
+ isFocused={focusedParticipant() === 'local'}
+ onToggleFocus={() => toggleParticipantFocus('local')}
/>
- )}
+ </div>
</Show>
- </Suspense>
- )}
- </Show>
- </Show>
- </div>
- {/* Settings expand over the tiles; sharing stays clear of the controls.
- On desktop the bar (and the chat composer beside it) is the call's
- last row, where the corner prompt sits, so the prompt waits. */}
- <div
- class="relative flex shrink-0 flex-col items-center gap-2 py-3"
- data-holds-prompts={isTouchDevice() ? undefined : ''}
- classList={{
- '@min-[800px]/call:mr-90': canChat() && chatOpen(),
- }}
- >
- <Show
- when={
- callCtx.activeChannelId() !== null &&
- props.showTeamSharing !== false &&
- !isVeryNarrow()
- }
- >
- <Tooltip
- placement="top"
- label={
- sharedWithTeam()
- ? "The creator's team can view the chat, transcript, and AI summary once the call ends"
- : "Let the creator's team view the chat, transcript, and AI summary once the call ends"
- }
+ </div>
+ {/* Settings expand over the tiles; the chat keeps its own full-height column. */}
+ <div
+ class="relative flex shrink-0 flex-col items-center gap-2 py-3 mobile:pb-[calc(var(--safe-bottom,0px)+12px)] transition-opacity duration-200 motion-reduce:transition-none"
+ classList={{
+ 'opacity-0 invisible pointer-events-none': controlsHidden(),
+ }}
+ inert={controlsHidden()}
+ data-holds-prompts={isTouchDevice() ? undefined : ''}
+ >
+ <div class="grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 mobile:grid-cols-[minmax(0,1fr)_auto] mobile:px-[max(16px,var(--mobile-chrome-gutter))] mobile:@max-[26rem]/call-stage:grid-cols-1 mobile:@max-[21rem]/call-stage:gap-1 @3xl/call-stage:grid-cols-[minmax(0,1fr)_minmax(18rem,2fr)_minmax(0,1fr)]">
+ <div class="min-w-0 max-w-48 mobile:hidden">
+ {props.footerLeading}
+ </div>
+ <div class="flex min-w-0 justify-center">
+ <CallControls
+ onLeave={props.onLeave}
+ onSettingsOpenChange={setSettingsOpen}
+ >
+ <Show when={canShareWithTeam()}>
+ <CallSharingMenu
+ sharedWithTeam={sharedWithTeam()}
+ disabled={teamShareLocked()}
+ onToggle={() =>
+ fireAndForget(teamShare.toggle(), 'channel-call')
+ }
+ onOpenChange={setSharingOpen}
+ />
+ </Show>
+ </CallControls>
+ </div>
+ <div class="flex justify-end">
+ <PanelToggle />
+ </div>
+ </div>
+ </div>
+ </div>
+ </Resize.Panel>
+ <Resize.Panel
+ id="call-sidebar"
+ minSize={280}
+ maxSize={480}
+ target={{ kind: 'px', px: 360 }}
+ redistributionPreferredSize={panelWidth()}
+ onSizeChangeEnd={setPanelWidth}
+ hidden={() => !widePanel() || !panelOpen()}
+ persistent
>
- <button
- type="button"
- onClick={() => fireAndForget(teamShare.toggle(), 'channel-call')}
- disabled={teamShareLocked()}
- role="checkbox"
- aria-checked={sharedWithTeam()}
- class={cn(
- 'order-1 inline-flex items-center gap-2 rounded-md h-7 px-2.5 text-xs select-none',
- 'border border-ink-muted/[0.08] bg-ink-muted/[0.025]',
- 'text-ink-muted/70 hover:text-ink hover:bg-ink-muted/[0.06]',
- sharedWithTeam() && 'text-ink',
- teamShareLocked() && 'pointer-events-none opacity-50'
+ <div ref={setSidebarMount} data-call-sidebar class="h-full py-2" />
+ </Resize.Panel>
+ </Resize.Zone>
+ <Show when={panelMounted()}>
+ <CallChatPanel
+ id={panelId}
+ open={panelOpen()}
+ onClose={closePanel}
+ activeTab={activeTab()}
+ onTabChange={(tab) => {
+ setFocusChatOnOpen(false);
+ setSelectedTab(tab);
+ }}
+ chatAvailable={canChat()}
+ participantCount={participants().length + 1}
+ participants={<CallParticipantsList localName={props.localName} />}
+ sidebarMount={widePanel() ? sidebarMount() : undefined}
+ overlayMount={overlayMount()}
+ returnFocus={panelButton}
+ >
+ <Show when={canChat() && callCtx.activeCallId()} keyed>
+ {(callId) => (
+ <Suspense>
+ <Show
+ when={props.guestChatSession}
+ keyed
+ fallback={
+ <CallChat
+ callId={callId}
+ open={panelOpen() && activeTab() === 'chat'}
+ focusOnOpen={focusChatOnOpen()}
+ onClose={closePanel}
+ />
+ }
+ >
+ {(session) => (
+ <GuestCallChat
+ callId={callId}
+ session={session}
+ open={panelOpen() && activeTab() === 'chat'}
+ focusOnOpen={focusChatOnOpen()}
+ onClose={closePanel}
+ />
+ )}
+ </Show>
+ </Suspense>
)}
- >
- <InlineCheckbox checked={sharedWithTeam()} />
- <Show when={!isMediumNarrow()}>
- <span class="whitespace-nowrap">Share with team</span>
- </Show>
- </button>
- </Tooltip>
+ </Show>
+ </CallChatPanel>
</Show>
- <div
- class="grid w-full items-center gap-2 px-2"
- classList={{
- 'grid-cols-[minmax(3.5rem,1fr)_minmax(0,36rem)_minmax(3.5rem,1fr)] @max-[500px]/call:grid-cols-[minmax(0,1fr)_auto]':
- canChat(),
- 'grid-cols-[minmax(0,1fr)_minmax(0,36rem)_minmax(0,1fr)]':
- !canChat(),
- }}
- >
- <div
- class="col-start-2 flex min-w-0 justify-center"
- classList={{ '@max-[500px]/call:col-start-1': canChat() }}
- >
- <CallControls onLeave={props.onLeave} />
- </div>
- <Show when={canChat()}>
- <div class="justify-self-end rounded-xl border border-edge-muted bg-panel p-1.5 shadow-sm">
- <Tooltip label={chatOpen() ? 'Close chat' : 'Open chat'}>
- <button
- ref={chatButton}
- type="button"
- aria-label={chatOpen() ? 'Close chat' : 'Open chat'}
- aria-expanded={chatOpen()}
- aria-controls={chatId}
- onClick={toggleChat}
- class="flex size-10 items-center justify-center rounded-lg hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent @min-[500px]/call:size-12"
- classList={{ 'bg-hover text-accent': chatOpen() }}
- >
- <ChatIcon class="size-5" />
- </button>
- </Tooltip>
- </div>
- </Show>
- </div>
</div>
</div>
);
diff --git a/apps/web/src/features/channel/Call/CallParticipantsList.tsx b/apps/web/src/features/channel/Call/CallParticipantsList.tsx
new file mode 100644
index 0000000000..e1caa541bb
--- /dev/null
+++ b/apps/web/src/features/channel/Call/CallParticipantsList.tsx
@@ -0,0 +1,142 @@
+import { t } from '@app/lib/i18n';
+import { UserIcon } from '@core/component/UserIcon';
+import { useAuthor, useUserId } from '@core/context/user';
+import { getDisplayName, tryMacroId } from '@core/user';
+import Microphone from '@icon/system/regular/microphone.svg';
+import MicrophoneSlash from '@icon/system/regular/microphone-slash.svg';
+import VideoCamera from '@icon/system/regular/video-camera.svg';
+import VideoCameraSlash from '@icon/system/regular/video-camera-slash.svg';
+import { Avatar, cn } from '@ui';
+import type { RemoteParticipant } from 'livekit-client';
+import { createMemo, For, Show } from 'solid-js';
+import { useCallContext } from './CallContext';
+import { LK_TRACK_SOURCE } from './livekit-loader';
+
+function ParticipantRow(props: {
+ name: string;
+ userId?: string;
+ local?: boolean;
+ speaking: boolean;
+ muted: boolean;
+ videoEnabled: boolean;
+}) {
+ return (
+ <li class="flex min-h-14 items-center gap-3 px-3 py-2">
+ <div class="size-8 shrink-0">
+ <Show
+ when={props.userId}
+ fallback={
+ <Avatar size="fill">
+ <Avatar.Fallback>
+ {props.name.charAt(0).toUpperCase()}
+ </Avatar.Fallback>
+ </Avatar>
+ }
+ >
+ {(id) => <UserIcon id={id()} size="fill" suppressClick />}
+ </Show>
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="truncate text-sm" title={props.name}>
+ {props.local
+ ? t('calls.localParticipant', { name: props.name })
+ : props.name}
+ </p>
+ <Show when={props.speaking}>
+ <p class="text-xs text-accent">{t('calls.speaking')}</p>
+ </Show>
+ </div>
+ <span
+ class={cn('shrink-0', props.muted ? 'text-failure' : 'text-ink-muted')}
+ role="img"
+ aria-label={
+ props.muted ? t('calls.microphoneOff') : t('calls.microphoneOn')
+ }
+ >
+ <Show when={props.muted} fallback={<Microphone class="size-4" />}>
+ <MicrophoneSlash class="size-4" />
+ </Show>
+ </span>
+ <span
+ class={cn(
+ 'shrink-0',
+ props.videoEnabled ? 'text-ink-muted' : 'text-failure'
+ )}
+ role="img"
+ aria-label={
+ props.videoEnabled ? t('calls.cameraOn') : t('calls.cameraOff')
+ }
+ >
+ <Show
+ when={props.videoEnabled}
+ fallback={<VideoCameraSlash class="size-4" />}
+ >
+ <VideoCamera class="size-4" />
+ </Show>
+ </span>
+ </li>
+ );
+}
+
+function RemoteParticipantRow(props: { participant: RemoteParticipant }) {
+ const call = useCallContext();
+ const userId = () => tryMacroId(props.participant.identity);
+ const name = () =>
+ props.participant.name?.trim() ||
+ (userId() ? getDisplayName(userId()) : t('calls.guest'));
+ const publication = (
+ source: typeof LK_TRACK_SOURCE.Camera | typeof LK_TRACK_SOURCE.Microphone
+ ) => {
+ call.trackVersion();
+ return props.participant.getTrackPublication(source);
+ };
+ return (
+ <ParticipantRow
+ name={name()}
+ userId={userId()}
+ speaking={call.isParticipantSpeaking(props.participant)}
+ muted={publication(LK_TRACK_SOURCE.Microphone)?.isMuted ?? true}
+ videoEnabled={publication(LK_TRACK_SOURCE.Camera)?.isMuted === false}
+ />
+ );
+}
+
+/** Shows current human attendees from the live room, not channel membership. */
+export function CallParticipantsList(props: { localName?: string }) {
+ const call = useCallContext();
+ const author = useAuthor();
+ const currentUserId = useUserId();
+ const participants = createMemo(() =>
+ Array.from(call.remoteParticipants().values()).filter(
+ (participant) => !participant.isAgent
+ )
+ );
+ const localName = () =>
+ props.localName?.trim() ||
+ call.room()?.localParticipant.name?.trim() ||
+ author() ||
+ t('calls.you');
+ const localUserId = () => {
+ call.connectionState();
+ call.trackVersion();
+ return (
+ tryMacroId(call.room()?.localParticipant.identity ?? '') ??
+ tryMacroId(currentUserId() ?? '')
+ );
+ };
+ return (
+ <ul aria-label={t('calls.inCallParticipants')} class="ph-no-capture">
+ <ParticipantRow
+ name={localName()}
+ userId={localUserId()}
+ local
+ speaking={call.isLocalSpeaking()}
+ muted={call.isAudioMuted()}
+ videoEnabled={!call.isVideoMuted()}
+ />
+ <For each={participants()}>
+ {(participant) => <RemoteParticipantRow participant={participant} />}
+ </For>
+ </ul>
+ );
+}
diff --git a/apps/web/src/features/channel/Call/ChannelCallTab.tsx b/apps/web/src/features/channel/Call/ChannelCallTab.tsx
index ab56afef75..dbf378f882 100644
--- a/apps/web/src/features/channel/Call/ChannelCallTab.tsx
+++ b/apps/web/src/features/channel/Call/ChannelCallTab.tsx
@@ -1,5 +1,7 @@
import { useChannelTab } from '@channel/Channel/ChannelTabContext';
+import { SplitHeaderRight } from '@components/app/split-layout/components/SplitHeader';
import { UserGroup } from '@core/component/UserGroup';
+import { isMobile } from '@core/mobile/isMobile';
import { getDisplayName, tryMacroId } from '@core/user';
import PhoneIcon from '@icon/system/regular/phone-call.svg';
import { Telemetry } from '@macro-inc/observability';
@@ -147,13 +149,20 @@ export function ChannelCallTab(props: {
}
>
<Match when={call.isInThisChannel() && !call.joinError()}>
- <div class="flex size-full min-h-0 flex-col">
- <div class="px-2 pt-2">
- <ActiveCallLink />
- </div>
- <div class="min-h-0 flex-1">
- <CallOverlay onLeave={handleLeave} />
- </div>
+ <div class="size-full min-h-0">
+ <Show when={isMobile()}>
+ <SplitHeaderRight>
+ <ActiveCallLink />
+ </SplitHeaderRight>
+ </Show>
+ <CallOverlay
+ onLeave={handleLeave}
+ footerLeading={
+ <Show when={!isMobile()}>
+ <ActiveCallLink />
+ </Show>
+ }
+ />
</div>
</Match>
<Match when={call.joinError()}>
diff --git a/apps/web/src/features/channel/Call/chat/CallChat.test.tsx b/apps/web/src/features/channel/Call/chat/CallChat.test.tsx
index 5b40038803..e67e7375de 100644
--- a/apps/web/src/features/channel/Call/chat/CallChat.test.tsx
+++ b/apps/web/src/features/channel/Call/chat/CallChat.test.tsx
@@ -5,7 +5,7 @@ import { MessageReferenceNavigation } from '@core/messages/message-reference-nav
import type { MessageActionHandler } from '@core/messages/types';
import type { MessageListItem, MessageThread } from '@service-storage/messages';
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { type JSX, useContext } from 'solid-js';
+import { createSignal, type JSX, useContext } from 'solid-js';
import { afterEach, expect, it, vi } from 'vitest';
import CallChat from './CallChat';
@@ -16,6 +16,7 @@ const mocks = vi.hoisted(() => ({
snapshot: vi.fn(),
send: vi.fn().mockResolvedValue(undefined),
refresh: vi.fn(),
+ focus: vi.fn(),
}));
vi.mock('./queries/use-call-chat', () => ({ useCallChat: () => mocks.source }));
vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user-id' }));
@@ -29,7 +30,7 @@ vi.mock('@channel/Input', () => ({
const handle: InputHandle = {
snapshot: mocks.snapshot,
clear: vi.fn(),
- focus: vi.fn(),
+ focus: mocks.focus,
send: vi.fn(),
attachFiles: vi.fn(),
restoreSnapshot: mocks.restore,
@@ -38,8 +39,8 @@ vi.mock('@channel/Input', () => ({
return <div data-testid="call-composer" />;
},
}));
-vi.mock('./components/CallChatPanel', () => ({
- CallChatPanel: (props: { children: JSX.Element; composer: JSX.Element }) => (
+vi.mock('./components/CallChatBody', () => ({
+ CallChatBody: (props: { children: JSX.Element; composer: JSX.Element }) => (
<>
{props.children}
{props.composer}
@@ -114,9 +115,7 @@ it.each(['user-id', 'another-user'])(
failed: () => false,
refresh: mocks.refresh,
};
- render(() => (
- <CallChat callId="call-id" id="chat" open onClose={() => {}} />
- ));
+ render(() => <CallChat callId="call-id" open onClose={() => {}} />);
const draft: InputSnapshot = {
value: 'Existing draft',
mentions: [{ itemType: 'user', itemId: 'bot|owned-agent' }],
@@ -160,3 +159,30 @@ it.each(['user-id', 'another-user'])(
);
}
);
+
+it('only autofocuses when the panel opens, not when a tab becomes visible', () => {
+ mocks.source = {
+ thread: () => undefined,
+ parent: () => ({ type: 'call', id: 'call-id' }),
+ empty: () => true,
+ loading: () => false,
+ failed: () => false,
+ refresh: mocks.refresh,
+ };
+ const [open, setOpen] = createSignal(false);
+ const [focusOnOpen, setFocusOnOpen] = createSignal(false);
+ render(() => (
+ <CallChat
+ callId="call-id"
+ open={open()}
+ focusOnOpen={focusOnOpen()}
+ onClose={() => {}}
+ />
+ ));
+ setOpen(true);
+ expect(mocks.focus).not.toHaveBeenCalled();
+ setOpen(false);
+ setFocusOnOpen(true);
+ setOpen(true);
+ expect(mocks.focus).toHaveBeenCalledOnce();
+});
diff --git a/apps/web/src/features/channel/Call/chat/CallChat.tsx b/apps/web/src/features/channel/Call/chat/CallChat.tsx
index cb8f826b99..990280ca2b 100644
--- a/apps/web/src/features/channel/Call/chat/CallChat.tsx
+++ b/apps/web/src/features/channel/Call/chat/CallChat.tsx
@@ -23,24 +23,24 @@ import {
Suspense,
} from 'solid-js';
import { buildCallMessageLink } from './build-call-message-link';
-import { CallChatPanel } from './components/CallChatPanel';
+import { CallChatBody } from './components/CallChatBody';
import { useCallChat } from './queries/use-call-chat';
export default function CallChat(props: {
callId: string;
- id: string;
open: boolean;
+ focusOnOpen?: boolean;
onClose: () => void;
}) {
// Queries and all shared Markdown descendants stay within the chat boundary.
return (
<Suspense
fallback={
- <CallChatPanel {...props} composer={null}>
+ <CallChatBody open={props.open} composer={null}>
<p role="status" class="text-sm text-ink-muted">
Loading chat…
</p>
- </CallChatPanel>
+ </CallChatBody>
}
>
<CallChatContent {...props} />
@@ -50,8 +50,8 @@ export default function CallChat(props: {
function CallChatContent(props: {
callId: string;
- id: string;
open: boolean;
+ focusOnOpen?: boolean;
onClose: () => void;
}) {
const chat = useCallChat(() => props.callId);
@@ -67,7 +67,11 @@ function CallChatContent(props: {
createEffect(
on([() => props.open, canSend, input], ([open, ready, handle]) => {
- if (open && ready) handle?.focus();
+ if (open && ready && props.focusOnOpen !== false) {
+ handle?.focus({
+ when: () => props.open && props.focusOnOpen !== false,
+ });
+ }
})
);
@@ -107,10 +111,8 @@ function CallChatContent(props: {
}}
>
<StaticMarkdownContext>
- <CallChatPanel
- id={props.id}
+ <CallChatBody
open={props.open}
- onClose={props.onClose}
composer={
<div inert={!canSend()} classList={{ 'opacity-50': !canSend() }}>
<Show when={sendFailed()}>
@@ -190,7 +192,7 @@ function CallChatContent(props: {
/>
)}
</Show>
- </CallChatPanel>
+ </CallChatBody>
</StaticMarkdownContext>
</MessageReferenceNavigation.Provider>
);
diff --git a/apps/web/src/features/channel/Call/chat/GuestCallChat.test.tsx b/apps/web/src/features/channel/Call/chat/GuestCallChat.test.tsx
index 994c71a469..162bf3ac2a 100644
--- a/apps/web/src/features/channel/Call/chat/GuestCallChat.test.tsx
+++ b/apps/web/src/features/channel/Call/chat/GuestCallChat.test.tsx
@@ -38,8 +38,8 @@ vi.mock('./queries/use-guest-call-chat', () => ({
refresh: mocks.refresh,
}),
}));
-vi.mock('./components/CallChatPanel', () => ({
- CallChatPanel: (props: {
+vi.mock('./components/CallChatBody', () => ({
+ CallChatBody: (props: {
open: boolean;
children: JSX.Element;
composer: JSX.Element;
@@ -63,7 +63,6 @@ it('reads member messages, keeps drafts on close, and retries the same submissio
<GuestCallChat
callId="call"
session={{ token: 'token', participantId: 'guest' }}
- id="chat"
open={open()}
onClose={() => setOpen(false)}
/>
@@ -93,7 +92,6 @@ it('does not submit Shift+Enter or composition Enter', () => {
<GuestCallChat
callId="call"
session={{ token: 'token', participantId: 'guest' }}
- id="chat"
open
onClose={() => {}}
/>
@@ -111,7 +109,6 @@ it('keeps Enter for newlines on touch and sends with the button', async () => {
<GuestCallChat
callId="call"
session={{ token: 'token', participantId: 'guest' }}
- id="chat"
open
onClose={() => {}}
/>
@@ -124,3 +121,28 @@ it('keeps Enter for newlines on touch and sends with the button', async () => {
fireEvent.click(screen.getByRole('button', { name: 'Send' }));
await waitFor(() => expect(mocks.send).toHaveBeenCalledOnce());
});
+
+it('only autofocuses when the panel opens, not when a tab becomes visible', () => {
+ const [open, setOpen] = createSignal(false);
+ const [focusOnOpen, setFocusOnOpen] = createSignal(false);
+ render(() => (
+ <>
+ <button>Selected tab</button>
+ <GuestCallChat
+ callId="call"
+ session={{ token: 'token', participantId: 'guest' }}
+ open={open()}
+ focusOnOpen={focusOnOpen()}
+ onClose={() => {}}
+ />
+ </>
+ ));
+ const tab = screen.getByRole('button', { name: 'Selected tab' });
+ tab.focus();
+ setOpen(true);
+ expect(document.activeElement).toBe(tab);
+ setOpen(false);
+ setFocusOnOpen(true);
+ setOpen(true);
+ expect(document.activeElement).toBe(screen.getByRole('textbox'));
+});
diff --git a/apps/web/src/features/channel/Call/chat/GuestCallChat.tsx b/apps/web/src/features/channel/Call/chat/GuestCallChat.tsx
index 54f8a0d52a..75cd878bc4 100644
--- a/apps/web/src/features/channel/Call/chat/GuestCallChat.tsx
+++ b/apps/web/src/features/channel/Call/chat/GuestCallChat.tsx
@@ -3,14 +3,14 @@ import { fireAndForget } from '@core/util/fireAndForget';
import { Button, TextField } from '@ui';
import { createEffect, createSignal, For, on, Show, Suspense } from 'solid-js';
import { v7 as newMessageId } from 'uuid';
-import { CallChatPanel } from './components/CallChatPanel';
+import { CallChatBody } from './components/CallChatBody';
import { useGuestCallChat } from './queries/use-guest-call-chat';
type GuestCallChatProps = {
callId: string;
session: { token: string; participantId: string };
- id: string;
open: boolean;
+ focusOnOpen?: boolean;
onClose: () => void;
};
@@ -34,7 +34,8 @@ function GuestCallChatContent(props: GuestCallChatProps) {
let input!: HTMLTextAreaElement;
createEffect(
on([() => props.open, chat.ready], ([open, ready]) => {
- if (open && ready && !isTouchDevice()) input?.focus();
+ if (open && ready && props.focusOnOpen !== false && !isTouchDevice())
+ input?.focus();
})
);
@@ -55,8 +56,8 @@ function GuestCallChatContent(props: GuestCallChatProps) {
}
return (
- <CallChatPanel
- {...props}
+ <CallChatBody
+ open={props.open}
composer={
<form
onSubmit={(event) => {
@@ -142,6 +143,6 @@ function GuestCallChatContent(props: GuestCallChatProps) {
</div>
)}
</For>
- </CallChatPanel>
+ </CallChatBody>
);
}
diff --git a/apps/web/src/features/channel/Call/chat/components/CallChatBody.tsx b/apps/web/src/features/channel/Call/chat/components/CallChatBody.tsx
new file mode 100644
index 0000000000..0e2c1fba20
--- /dev/null
+++ b/apps/web/src/features/channel/Call/chat/components/CallChatBody.tsx
@@ -0,0 +1,51 @@
+import { isMobile } from '@core/mobile/isMobile';
+import { createEffect, type JSX, on, onCleanup, onMount } from 'solid-js';
+
+/** Keep the message history and composer mounted across tab and layout changes. */
+export function CallChatBody(props: {
+ open: boolean;
+ children: JSX.Element;
+ composer: JSX.Element;
+}) {
+ let viewport!: HTMLDivElement;
+ let content!: HTMLDivElement;
+ let pinned = true;
+ let scrollTop = 0;
+
+ createEffect(
+ on([isMobile, () => props.open], () => {
+ if (props.open) viewport.scrollTop = scrollTop;
+ })
+ );
+
+ onMount(() => {
+ const observer = new ResizeObserver(() => {
+ if (props.open && pinned) {
+ viewport.scrollTop = viewport.scrollHeight;
+ scrollTop = viewport.scrollTop;
+ }
+ });
+ observer.observe(viewport);
+ observer.observe(content);
+ onCleanup(() => observer.disconnect());
+ });
+
+ return (
+ <div class="flex min-h-0 flex-1 flex-col">
+ <div
+ ref={viewport}
+ data-channel-scroll
+ class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-4"
+ onScroll={() => {
+ if (!props.open || !viewport.clientHeight) return;
+ scrollTop = viewport.scrollTop;
+ pinned =
+ viewport.scrollHeight - scrollTop - viewport.clientHeight < 48;
+ }}
+ >
+ <div ref={content}>{props.children}</div>
+ </div>
+ <div class="shrink-0 p-3">{props.composer}</div>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/channel/Call/chat/components/CallChatPanel.test.tsx b/apps/web/src/features/channel/Call/chat/components/CallChatPanel.test.tsx
index 5318fe1fef..342ba63e8a 100644
--- a/apps/web/src/features/channel/Call/chat/components/CallChatPanel.test.tsx
+++ b/apps/web/src/features/channel/Call/chat/components/CallChatPanel.test.tsx
@@ -1,44 +1,99 @@
/** @vitest-environment jsdom */
-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { createSignal } from 'solid-js';
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createSignal, type JSX } from 'solid-js';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { CallChatBody } from './CallChatBody';
import { CallChatPanel } from './CallChatPanel';
+function TestCallPanel(props: {
+ id: string;
+ open: boolean;
+ onClose: () => void;
+ composer: JSX.Element;
+ children: JSX.Element;
+ sidebarMount?: HTMLElement;
+ overlayMount?: HTMLElement;
+}) {
+ const [tab, setTab] = createSignal<'chat' | 'participants'>('chat');
+ return (
+ <CallChatPanel
+ id={props.id}
+ open={props.open}
+ onClose={props.onClose}
+ activeTab={tab()}
+ onTabChange={setTab}
+ chatAvailable
+ participantCount={1}
+ participants={<p>Participant list</p>}
+ sidebarMount={props.sidebarMount}
+ overlayMount={props.overlayMount}
+ >
+ <CallChatBody
+ open={props.open && tab() === 'chat'}
+ composer={props.composer}
+ >
+ {props.children}
+ </CallChatBody>
+ </CallChatPanel>
+ );
+}
+
+const layout = vi.hoisted(() => ({ mobile: (): boolean => false }));
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => layout.mobile() }));
let resize: () => void;
const disconnect = vi.fn();
beforeEach(() => {
+ layout.mobile = () => false;
+ vi.stubGlobal('scrollTo', vi.fn());
disconnect.mockClear();
vi.stubGlobal(
'ResizeObserver',
class {
+ private callback: () => void;
+ private chat = false;
constructor(callback: () => void) {
- resize = callback;
+ this.callback = callback;
+ }
+ observe(target: Element) {
+ if (target.hasAttribute('data-channel-scroll')) {
+ resize = this.callback;
+ this.chat = true;
+ }
+ }
+ unobserve() {}
+ disconnect() {
+ if (this.chat) disconnect();
}
- observe() {}
- disconnect = disconnect;
}
);
});
afterEach(() => {
cleanup();
vi.unstubAllGlobals();
+ vi.restoreAllMocks();
});
it('preserves the draft and content nodes when closing and reopening', () => {
const [open, setOpen] = createSignal(true);
render(() => (
- <CallChatPanel
+ <TestCallPanel
id="chat"
open={open()}
onClose={() => setOpen(false)}
composer={<input aria-label="Message" />}
>
<p>Earlier message</p>
- </CallChatPanel>
+ </TestCallPanel>
));
const input = screen.getByRole('textbox') as HTMLInputElement;
fireEvent.input(input, { target: { value: 'Unsent draft' } });
- const panel = screen.getByRole('complementary', { name: 'Call chat' });
+ const panel = screen.getByRole('complementary', { name: 'Call sidebar' });
setOpen(false);
expect(panel.hidden).toBe(true);
expect(screen.queryByRole('textbox')).toBeNull();
@@ -51,9 +106,9 @@ it('preserves the draft and content nodes when closing and reopening', () => {
it('follows new messages at the bottom without jumping while reading history', () => {
const result = render(() => (
- <CallChatPanel id="chat" open onClose={() => {}} composer={null}>
+ <TestCallPanel id="chat" open onClose={() => {}} composer={null}>
<p>Messages</p>
- </CallChatPanel>
+ </TestCallPanel>
));
const content = screen.getByText('Messages').parentElement!;
const viewport = content.parentElement!;
@@ -77,3 +132,132 @@ it('follows new messages at the bottom without jumping while reading history', (
result.unmount();
expect(disconnect).toHaveBeenCalledOnce();
});
+
+it('dismisses the phone sheet with Escape and keeps its draft on reopen', async () => {
+ layout.mobile = () => true;
+ const [open, setOpen] = createSignal(true);
+ render(() => (
+ <TestCallPanel
+ id="phone-chat"
+ open={open()}
+ onClose={() => setOpen(false)}
+ composer={<input aria-label="Message" />}
+ >
+ <p>Earlier message</p>
+ </TestCallPanel>
+ ));
+ const panel = screen.getByRole('dialog', { name: 'Call sidebar' });
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ fireEvent.input(input, { target: { value: 'Unsent phone draft' } });
+ fireEvent.keyDown(input, { key: 'Escape' });
+ await waitFor(() => expect(open()).toBe(false));
+ expect(panel.getAttribute('aria-hidden')).toBe('true');
+ setOpen(true);
+ expect(screen.getByRole('textbox')).toBe(input);
+ expect(input.value).toBe('Unsent phone draft');
+});
+
+it('keeps the editor and history position when switching between sheet and sidebar', () => {
+ const [mobile, setMobile] = createSignal(false);
+ layout.mobile = mobile;
+ render(() => (
+ <TestCallPanel
+ id="responsive-chat"
+ open
+ onClose={() => {}}
+ composer={<input aria-label="Message" />}
+ >
+ <p>Earlier message</p>
+ </TestCallPanel>
+ ));
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ const viewport =
+ screen.getByText('Earlier message').parentElement!.parentElement!;
+ Object.defineProperties(viewport, {
+ scrollHeight: { value: 1000 },
+ clientHeight: { value: 200 },
+ });
+ viewport.scrollTop = 300;
+ fireEvent.scroll(viewport);
+ fireEvent.input(input, { target: { value: 'Draft across rotation' } });
+ setMobile(true);
+ expect(
+ screen.getByRole('dialog', { name: 'Call sidebar' }).contains(input)
+ ).toBe(true);
+ expect(screen.getByRole('textbox')).toBe(input);
+ resize();
+ expect(viewport.scrollTop).toBe(300);
+ setMobile(false);
+ expect(
+ screen.getByRole('complementary', { name: 'Call sidebar' }).contains(input)
+ ).toBe(true);
+ expect(input.value).toBe('Draft across rotation');
+ expect(viewport.scrollTop).toBe(300);
+});
+
+it.each([false, true])(
+ 'keeps the draft and history across tab switches (phone: %s)',
+ (mobile) => {
+ layout.mobile = () => mobile;
+ render(() => (
+ <TestCallPanel
+ id="tabs"
+ open
+ onClose={() => {}}
+ composer={<input aria-label="Message" />}
+ >
+ <p>Messages</p>
+ </TestCallPanel>
+ ));
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ const viewport = screen.getByText('Messages').parentElement!.parentElement!;
+ Object.defineProperties(viewport, {
+ scrollHeight: { value: 1000 },
+ clientHeight: { value: 200 },
+ });
+ viewport.scrollTop = 300;
+ fireEvent.scroll(viewport);
+ fireEvent.input(input, { target: { value: 'Keep this draft' } });
+ fireEvent.click(screen.getByRole('radio', { name: /Participants/ }));
+ expect(screen.queryByRole('textbox')).toBeNull();
+ expect(input.isConnected).toBe(true);
+ resize();
+ fireEvent.click(screen.getByRole('radio', { name: 'Chat' }));
+ expect(screen.getByRole('textbox')).toBe(input);
+ expect(input.value).toBe('Keep this draft');
+ expect(viewport.scrollTop).toBe(300);
+ }
+);
+
+it('moves the same sidebar and editor between docked and overlay hosts', () => {
+ const [docked, setDocked] = createSignal(true);
+ let sidebar!: HTMLDivElement;
+ let overlay!: HTMLDivElement;
+ render(() => (
+ <>
+ <div ref={sidebar} />
+ <div ref={overlay} />
+ <TestCallPanel
+ id="docking"
+ open
+ onClose={() => {}}
+ sidebarMount={docked() ? sidebar : undefined}
+ overlayMount={overlay}
+ composer={<input aria-label="Message" />}
+ >
+ <p>Messages</p>
+ </TestCallPanel>
+ </>
+ ));
+ const panel = screen.getByRole('complementary', { name: 'Call sidebar' });
+ const input = screen.getByRole('textbox') as HTMLInputElement;
+ fireEvent.input(input, { target: { value: 'Keep during resize' } });
+ expect(panel.parentElement).toBe(sidebar);
+ setDocked(false);
+ expect(panel.parentElement).toBe(overlay);
+ expect(screen.getByRole('textbox')).toBe(input);
+ setDocked(true);
+ expect(panel.parentElement).toBe(sidebar);
+ expect(screen.getByRole('textbox')).toBe(input);
+ expect(input.value).toBe('Keep during resize');
+});
diff --git a/apps/web/src/features/channel/Call/chat/components/CallChatPanel.tsx b/apps/web/src/features/channel/Call/chat/components/CallChatPanel.tsx
index 30c0248feb..edab3ba1ba 100644
--- a/apps/web/src/features/channel/Call/chat/components/CallChatPanel.tsx
+++ b/apps/web/src/features/channel/Call/chat/components/CallChatPanel.tsx
@@ -1,54 +1,159 @@
-import { type JSX, onCleanup, onMount } from 'solid-js';
+import { formatLocale, t } from '@app/lib/i18n';
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { isMobile } from '@core/mobile/isMobile';
+import XIcon from '@icon/system/regular/x.svg';
+import { Button, cn, Tabs } from '@ui';
+import { createEffect, createSignal, type JSX, on, onCleanup } from 'solid-js';
-/** A persistent sidebar: closing it preserves the composer and scroll position. */
+export type CallPanelTab = 'chat' | 'participants';
+
+/** Share one mounted panel between the desktop sidebar and phone drawer. */
export function CallChatPanel(props: {
id: string;
open: boolean;
onClose: () => void;
+ activeTab: CallPanelTab;
+ onTabChange: (tab: CallPanelTab) => void;
+ chatAvailable: boolean;
+ participantCount: number;
+ participants: JSX.Element;
children: JSX.Element;
- composer: JSX.Element;
+ sidebarMount?: HTMLElement;
+ overlayMount?: HTMLElement;
+ returnFocus?: HTMLButtonElement;
}) {
- let viewport!: HTMLDivElement;
- let content!: HTMLDivElement;
- let pinned = true;
+ const [sidebarBody, setSidebarBody] = createSignal<HTMLDivElement>();
+ const [sheetBody, setSheetBody] = createSignal<HTMLDivElement>();
+ const sheetOpen = () => isMobile() && props.open;
+ const sheetId = () => (isMobile() ? props.id : `${props.id}-sheet`);
+ let aside!: HTMLElement;
+ let body!: HTMLDivElement;
+ const closeOnEscape = (event: KeyboardEvent) => {
+ if (event.key !== 'Escape' || event.defaultPrevented) return;
+ event.preventDefault();
+ event.stopPropagation();
+ props.onClose();
+ };
- onMount(() => {
- const observer = new ResizeObserver(() => {
- if (props.open && pinned) viewport.scrollTop = viewport.scrollHeight;
- });
- observer.observe(viewport);
- observer.observe(content);
- onCleanup(() => observer.disconnect());
+ createEffect(
+ on(
+ [
+ isMobile,
+ sidebarBody,
+ sheetBody,
+ () => props.sidebarMount,
+ () => props.overlayMount,
+ ],
+ ([mobile, sidebar, sheet, sidebarMount, overlayMount]) => {
+ const target = !mobile && sidebarMount ? sidebarMount : overlayMount;
+ if (target && aside.parentElement !== target) target.appendChild(aside);
+ const content = mobile ? sheet : sidebar;
+ if (content && body.parentElement !== content)
+ content.appendChild(body);
+ }
+ )
+ );
+ onCleanup(() => {
+ aside.remove();
+ body.remove();
});
return (
- <aside
- id={props.id}
- aria-label="Call chat"
- hidden={!props.open}
- class="absolute inset-y-0 right-0 z-20 w-full max-w-90 min-h-0 flex-col bg-surface @min-[800px]/call:static @min-[800px]/call:w-90 @min-[800px]/call:shrink-0"
- classList={{ flex: props.open }}
- onKeyDown={(event) => {
- if (event.key !== 'Escape' || event.defaultPrevented) return;
- event.preventDefault();
- event.stopPropagation();
- props.onClose();
+ <MobileDrawer
+ open={sheetOpen()}
+ dialogId={sheetId()}
+ finalFocusEl={props.returnFocus}
+ restoreFocus
+ onOpenChange={(open) => {
+ if (!open) props.onClose();
}}
>
- <div
- ref={viewport}
- data-channel-scroll
- class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-4"
- onScroll={() => {
- if (!props.open) return;
- pinned =
- viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight <
- 48;
+ <aside
+ ref={aside}
+ id={isMobile() ? undefined : props.id}
+ aria-label={t('calls.panel')}
+ hidden={isMobile() || !props.open}
+ inert={isMobile() || !props.open}
+ class="absolute top-2 right-0 bottom-2 z-20 w-full max-w-90 min-h-0 flex-col overflow-hidden rounded-lg border border-edge-muted bg-surface-2 transition-[opacity,translate,display] transition-discrete duration-200 ease-out starting:opacity-0 starting:translate-x-3 motion-reduce:transition-none @min-[800px]/call:static @min-[800px]/call:h-full @min-[800px]/call:max-w-none"
+ classList={{
+ flex: !isMobile() && props.open,
+ 'opacity-0 translate-x-3 pointer-events-none': !props.open,
}}
>
- <div ref={content}>{props.children}</div>
+ <div ref={setSidebarBody} class="flex min-h-0 flex-1 flex-col" />
+ </aside>
+ <MobileDrawer.Portal forceMount>
+ <MobileDrawer.Overlay />
+ <MobileDrawer.Content
+ forceMount
+ aria-hidden={!sheetOpen()}
+ inert={!sheetOpen()}
+ targetHeight={80}
+ class="data-closed:hidden motion-reduce:duration-0!"
+ >
+ <MobileDrawer.Handle />
+ <MobileDrawer.Title class="sr-only">
+ {t('calls.panel')}
+ </MobileDrawer.Title>
+ <MobileDrawer.ScrollBody ref={setSheetBody} class="overflow-hidden" />
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ <div
+ ref={body}
+ class="flex min-h-0 flex-1 flex-col"
+ onKeyDown={closeOnEscape}
+ >
+ <div class="flex h-14 shrink-0 items-center justify-between gap-2 px-3">
+ <Tabs<CallPanelTab>
+ aria-label={t('calls.panel')}
+ value={props.activeTab}
+ onChange={props.onTabChange}
+ options={[
+ {
+ value: 'chat',
+ label: t('calls.chat'),
+ disabled: !props.chatAvailable,
+ },
+ {
+ value: 'participants',
+ label: t('calls.participants'),
+ count: props.participantCount.toLocaleString(formatLocale()),
+ },
+ ]}
+ />
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('calls.closePanel')}
+ tooltip={t('calls.closePanel')}
+ onClick={props.onClose}
+ >
+ <XIcon class="size-4" />
+ </Button>
+ </div>
+ <section
+ aria-label={t('calls.chat')}
+ hidden={props.activeTab !== 'chat'}
+ inert={props.activeTab !== 'chat'}
+ class={cn(
+ 'flex min-h-0 flex-1 flex-col',
+ props.activeTab !== 'chat' && 'hidden'
+ )}
+ >
+ {props.children}
+ </section>
+ <section
+ aria-label={t('calls.participants')}
+ hidden={props.activeTab !== 'participants'}
+ inert={props.activeTab !== 'participants'}
+ class={cn(
+ 'min-h-0 flex-1 overflow-y-auto overscroll-contain px-1 pb-3',
+ props.activeTab !== 'participants' && 'hidden'
+ )}
+ >
+ {props.participants}
+ </section>
</div>
- <div class="shrink-0 p-3">{props.composer}</div>
- </aside>
+ </MobileDrawer>
);
}
diff --git a/apps/web/src/features/channel/Call/create-controls-visibility.ts b/apps/web/src/features/channel/Call/create-controls-visibility.ts
new file mode 100644
index 0000000000..afd8154410
--- /dev/null
+++ b/apps/web/src/features/channel/Call/create-controls-visibility.ts
@@ -0,0 +1,24 @@
+import { type Accessor, createEffect, createSignal, onCleanup } from 'solid-js';
+
+const CONTROLS_IDLE_MS = 4000;
+
+/** Keep controls mounted; only their presentation changes when the call is idle. */
+export function createControlsVisibility(options: {
+ enabled: Accessor<boolean>;
+ keepVisible: Accessor<boolean>;
+}) {
+ const [visible, setVisible] = createSignal(true);
+ let timer: ReturnType<typeof setTimeout> | undefined;
+
+ function reveal() {
+ clearTimeout(timer);
+ setVisible(true);
+ if (!options.enabled() || options.keepVisible()) return;
+ timer = setTimeout(() => setVisible(false), CONTROLS_IDLE_MS);
+ }
+
+ createEffect(reveal);
+ onCleanup(() => clearTimeout(timer));
+
+ return { visible, reveal };
+}
diff --git a/apps/web/src/features/channel/Call/tests/active-call-link.test.tsx b/apps/web/src/features/channel/Call/tests/active-call-link.test.tsx
index 38317795e8..827defb805 100644
--- a/apps/web/src/features/channel/Call/tests/active-call-link.test.tsx
+++ b/apps/web/src/features/channel/Call/tests/active-call-link.test.tsx
@@ -28,6 +28,7 @@ vi.mock('../../../meetings/use-quick-calls-flag', () => ({
}));
vi.mock('@ui', async () => ({
...(await import('../../../../components/ui/components/Button')),
+ ...(await import('../../../../components/ui/components/CopyButton')),
Tooltip: (props: { children: JSX.Element }) => props.children,
}));
diff --git a/apps/web/src/features/channel/Call/tests/call-overlay-muted.test.tsx b/apps/web/src/features/channel/Call/tests/call-overlay-muted.test.tsx
index b7d47634f0..b7528e7f8a 100644
--- a/apps/web/src/features/channel/Call/tests/call-overlay-muted.test.tsx
+++ b/apps/web/src/features/channel/Call/tests/call-overlay-muted.test.tsx
@@ -2,22 +2,28 @@
* @vitest-environment jsdom
*/
-import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { fireEvent, render, screen, within } from '@solidjs/testing-library';
import type { RemoteParticipant, Track } from 'livekit-client';
-import { createSignal, type Setter } from 'solid-js';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { createSignal, type JSX, type Setter } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { CallState } from '../CallContext';
import { CallOverlay } from '../CallOverlay';
+import { CallParticipantsList } from '../CallParticipantsList';
const mocks = vi.hoisted(() => ({
callContext: undefined as unknown,
displayNames: new Map<string, string>(),
+ mobile: false,
}));
vi.mock('@components/app/split-layout/layoutUtils', () => ({
useSplitPanel: () => undefined,
}));
+vi.mock('@core/mobile/isMobile', () => ({
+ isMobile: () => mocks.mobile,
+}));
+
vi.mock('@core/component/UserIcon', () => ({
UserIcon: () => <div data-testid="user-avatar" />,
}));
@@ -37,10 +43,16 @@ vi.mock('@core/user', () => ({
mocks.displayNames.get(identity) ?? identity,
}));
-vi.mock('@ui', () => ({
+vi.mock('@ui', async () => ({
+ Avatar: (await import('@ui/components/Avatar')).Avatar,
+ Button: (await import('@ui/components/Button')).Button,
+ Layer: (await import('@ui/components/Layer')).Layer,
cn: (...classes: Array<string | false | null | undefined>) =>
classes.filter(Boolean).join(' '),
- InlineCheckbox: () => null,
+ Tabs: (await import('@ui/components/Tabs')).Tabs,
+ Dropdown: (await import('@ui/components/Dropdown')).Dropdown,
+ SingleSelectCheck: (await import('@ui/components/Checkbox'))
+ .SingleSelectCheck,
Tooltip: (props: { children: unknown }) => props.children,
}));
@@ -49,7 +61,7 @@ vi.mock('../CallContext', () => ({
}));
vi.mock('../CallControls/CallControls', () => ({
- CallControls: () => null,
+ CallControls: (props: { children?: JSX.Element }) => props.children,
}));
vi.mock('../chat/CallChat', () => ({
@@ -98,12 +110,13 @@ function createTrack(sid: string): Track {
function createRemoteParticipant(
identity: string,
publications: ParticipantPublications,
- name?: string
+ name?: string,
+ isAgent = false
): RemoteParticipant {
return {
identity,
name,
- isAgent: false,
+ isAgent,
getTrackPublication(source: string) {
return publications[source];
},
@@ -150,8 +163,19 @@ function setUpCallState(
return { setChannelId, setAudioMuted, setParticipants, setTrackVersion };
}
+afterEach(() => vi.unstubAllGlobals());
+
beforeEach(() => {
+ mocks.mobile = false;
mocks.displayNames.clear();
+ vi.stubGlobal(
+ 'ResizeObserver',
+ class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ }
+ );
});
describe('CallOverlay muted microphone badges', () => {
@@ -159,13 +183,13 @@ describe('CallOverlay muted microphone badges', () => {
const controls = setUpCallState();
controls.setChannelId(null);
render(() => <CallOverlay onLeave={() => undefined} showTeamSharing />);
- expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Call sharing:/ })).toBeNull();
controls.setChannelId('channel-1');
expect(
- screen.getByRole('checkbox', { name: 'Share with team' })
+ screen.getByRole('button', { name: 'Call sharing: Private' })
).toBeTruthy();
controls.setChannelId(null);
- expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Call sharing:/ })).toBeNull();
});
it('uses the guest name from the media session and hides team sharing for guests', () => {
@@ -182,7 +206,36 @@ describe('CallOverlay muted microphone badges', () => {
expect(
screen.getByRole('status', { name: 'Taylor Guest is muted' })
).toBeTruthy();
- expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Call sharing:/ })).toBeNull();
+ });
+
+ it('restores the phone sidebar trigger after Escape', async () => {
+ vi.useFakeTimers();
+ mocks.mobile = true;
+ setUpCallState();
+ const view = render(() => (
+ <>
+ <button>Previous focus</button>
+ <CallOverlay onLeave={() => undefined} />
+ </>
+ ));
+ try {
+ screen.getByRole('button', { name: 'Previous focus' }).focus();
+ const trigger = screen.getByRole('button', {
+ name: 'Open chat and participants',
+ });
+ fireEvent.click(trigger);
+ await vi.advanceTimersByTimeAsync(500);
+ fireEvent.keyDown(screen.getByRole('radio', { name: 'Chat' }), {
+ key: 'Escape',
+ });
+ await vi.advanceTimersByTimeAsync(500);
+ expect(trigger.getAttribute('aria-expanded')).toBe('false');
+ expect(document.activeElement).toBe(trigger);
+ } finally {
+ view.unmount();
+ vi.useRealTimers();
+ }
});
it('opens chat for a standalone meeting without a channel', async () => {
@@ -191,29 +244,40 @@ describe('CallOverlay muted microphone badges', () => {
render(() => (
<CallOverlay onLeave={() => undefined} showTeamSharing={false} />
));
- fireEvent.click(screen.getByRole('button', { name: 'Open chat' }));
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Open chat and participants' })
+ );
expect(
await screen.findByRole('textbox', { name: 'Message this call' })
).toBeTruthy();
expect(screen.getByText('call-id')).toBeTruthy();
- expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(screen.queryByRole('button', { name: /^Call sharing:/ })).toBeNull();
});
- it('does not mount authenticated message queries for a guest', () => {
+ it('keeps the roster available without mounting unavailable message queries', () => {
const controls = setUpCallState();
controls.setChannelId(null);
render(() => <CallOverlay onLeave={() => undefined} showChat={false} />);
- expect(screen.queryByRole('button', { name: 'Open chat' })).toBeNull();
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Open chat and participants' })
+ );
expect(
- screen.queryByRole('complementary', { name: 'Call chat' })
- ).toBeNull();
+ screen.getByRole('list', { name: 'In-call participants' })
+ ).toBeTruthy();
+ expect(
+ screen.getByRole('radio', { name: 'Chat' }).hasAttribute('disabled')
+ ).toBe(true);
+ expect(screen.queryByRole('textbox')).toBeNull();
+ expect(screen.queryByText('call-id')).toBeNull();
});
it('opens the call thread without remounting video and restores focus when closed', async () => {
setUpCallState();
render(() => <CallOverlay onLeave={() => undefined} />);
const video = screen.getByTestId('track-local-camera');
- const toggle = screen.getByRole('button', { name: 'Open chat' });
+ const toggle = screen.getByRole('button', {
+ name: 'Open chat and participants',
+ });
expect(toggle.getAttribute('aria-expanded')).toBe('false');
fireEvent.click(toggle);
const composer = await screen.findByRole('textbox', {
@@ -221,6 +285,14 @@ describe('CallOverlay muted microphone badges', () => {
});
fireEvent.input(composer, { target: { value: 'Draft' } });
expect(screen.getByText('call-id')).toBeTruthy();
+ fireEvent.click(screen.getByRole('radio', { name: /Participants/ }));
+ expect(screen.queryByRole('textbox')).toBeNull();
+ expect(composer.isConnected).toBe(true);
+ fireEvent.click(screen.getByRole('radio', { name: 'Chat' }));
+ expect(screen.getByRole('textbox', { name: 'Message this call' })).toBe(
+ composer
+ );
+ expect((composer as HTMLInputElement).value).toBe('Draft');
expect(screen.getByTestId('track-local-camera')).toBe(video);
fireEvent.click(screen.getByRole('button', { name: 'Close sidebar' }));
expect(document.activeElement).toBe(toggle);
@@ -328,4 +400,186 @@ describe('CallOverlay muted microphone badges', () => {
screen.queryByRole('status', { name: 'Alex Morgan is muted' })
).toBeNull();
});
+
+ it('disables solo focus and clears it when the last remote participant leaves', () => {
+ const controls = setUpCallState();
+ render(() => <CallOverlay onLeave={() => undefined} />);
+ expect(screen.queryByRole('button', { name: 'Focus yourself' })).toBeNull();
+ const remote = createRemoteParticipant('remote', {}, 'Remote participant');
+ controls.setParticipants(new Map([[remote.identity, remote]]));
+ fireEvent.click(screen.getByRole('button', { name: 'Focus yourself' }));
+ expect(screen.getByRole('button', { name: 'Back to grid' })).toBeTruthy();
+ controls.setParticipants(new Map());
+ expect(screen.queryByRole('button', { name: 'Focus yourself' })).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Back to grid' })).toBeNull();
+ controls.setParticipants(new Map([[remote.identity, remote]]));
+ expect(screen.queryByRole('button', { name: 'Back to grid' })).toBeNull();
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Focus Remote participant' })
+ );
+ fireEvent.click(screen.getByRole('button', { name: 'Back to grid' }));
+ expect(
+ screen.getByRole('button', { name: 'Focus Remote participant' })
+ ).toBeTruthy();
+ });
+ it('focuses a participant without remounting video and restores the grid when they leave', () => {
+ const first = createRemoteParticipant(
+ 'first',
+ {
+ camera: {
+ isMuted: false,
+ isSubscribed: true,
+ track: createTrack('first-camera'),
+ },
+ },
+ 'First participant'
+ );
+ const second = createRemoteParticipant('second', {}, 'Second participant');
+ const controls = setUpCallState([first, second]);
+ render(() => <CallOverlay onLeave={() => undefined} />);
+ const video = screen.getByTestId('track-first-camera');
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Focus First participant' })
+ );
+ expect(
+ screen
+ .getByRole('button', { name: 'Unfocus First participant' })
+ .getAttribute('aria-pressed')
+ ).toBe('true');
+ expect(
+ screen.queryByRole('button', { name: 'Focus Second participant' })
+ ).toBeNull();
+ expect(screen.getByTestId('track-first-camera')).toBe(video);
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Unfocus First participant' })
+ );
+ expect(
+ screen.getByRole('button', { name: 'Focus Second participant' })
+ ).toBeTruthy();
+ expect(screen.getByTestId('track-first-camera')).toBe(video);
+ fireEvent.click(screen.getByRole('button', { name: 'Focus yourself' }));
+ expect(
+ screen.getByRole('button', { name: 'Focus First participant' })
+ ).toBeTruthy();
+ expect(
+ screen.getByRole('button', { name: 'Focus Second participant' })
+ ).toBeTruthy();
+ expect(screen.getByTestId('track-first-camera')).toBe(video);
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Focus First participant' })
+ );
+ controls.setParticipants(new Map([[second.identity, second]]));
+ expect(
+ screen.getByRole('button', { name: 'Focus Second participant' })
+ ).toBeTruthy();
+ expect(
+ screen.queryByRole('button', { name: 'Unfocus First participant' })
+ ).toBeNull();
+ });
+
+ it.each([false, true])(
+ 'swaps the local and remote views without remounting video (phone: %s)',
+ (mobile) => {
+ mocks.mobile = mobile;
+ const remote = createRemoteParticipant(
+ 'remote',
+ {
+ camera: {
+ isMuted: false,
+ isSubscribed: true,
+ track: createTrack('remote-camera'),
+ },
+ },
+ 'Remote participant'
+ );
+ setUpCallState([remote]);
+ render(() => <CallOverlay onLeave={() => undefined} />);
+ const localVideo = screen.getByTestId('track-local-camera');
+ const remoteVideo = screen.getByTestId('track-remote-camera');
+ fireEvent.click(screen.getByRole('button', { name: 'Focus yourself' }));
+ expect(
+ screen.getByRole('button', { name: 'Focus Remote participant' })
+ ).toBeTruthy();
+ expect(screen.getByTestId('track-local-camera')).toBe(localVideo);
+ expect(screen.getByTestId('track-remote-camera')).toBe(remoteVideo);
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Focus Remote participant' })
+ );
+ expect(
+ screen.getByRole('button', { name: 'Focus yourself' })
+ ).toBeTruthy();
+ expect(screen.getByTestId('track-local-camera')).toBe(localVideo);
+ expect(screen.getByTestId('track-remote-camera')).toBe(remoteVideo);
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Unfocus Remote participant' })
+ );
+ expect(
+ screen.getByRole('button', { name: 'Focus Remote participant' })
+ ).toBeTruthy();
+ expect(screen.getByTestId('track-local-camera')).toBe(localVideo);
+ expect(screen.getByTestId('track-remote-camera')).toBe(remoteVideo);
+ }
+ );
+});
+
+describe('CallParticipantsList live roster', () => {
+ it('tracks human arrivals and departures without counting recording agents', () => {
+ const guest = createRemoteParticipant('guest-1', {}, 'Guest attendee');
+ const agent = createRemoteParticipant('agent-1', {}, 'Recorder', true);
+ const controls = setUpCallState([guest, agent]);
+ render(() => <CallParticipantsList localName="Local attendee" />);
+ const list = screen.getByRole('list', { name: 'In-call participants' });
+ expect(within(list).getAllByRole('listitem')).toHaveLength(2);
+ expect(list.textContent).toContain('Local attendee');
+ expect(list.textContent).toContain('Guest attendee');
+ expect(list.textContent).not.toContain('Recorder');
+
+ const joined = createRemoteParticipant('guest-2', {}, 'New attendee');
+ controls.setParticipants(
+ new Map([
+ [guest.identity, guest],
+ [agent.identity, agent],
+ [joined.identity, joined],
+ ])
+ );
+ expect(within(list).getAllByRole('listitem')).toHaveLength(3);
+ expect(list.textContent).toContain('New attendee');
+
+ controls.setParticipants(new Map([[agent.identity, agent]]));
+ expect(within(list).getAllByRole('listitem')).toHaveLength(1);
+ expect(list.textContent).not.toContain('Guest attendee');
+ expect(list.textContent).not.toContain('New attendee');
+ });
+
+ it('updates microphone and camera status when live publications change', () => {
+ const publications: ParticipantPublications = {};
+ const guest = createRemoteParticipant(
+ 'guest-1',
+ publications,
+ 'Guest attendee'
+ );
+ const controls = setUpCallState([guest]);
+ render(() => <CallParticipantsList />);
+ const row = screen.getByText('Guest attendee').closest('li')!;
+ expect(
+ within(row).getByRole('img', { name: 'Microphone off' })
+ ).toBeTruthy();
+ expect(within(row).getByRole('img', { name: 'Camera off' })).toBeTruthy();
+
+ publications.microphone = { isMuted: false, isSubscribed: true };
+ publications.camera = { isMuted: false, isSubscribed: false };
+ controls.setTrackVersion((version) => version + 1);
+ expect(
+ within(row).getByRole('img', { name: 'Microphone on' })
+ ).toBeTruthy();
+ expect(within(row).getByRole('img', { name: 'Camera on' })).toBeTruthy();
+
+ publications.microphone.isMuted = true;
+ publications.camera.isMuted = true;
+ controls.setTrackVersion((version) => version + 1);
+ expect(
+ within(row).getByRole('img', { name: 'Microphone off' })
+ ).toBeTruthy();
+ expect(within(row).getByRole('img', { name: 'Camera off' })).toBeTruthy();
+ });
});
diff --git a/apps/web/src/features/channel/Channel/ChannelDetail.tsx b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
index 3a7e1db464..b7b8d76690 100644
--- a/apps/web/src/features/channel/Channel/ChannelDetail.tsx
+++ b/apps/web/src/features/channel/Channel/ChannelDetail.tsx
@@ -37,6 +37,7 @@ import {
useChannelName,
useChannelType,
} from '@core/context/channels';
+import { isMobile } from '@core/mobile/isMobile';
import { createMethodRegistration } from '@core/orchestrator';
import { lazyNamed } from '@core/util/lazyNamed';
import { Tabs } from '@ui';
@@ -161,6 +162,7 @@ export function ChannelDetailActions(props: ChannelDetailHeaderProps) {
const channelName = useChannelName(props.channelId, props.fallbackName);
const channelType = useChannelType(props.channelId);
const call = useCall(() => props.channelId);
+ const { activeTab } = useChannelTab();
// Seed for "Ask Macro": a new chat with this channel @mentioned.
const askMacroEntity = () => {
@@ -199,13 +201,17 @@ export function ChannelDetailActions(props: ChannelDetailHeaderProps) {
)}
</Show>
</HeaderActionGroup>
- <DebugSuspense name="ChannelDetail.invite">
- <ChannelInviteButton
- channelId={props.channelId}
- channelName={channelName() ?? 'New Channel'}
- channelType={channelType()}
- />
- </DebugSuspense>
+ <Show
+ when={!isMobile() || activeTab() !== 'call' || !call.isInThisChannel()}
+ >
+ <DebugSuspense name="ChannelDetail.invite">
+ <ChannelInviteButton
+ channelId={props.channelId}
+ channelName={channelName() ?? 'New Channel'}
+ channelType={channelType()}
+ />
+ </DebugSuspense>
+ </Show>
</div>
);
}
diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsx
index 5610ca3ed9..07ec856082 100644
--- a/apps/web/src/features/channel/Input/ChannelInput.tsx
+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx
@@ -304,7 +304,7 @@ export function ChannelInput(props: ChannelInputProps) {
options?: RestoreSnapshotOptions;
}
| undefined;
- let pendingFocus = false;
+ let pendingFocus: (() => boolean) | undefined;
// Caret placement requested by a `cursor: 'trailing-paragraph'` restore.
// Applied on the next programmatic focus rather than at restore time.
let pendingCursor: RestoreSnapshotOptions['cursor'];
@@ -342,18 +342,22 @@ export function ChannelInput(props: ChannelInputProps) {
markdownEditor.controls.focus();
};
- const focusEditor = () => {
+ const focusEditor = (when: () => boolean = () => true) => {
+ if (!when()) return;
if (!isEditorConnected) {
- pendingFocus = true;
+ pendingFocus = when;
return;
}
focusEditorNow();
};
const flushPendingFocus = () => {
- if (!pendingFocus) return;
- pendingFocus = false;
- queueMicrotask(() => focusEditorNow());
+ const when = pendingFocus;
+ pendingFocus = undefined;
+ if (!when) return;
+ queueMicrotask(() => {
+ if (when()) focusEditorNow();
+ });
};
const parentBots =
@@ -725,11 +729,12 @@ export function ChannelInput(props: ChannelInputProps) {
props.onReady?.({
snapshot: inputState.snapshot,
clear: () => markdownEditor.controls.clear(),
- focus: () => {
+ focus: (options) => {
+ if (options?.when?.() === false) return;
// A collapsed pill hides the editor; programmatic focus implies intent
// to type, so expand first.
collapsedInput.expand();
- focusEditor();
+ focusEditor(options?.when);
},
send: commands.send,
attachFiles: (files) => inputState.commands.attachFiles(files),
diff --git a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
index 0c2904a7af..24611ea139 100644
--- a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
+++ b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
@@ -650,6 +650,24 @@ describe('Input slots', () => {
expect(onStartTyping).toHaveBeenCalledTimes(1);
});
+ it.each([false, true])(
+ 'rechecks deferred focus before editor connection (current: %s)',
+ async (current) => {
+ let focusCurrent = true;
+ render(() => (
+ <ChannelInput
+ input={baseInput}
+ onReady={(handle) => {
+ handle.focus({ when: () => focusCurrent });
+ focusCurrent = current;
+ }}
+ />
+ ));
+ await Promise.resolve();
+ expect(editorMocks.focus).toHaveBeenCalledTimes(current ? 1 : 0);
+ }
+ );
+
it('does not refocus the editor when a portaled editor control is clicked', async () => {
const user = userEvent.setup();
render(() => <ChannelInput input={baseInput} />);
diff --git a/apps/web/src/features/channel/Input/types.ts b/apps/web/src/features/channel/Input/types.ts
index 4a0a55c358..38fb612668 100644
--- a/apps/web/src/features/channel/Input/types.ts
+++ b/apps/web/src/features/channel/Input/types.ts
@@ -104,7 +104,8 @@ export type InputHandle = {
/** Read the current draft, including restored persisted content. */
snapshot: () => InputSnapshot;
clear: () => void;
- focus: () => void;
+ /** Recheck an optional guard if focus must wait for the editor to connect. */
+ focus: (options?: { when?: () => boolean }) => void;
send: () => Promise<boolean>;
attachFiles: (files: File[]) => Promise<void>;
restoreSnapshot: (
diff --git a/apps/web/src/features/channel/Message/ActionMenu.tsx b/apps/web/src/features/channel/Message/ActionMenu.tsx
index efd4f8eea6..9fcbf29462 100644
--- a/apps/web/src/features/channel/Message/ActionMenu.tsx
+++ b/apps/web/src/features/channel/Message/ActionMenu.tsx
@@ -183,7 +183,11 @@ function ActionMenuContent(props: ActionMenuProps) {
// the very top; float the toolbar fully above so it never covers it.
position={props.showTimestamp ? 'above' : 'straddle'}
>
- <Toolbar size="icon-sm" onClick={(event) => event.stopPropagation()}>
+ <Toolbar
+ size="icon-sm"
+ class="max-w-full flex-wrap"
+ onClick={(event) => event.stopPropagation()}
+ >
<Show when={props.showTimestamp}>
<Timestamp format="time" class="px-1.5 whitespace-nowrap" />
<Toolbar.Divider />
diff --git a/apps/web/src/features/channel/Message/HoverActions.tsx b/apps/web/src/features/channel/Message/HoverActions.tsx
index 3da00b4aee..41c8fa8c60 100644
--- a/apps/web/src/features/channel/Message/HoverActions.tsx
+++ b/apps/web/src/features/channel/Message/HoverActions.tsx
@@ -1,6 +1,15 @@
import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { fireAndForget } from '@core/util/fireAndForget';
+import {
+ autoUpdate,
+ computePosition,
+ flip,
+ offset,
+ shift,
+ size,
+} from '@floating-ui/dom';
import { cn } from '@ui';
-import type { JSX } from 'solid-js';
+import { type JSX, onCleanup, onMount } from 'solid-js';
type HoverActionsProps = {
class?: string;
@@ -16,10 +25,56 @@ type HoverActionsProps = {
};
export function HoverActions(props: HoverActionsProps) {
+ let toolbar!: HTMLDivElement;
+
+ onMount(() => {
+ const row = toolbar.closest<HTMLElement>('[data-message]');
+ const viewport = toolbar.closest<HTMLElement>('[data-channel-scroll]');
+ if (!row || !viewport) return;
+
+ let revision = 0;
+ const updatePosition = async () => {
+ const current = ++revision;
+ const position = await computePosition(row, toolbar, {
+ placement: 'top-end',
+ middleware: [
+ offset(() =>
+ props.position === 'above' ? 0 : -toolbar.offsetHeight / 2
+ ),
+ flip({ boundary: viewport, padding: 8 }),
+ shift({ boundary: viewport, padding: 8, crossAxis: true }),
+ size({
+ boundary: viewport,
+ padding: 8,
+ apply({ availableWidth, elements }) {
+ if (current !== revision) return;
+ elements.floating.style.maxWidth = `${Math.max(0, availableWidth)}px`;
+ },
+ }),
+ ],
+ });
+ if (current !== revision) return;
+ Object.assign(toolbar.style, {
+ left: `${position.x}px`,
+ top: `${position.y}px`,
+ right: 'auto',
+ bottom: 'auto',
+ translate: 'none',
+ });
+ };
+ const cleanup = autoUpdate(row, toolbar, () => {
+ fireAndForget(updatePosition(), 'message-hover-actions');
+ });
+ onCleanup(() => {
+ revision++;
+ cleanup();
+ });
+ });
return (
<div
+ ref={toolbar}
class={cn(
- 'absolute right-4 z-10',
+ 'absolute right-4 z-10 w-max max-w-full',
props.position === 'above' ? 'bottom-full' : 'top-0 -translate-y-1/2',
props.persistentVisible
? ''
diff --git a/apps/web/src/features/email-compose/views/compose-toolbar.tsx b/apps/web/src/features/email-compose/views/compose-toolbar.tsx
index 46334a5b88..33c77d3561 100644
--- a/apps/web/src/features/email-compose/views/compose-toolbar.tsx
+++ b/apps/web/src/features/email-compose/views/compose-toolbar.tsx
@@ -92,6 +92,7 @@ export function EmailComposeToolbar(props: {
{/* Inline drafts send without waiting for inline media uploads. */}
<Show when={props.editor && !props.inline}>
<Button
+ variant="ghost"
onClick={() =>
props
.editor?.()
@@ -100,9 +101,8 @@ export function EmailComposeToolbar(props: {
constrainedMediaDimensions: { width: 542, height: 542 },
})
}
- variant="ghost"
- tooltip="Insert image"
aria-label="Insert image"
+ tooltip="Insert image"
size="icon-md"
disabled={ctx.disabled()}
>
diff --git a/apps/web/src/features/meetings/README.md b/apps/web/src/features/meetings/README.md
new file mode 100644
index 0000000000..2309395557
--- /dev/null
+++ b/apps/web/src/features/meetings/README.md
@@ -0,0 +1,5 @@
+# Meeting session ownership
+
+`MeetingSessionProvider` owns the shared cleanup lifecycle and disposable Solid roots for standalone sessions. A route attaches to a session by share token. On dismissal, an in-flight join is cancelled and late credentials are released; a connected session stays in the provider and can be reattached by opening the same link. The provider disposes all session roots on unmount, and an external call disconnection disposes a detached session. Explicit Leave still releases the participant, disconnects the call, and navigates to the call exit destination. Back navigates to `/app` without leaving the call.
+
+Session ownership emits `meeting.session.acquire`, `meeting.session.detach`, and `meeting.session.dispose` spans. These record creation, reuse, retention, and disposal outcomes with the call ID when available, never the share token.
diff --git a/apps/web/src/features/meetings/components/meeting-copy-button.tsx b/apps/web/src/features/meetings/components/meeting-copy-button.tsx
index 6aac4be38f..9a24819c71 100644
--- a/apps/web/src/features/meetings/components/meeting-copy-button.tsx
+++ b/apps/web/src/features/meetings/components/meeting-copy-button.tsx
@@ -1,7 +1,7 @@
-import { fireAndForget } from '@core/util/fireAndForget';
-import Check from '@icon/system/regular/check.svg';
+import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
+import { isMobile } from '@core/mobile/isMobile';
import Copy from '@icon/system/regular/copy.svg';
-import { Button } from '@ui';
+import { CopyButton } from '@ui';
import { createSignal, onCleanup, Show } from 'solid-js';
export function MeetingCopyButton(props: {
@@ -12,29 +12,24 @@ export function MeetingCopyButton(props: {
const [copied, setCopied] = createSignal(false);
const [error, setError] = createSignal(false);
const [copying, setCopying] = createSignal(false);
- let reset: ReturnType<typeof setTimeout> | undefined;
let disposed = false;
onCleanup(() => {
disposed = true;
- clearTimeout(reset);
});
async function copy() {
- if (copying()) return;
+ if (copying()) return false;
setCopying(true);
+ setCopied(false);
setError(false);
try {
await props.onCopy();
- if (disposed) return;
- clearTimeout(reset);
+ if (disposed) return false;
setCopied(true);
- setError(false);
- reset = setTimeout(() => setCopied(false), 2500);
+ return true;
} catch {
- if (disposed) return;
- clearTimeout(reset);
- setCopied(false);
- setError(true);
+ if (!disposed) setError(true);
+ return false;
} finally {
if (!disposed) setCopying(false);
}
@@ -42,20 +37,21 @@ export function MeetingCopyButton(props: {
return (
<div class="min-w-0 text-sm text-ink-muted">
- <Button
- type="button"
- variant="ghost"
- size="lg"
- disabled={props.disabled || copying()}
- aria-busy={copying()}
- class="bg-hover text-ink not-touch:not-disabled:hover:bg-active focus-visible:outline-2 focus-visible:outline-accent"
- onClick={() => fireAndForget(copy(), 'meetings')}
- >
- <Show when={copied()} fallback={<Copy class="size-4" />}>
- <Check class="size-4" />
- </Show>
- Copy Meeting Url
- </Button>
+ <HeaderIsland class="px-0">
+ <CopyButton
+ type="button"
+ variant="ghost"
+ size={isMobile() ? 'icon-lg' : 'lg'}
+ aria-label="Copy Meeting Url"
+ tooltip={{ content: 'Copy Meeting Url', placement: 'top' }}
+ disabled={props.disabled || copying()}
+ aria-busy={copying()}
+ onClick={copy}
+ >
+ <Copy class="size-4" />
+ <span class="hidden @3xl/call-stage:inline">Copy Meeting Url</span>
+ </CopyButton>
+ </HeaderIsland>
<span role="status" class="sr-only">
{copied() ? 'Meeting URL copied' : ''}
</span>
diff --git a/apps/web/src/features/meetings/context/meeting-session-owner.ts b/apps/web/src/features/meetings/context/meeting-session-owner.ts
new file mode 100644
index 0000000000..95f2a7635f
--- /dev/null
+++ b/apps/web/src/features/meetings/context/meeting-session-owner.ts
@@ -0,0 +1,12 @@
+import { createContext, useContext } from 'solid-js';
+import type { createMeetingSessionOwner } from '../primitives/meeting-session-owner';
+
+export const MeetingSessionOwnerContext =
+ createContext<ReturnType<typeof createMeetingSessionOwner>>();
+
+export function useMeetingSessionOwner() {
+ const owner = useContext(MeetingSessionOwnerContext);
+ if (!owner)
+ throw new Error('Meeting sessions require MeetingSessionProvider');
+ return owner;
+}
diff --git a/apps/web/src/features/meetings/meeting-route.tsx b/apps/web/src/features/meetings/meeting-route.tsx
index 0f64d28a78..5975f783c3 100644
--- a/apps/web/src/features/meetings/meeting-route.tsx
+++ b/apps/web/src/features/meetings/meeting-route.tsx
@@ -85,6 +85,7 @@ export function MeetingRouteContent(props: {
participants={participantState()}
onCallStateChange={props.onCallStateChange}
onLeave={props.onLeave}
+ onBack={() => navigate('/app')}
mediaAccess={browserMeetingMedia}
initialBackground={call.backgroundEffect()}
readBackgroundImage={readBackgroundImage}
@@ -128,10 +129,11 @@ export function MeetingRouteContent(props: {
}),
disconnect: call.meetingSession.disconnect,
}}
- renderCall={(onLeave, name, credentials) => (
+ renderCall={(onLeave, name, credentials, copyButton) => (
<CallOverlay
onLeave={onLeave}
localName={name()}
+ footerLeading={copyButton}
showChat={
authenticated() === true ||
(authenticated() === false && !!credentials())
diff --git a/apps/web/src/features/meetings/meeting-session-provider.tsx b/apps/web/src/features/meetings/meeting-session-provider.tsx
index ab72881bef..6ccf5d871a 100644
--- a/apps/web/src/features/meetings/meeting-session-provider.tsx
+++ b/apps/web/src/features/meetings/meeting-session-provider.tsx
@@ -1,13 +1,18 @@
import type { ParentProps } from 'solid-js';
import { MeetingSessionLifecycleContext } from './context/meeting-session-lifecycle';
+import { MeetingSessionOwnerContext } from './context/meeting-session-owner';
import { createMeetingSessionLifecycle } from './primitives/meeting-session-lifecycle';
+import { createMeetingSessionOwner } from './primitives/meeting-session-owner';
/** Mounted above the router so leaving a meeting cannot discard pending cleanup. */
export function MeetingSessionProvider(props: ParentProps) {
const lifecycle = createMeetingSessionLifecycle();
+ const owner = createMeetingSessionOwner();
return (
<MeetingSessionLifecycleContext.Provider value={lifecycle}>
- {props.children}
+ <MeetingSessionOwnerContext.Provider value={owner}>
+ {props.children}
+ </MeetingSessionOwnerContext.Provider>
</MeetingSessionLifecycleContext.Provider>
);
}
diff --git a/apps/web/src/features/meetings/new-meeting-route.tsx b/apps/web/src/features/meetings/new-meeting-route.tsx
index 3ca794d6a0..dbfe7d0f98 100644
--- a/apps/web/src/features/meetings/new-meeting-route.tsx
+++ b/apps/web/src/features/meetings/new-meeting-route.tsx
@@ -35,6 +35,7 @@ function NewMeetingSetup(props: {
onLeave: (path: string) => void;
}) {
const call = useCallContext();
+ const navigate = useNavigate();
const lifecycle = useMeetingSessionLifecycle();
const author = useAuthor();
const people = useMeetingTeammatesSource(() => props.userId, idToDisplayName);
@@ -88,6 +89,7 @@ function NewMeetingSetup(props: {
<MeetingPage
source={source}
onLeave={props.onLeave}
+ onBack={() => navigate('/app')}
onCallStateChange={(connected) =>
props.onCallStateChange(connected, shareToken())
}
@@ -150,7 +152,7 @@ function NewMeetingSetup(props: {
},
disconnect: call.meetingSession.disconnect,
}}
- renderCall={(onLeave, name) => (
+ renderCall={(onLeave, name, _credentials, copyButton) => (
<div class="flex h-full min-h-0 flex-col">
<Show when={draft.inviteError()}>
<div
@@ -172,6 +174,7 @@ function NewMeetingSetup(props: {
<CallOverlay
onLeave={onLeave}
localName={name()}
+ footerLeading={copyButton}
showTeamSharing={false}
/>
</div>
diff --git a/apps/web/src/features/meetings/primitives/meeting-session-owner.ts b/apps/web/src/features/meetings/primitives/meeting-session-owner.ts
new file mode 100644
index 0000000000..f7d068c117
--- /dev/null
+++ b/apps/web/src/features/meetings/primitives/meeting-session-owner.ts
@@ -0,0 +1,118 @@
+import { Telemetry } from '@macro-inc/observability';
+import { createEffect, createRoot, getOwner, onCleanup } from 'solid-js';
+import type { MeetingSessionCapabilities } from '../context/meeting-session';
+import { createMeetingSession } from './meeting-session';
+
+type OwnedSession = {
+ capabilities: MeetingSessionCapabilities;
+ session: ReturnType<typeof createMeetingSession>;
+ dispose: () => void;
+ attached: boolean;
+};
+
+/** A disposable session root belongs to the provider, not the meeting route. */
+export function createMeetingSessionOwner() {
+ const owner = getOwner();
+ const sessions = new Set<OwnedSession>();
+
+ function remove(
+ entry: OwnedSession,
+ reason: 'detached' | 'disconnected' | 'provider_cleanup'
+ ) {
+ const span = Telemetry.span('meeting.session.dispose');
+ try {
+ return span.run(() => {
+ const callId = entry.session.joinedCallId();
+ if (callId) span.setAttr('call.id', callId);
+ span.setAttr('meeting.session.dispose_reason', reason);
+ sessions.delete(entry);
+ entry.dispose();
+ });
+ } catch (error) {
+ span.error(error);
+ throw error;
+ } finally {
+ span.end();
+ }
+ }
+
+ function detach(entry: OwnedSession) {
+ if (!entry.attached) return;
+ const span = Telemetry.span('meeting.session.detach');
+ try {
+ return span.run(() => {
+ entry.attached = false;
+ const callId = entry.session.joinedCallId();
+ if (callId) span.setAttr('call.id', callId);
+ if (
+ callId &&
+ entry.capabilities.isInCall() &&
+ entry.capabilities.activeCallId() === callId
+ ) {
+ span.setAttr('meeting.session.outcome', 'retained');
+ return;
+ }
+ span.setAttr('meeting.session.outcome', 'disposed');
+ remove(entry, 'detached');
+ });
+ } catch (error) {
+ span.error(error);
+ throw error;
+ } finally {
+ span.end();
+ }
+ }
+
+ function acquire(capabilities: MeetingSessionCapabilities) {
+ const span = Telemetry.span('meeting.session.acquire');
+ try {
+ return span.run(() => {
+ const existing = [...sessions].find(
+ (entry) =>
+ !entry.attached &&
+ !!capabilities.shareToken() &&
+ entry.capabilities.shareToken() === capabilities.shareToken() &&
+ entry.session.joinedCallId() === capabilities.activeCallId() &&
+ capabilities.isInCall()
+ );
+ if (existing) {
+ const callId = existing.session.joinedCallId();
+ if (callId) span.setAttr('call.id', callId);
+ span.setAttr('meeting.session.outcome', 'reused');
+ existing.attached = true;
+ return { session: existing.session, detach: () => detach(existing) };
+ }
+ span.setAttr('meeting.session.outcome', 'created');
+ let entry!: OwnedSession;
+ createRoot((dispose) => {
+ const session = createMeetingSession(capabilities);
+ entry = { capabilities, session, dispose, attached: true };
+ createEffect(() => {
+ const callId = session.joinedCallId();
+ const connected = capabilities.isInCall();
+ const activeId = capabilities.activeCallId();
+ if (
+ !entry.attached &&
+ callId &&
+ (!connected || activeId !== callId)
+ )
+ remove(entry, 'disconnected');
+ });
+ }, owner);
+ sessions.add(entry);
+ return { session: entry.session, detach: () => detach(entry) };
+ });
+ } catch (error) {
+ span.error(error);
+ throw error;
+ } finally {
+ span.end();
+ }
+ }
+
+ onCleanup(() => {
+ for (const entry of sessions) remove(entry, 'provider_cleanup');
+ sessions.clear();
+ });
+ return { acquire };
+}
diff --git a/apps/web/src/features/meetings/primitives/meeting-session.ts b/apps/web/src/features/meetings/primitives/meeting-session.ts
index d8eb611b97..c257101c29 100644
--- a/apps/web/src/features/meetings/primitives/meeting-session.ts
+++ b/apps/web/src/features/meetings/primitives/meeting-session.ts
@@ -17,6 +17,7 @@ type IssuedMeetingSession = {
export function createMeetingSession(capabilities: MeetingSessionCapabilities) {
const [joining, setJoining] = createSignal(false);
const [joinedCallId, setJoinedCallId] = createSignal<string>();
+ const [joinedName, setJoinedName] = createSignal<string>();
const [credentials, setCredentials] = createSignal<MeetingCredentials>();
const [error, setError] = createSignal<string>();
const [hasLeft, setHasLeft] = createSignal(false);
@@ -87,6 +88,7 @@ export function createMeetingSession(capabilities: MeetingSessionCapabilities) {
setError(undefined);
setHasLeft(false);
setJoinedCallId(undefined);
+ setJoinedName(undefined);
const previousSession = issuedSession;
issuedSession = undefined;
let issued: IssuedMeetingSession | undefined;
@@ -164,6 +166,7 @@ export function createMeetingSession(capabilities: MeetingSessionCapabilities) {
);
if (disposed || attempt !== generation) return;
setJoinedCallId(issued.credentials.callId);
+ setJoinedName(displayName?.trim());
joinTrace.setAttr('meeting.join.outcome', 'connected');
} catch (cause) {
// Provider errors may include credentials or a capability URL.
@@ -219,6 +222,7 @@ export function createMeetingSession(capabilities: MeetingSessionCapabilities) {
if (!disposed) {
setJoining(false);
setJoinedCallId(undefined);
+ setJoinedName(undefined);
setHasLeft(true);
}
// Start the keepalive release before awaiting local RTC disconnection:
@@ -252,5 +256,14 @@ export function createMeetingSession(capabilities: MeetingSessionCapabilities) {
fireAndForget(leave(), 'meetings');
});
- return { join, leave, joining, joinedCallId, credentials, error, hasLeft };
+ return {
+ join,
+ leave,
+ joining,
+ joinedCallId,
+ joinedName,
+ credentials,
+ error,
+ hasLeft,
+ };
}
diff --git a/apps/web/src/features/meetings/views/meeting-page-auth.test.tsx b/apps/web/src/features/meetings/views/meeting-page-auth.test.tsx
index 5c81ffb6e9..575b9caa11 100644
--- a/apps/web/src/features/meetings/views/meeting-page-auth.test.tsx
+++ b/apps/web/src/features/meetings/views/meeting-page-auth.test.tsx
@@ -8,6 +8,7 @@ import {
} from '@solidjs/testing-library';
import { createSignal } from 'solid-js';
import { afterEach, expect, it, vi } from 'vitest';
+import { MeetingSessionProvider } from '../meeting-session-provider';
import { createMeetingSessionLifecycle } from '../primitives/meeting-session-lifecycle';
import { MeetingPage } from './meeting-page';
@@ -74,52 +75,54 @@ it.each([
const onLeave = vi.fn();
const onCallStateChange = vi.fn();
render(() => (
- <MeetingPage
- source={() => ({
- kind: 'ready',
- title: 'Call',
- channelId: test.channelId,
- scheduledStart: test.scheduledStart,
- scheduledEnd: null,
- })}
- authenticated={() => test.authenticated}
- author={() => 'Member'}
- onCopy={async () => {}}
- onLeave={onLeave}
- onCallStateChange={onCallStateChange}
- mediaAccess={{
- request: async () => {
- throw new DOMException('Denied', 'NotAllowedError');
- },
- }}
- session={{
- lifecycle: createMeetingSessionLifecycle(),
- shareToken: () => 'token',
- isInCall: () => activeCallId() !== null,
- activeCallId,
- join: async () => ({
- callId: 'call-1',
+ <MeetingSessionProvider>
+ <MeetingPage
+ source={() => ({
+ kind: 'ready',
+ title: 'Call',
channelId: test.channelId,
- roomName: 'room',
- serverUrl: 'wss://example.com',
- token: 'token',
- participantId: 'member',
- shareToken: 'share',
- }),
- release: () => released,
- connect: async () => {
- setActiveCallId('call-1');
- },
- disconnect: async () => {
- setActiveCallId(null);
- },
- }}
- renderCall={(leave) => (
- <button type="button" onClick={leave}>
- Hang up
- </button>
- )}
- />
+ scheduledStart: test.scheduledStart,
+ scheduledEnd: null,
+ })}
+ authenticated={() => test.authenticated}
+ author={() => 'Member'}
+ onCopy={async () => {}}
+ onLeave={onLeave}
+ onCallStateChange={onCallStateChange}
+ mediaAccess={{
+ request: async () => {
+ throw new DOMException('Denied', 'NotAllowedError');
+ },
+ }}
+ session={{
+ lifecycle: createMeetingSessionLifecycle(),
+ shareToken: () => 'token',
+ isInCall: () => activeCallId() !== null,
+ activeCallId,
+ join: async () => ({
+ callId: 'call-1',
+ channelId: test.channelId,
+ roomName: 'room',
+ serverUrl: 'wss://example.com',
+ token: 'token',
+ participantId: 'member',
+ shareToken: 'share',
+ }),
+ release: () => released,
+ connect: async () => {
+ setActiveCallId('call-1');
+ },
+ disconnect: async () => {
+ setActiveCallId(null);
+ },
+ }}
+ renderCall={(leave) => (
+ <button type="button" onClick={leave}>
+ Hang up
+ </button>
+ )}
+ />
+ </MeetingSessionProvider>
));
if (!test.authenticated)
fireEvent.input(screen.getByRole('textbox', { name: 'Your name' }), {
@@ -155,31 +158,33 @@ it('waits for confirmed membership before rendering setup or requesting devices'
throw new Error('Must not join automatically');
});
render(() => (
- <MeetingPage
- source={() => ({
- kind: 'ready',
- title: 'Channel call',
- channelId: 'channel-1',
- scheduledStart: null,
- scheduledEnd: null,
- })}
- authenticated={authenticated}
- author={() => 'Member'}
- onCopy={async () => {}}
- mediaAccess={{ request }}
- session={{
- lifecycle: createMeetingSessionLifecycle(),
- warmup,
- shareToken: () => 'token',
- isInCall: () => false,
- activeCallId: () => null,
- join,
- release: async () => {},
- connect: async () => {},
- disconnect: async () => {},
- }}
- renderCall={() => <div>Connected</div>}
- />
+ <MeetingSessionProvider>
+ <MeetingPage
+ source={() => ({
+ kind: 'ready',
+ title: 'Channel call',
+ channelId: 'channel-1',
+ scheduledStart: null,
+ scheduledEnd: null,
+ })}
+ authenticated={authenticated}
+ author={() => 'Member'}
+ onCopy={async () => {}}
+ mediaAccess={{ request }}
+ session={{
+ lifecycle: createMeetingSessionLifecycle(),
+ warmup,
+ shareToken: () => 'token',
+ isInCall: () => false,
+ activeCallId: () => null,
+ join,
+ release: async () => {},
+ connect: async () => {},
+ disconnect: async () => {},
+ }}
+ renderCall={() => <div>Connected</div>}
+ />
+ </MeetingSessionProvider>
));
expect(screen.queryByRole('textbox', { name: 'Your name' })).toBeNull();
expect(request).not.toHaveBeenCalled();
diff --git a/apps/web/src/features/meetings/views/meeting-page.tsx b/apps/web/src/features/meetings/views/meeting-page.tsx
index c03a11240d..be731162d2 100644
--- a/apps/web/src/features/meetings/views/meeting-page.tsx
+++ b/apps/web/src/features/meetings/views/meeting-page.tsx
@@ -1,5 +1,7 @@
import { getCallExitPath } from '@channel/Call/call-exit';
+import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
import type { BackgroundEffect } from '@core/media/background-effect';
+import { isMobile } from '@core/mobile/isMobile';
import { fireAndForget } from '@core/util/fireAndForget';
import ArrowLeft from '@icon/system/regular/arrow-left.svg';
import Phone from '@icon/system/regular/phone-call.svg';
@@ -27,11 +29,11 @@ import type {
MeetingPageState,
MeetingSessionCapabilities,
} from '../context/meeting-session';
+import { useMeetingSessionOwner } from '../context/meeting-session-owner';
import {
createMeetingMedia,
type MeetingMediaAccess,
} from '../primitives/meeting-media';
-import { createMeetingSession } from '../primitives/meeting-session';
import { MeetingMediaSetup } from './meeting-media-setup';
export function MeetingPage(props: {
@@ -52,6 +54,8 @@ export function MeetingPage(props: {
onCallStateChange?: (connected: boolean) => void;
/** Explicit hangup, distinct from losing the connection or cancelling setup. */
onLeave?: (path: string) => void;
+ /** Dismiss the route without leaving a connected call. */
+ onBack?: () => void;
/** Supplied only for the creator's New Call setup flow. */
renderInvite?: (joining: Accessor<boolean>) => JSX.Element;
/** Login redirect for channel-linked calls, which are members-only. */
@@ -59,10 +63,14 @@ export function MeetingPage(props: {
renderCall: (
onLeave: () => void,
name: Accessor<string>,
- credentials: Accessor<MeetingCredentials | undefined>
+ credentials: Accessor<MeetingCredentials | undefined>,
+ copyButton: JSX.Element
) => JSX.Element;
}) {
- const session = createMeetingSession(props.session);
+ const owner = useMeetingSessionOwner();
+ const owned = owner.acquire(props.session);
+ const session = owned.session;
+ onCleanup(owned.detach);
const [name, setName] = createSignal('');
const [leaving, setLeaving] = createSignal(false);
let disposed = false;
@@ -79,7 +87,9 @@ export function MeetingPage(props: {
const membersOnly = () =>
ready()?.channelId != null && props.authenticated() !== true;
const displayName = () =>
- props.authenticated() ? props.author() : name().trim();
+ props.authenticated()
+ ? props.author()
+ : (session.joinedName() ?? name().trim());
const inCall = () =>
session.joinedCallId() !== undefined &&
props.session.activeCallId() === session.joinedCallId() &&
@@ -160,40 +170,82 @@ export function MeetingPage(props: {
}
return (
- <main class="ph-no-capture flex h-dvh min-h-0 flex-col bg-surface p-4 text-ink sm:p-6">
- <header class="flex flex-wrap items-center gap-4 pb-4">
- <Show when={!inCall()}>
- <a
- href="/app"
- class="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-ink-muted hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent"
+ <main
+ class="ph-no-capture relative flex h-dvh min-h-0 flex-col bg-surface p-4 text-ink sm:p-6"
+ classList={{ 'mobile:p-0': inCall() }}
+ style={
+ isMobile() && inCall()
+ ? {
+ '--mobile-content-inset-top': 'calc(var(--safe-top, 0px) + 72px)',
+ }
+ : undefined
+ }
+ >
+ <Show when={isMobile() && inCall()}>
+ <header class="absolute inset-x-0 top-[calc(var(--safe-top,0px)+12px)] z-30 flex items-center justify-between px-(--mobile-chrome-gutter)">
+ <HeaderIsland class="h-11 px-1">
+ <Button
+ variant="ghost"
+ size="icon-lg"
+ aria-label="Back"
+ onClick={props.onBack}
+ >
+ <ArrowLeft class="size-6" />
+ </Button>
+ </HeaderIsland>
+ <div class="flex items-center gap-2">
+ <Show when={props.url}>
+ {(url) => <MeetingCopyButton url={url()} onCopy={props.onCopy} />}
+ </Show>
+ </div>
+ </header>
+ </Show>
+ <Show when={!(isMobile() && inCall())}>
+ <header class="flex flex-wrap items-center gap-4 pb-4">
+ <Show
+ when={!inCall() && props.onBack}
+ fallback={
+ <Show when={!inCall()}>
+ <a
+ href="/app"
+ class="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-ink-muted hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent"
+ >
+ <ArrowLeft class="size-4" />
+ Back to Macro
+ </a>
+ </Show>
+ }
>
- <ArrowLeft class="size-4" />
- Back to Macro
- </a>
- </Show>
- <Show
- when={inCall()}
- fallback={
- <div class="flex items-center gap-3">
- <Phone class="size-6 text-accent" />
- <div>
- <p class="text-xs font-medium text-ink-muted">Macro Calls</p>
- <h1 class="text-lg font-semibold">
- {ready()?.title || 'Call'}
- </h1>
+ <button
+ type="button"
+ onClick={props.onBack}
+ class="flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-ink-muted hover:bg-hover focus-visible:outline-2 focus-visible:outline-accent"
+ >
+ <ArrowLeft class="size-4" />
+ Back to Macro
+ </button>
+ </Show>
+ <Show
+ when={inCall()}
+ fallback={
+ <div class="flex items-center gap-3">
+ <Phone class="size-6 text-accent" />
+ <div>
+ <p class="text-xs font-medium text-ink-muted">Macro Calls</p>
+ <h1 class="text-lg font-semibold">
+ {ready()?.title || 'Call'}
+ </h1>
+ </div>
</div>
- </div>
- }
- >
- <MeetingCallHeading
- title={ready()?.title || 'Call'}
- onRename={props.onRename}
- />
- <Show when={props.url}>
- {(url) => <MeetingCopyButton url={url()} onCopy={props.onCopy} />}
+ }
+ >
+ <MeetingCallHeading
+ title={ready()?.title || 'Call'}
+ onRename={props.onRename}
+ />
</Show>
- </Show>
- </header>
+ </header>
+ </Show>
<Switch>
<Match when={leaving()}>
<div
@@ -208,7 +260,12 @@ export function MeetingPage(props: {
{props.renderCall(
() => fireAndForget(leave(), 'meetings'),
displayName,
- session.credentials
+ session.credentials,
+ <Show when={!isMobile() && props.url}>
+ {(url) => (
+ <MeetingCopyButton url={url()} onCopy={props.onCopy} />
+ )}
+ </Show>
)}
</div>
</Match>
diff --git a/apps/web/src/lib/i18n/locales/en/calls.ts b/apps/web/src/lib/i18n/locales/en/calls.ts
index 0801181fb2..e049ee269e 100644
--- a/apps/web/src/lib/i18n/locales/en/calls.ts
+++ b/apps/web/src/lib/i18n/locales/en/calls.ts
@@ -1,4 +1,19 @@
export default {
+ panel: 'Call sidebar',
+ chat: 'Chat',
+ openPanel: 'Open chat and participants',
+ closePanel: 'Close chat and participants',
+ participants: 'Participants',
+ participantsCount: { other: 'Participants ({{count}})' },
+ inCallParticipants: 'In-call participants',
+ localParticipant: '{{name}} (You)',
+ you: 'You',
+ guest: 'Guest',
+ speaking: 'Speaking',
+ microphoneOff: 'Microphone off',
+ microphoneOn: 'Microphone on',
+ cameraOn: 'Camera on',
+ cameraOff: 'Camera off',
shareScreenTitle: 'Share your screen',
shareScreenDescription: 'Choose a screen or window to share with the call.',
screens: 'Screens',
diff --git a/docs/agent-guide/calendar.md b/docs/agent-guide/calendar.md
index 1e4cce94fb..0a60d176e6 100644
--- a/docs/agent-guide/calendar.md
+++ b/docs/agent-guide/calendar.md
@@ -125,8 +125,15 @@ call setup. Existing channel calls and the upcoming-events list remain available
For local verification, set `VITE_ENABLE_QUICK_CALLS=true` or `false` explicitly.
During a quick or scheduled call, signed-in participants can open **Call chat**
-from its separate button at the far right of the bottom toolbar. Messages persist
-with that call session and are visible in its recording page after it ends.
+with **Open chat** at the bottom-right. On desktop, **Copy Meeting Url** sits at
+the bottom-left and becomes icon-only in narrow panes. Active phone calls fill
+the viewport, with persistent Back and Copy Meeting Url header islands. Media/chat
+controls sit below the video, hide after four idle seconds, and return on tap;
+chat and settings keep them visible. Back returns to the app without hanging up.
+Tap or click a participant to focus them; tap again to restore the grid.
+Talking participants have an accent-colored border.
+Desktop chat fills the call content height; phones use a bottom sheet. Messages
+persist with that call session and are visible in its recording page after it ends.
Guests can open the same call discussion and read and send text while connected;
their messages show their name with **(Guest)**. The signed-in composer’s `@` menu includes Macro and available agents;
mentioning one invokes it in the call thread. Reply on any live message, including
diff --git a/docs/agent-guide/calls.md b/docs/agent-guide/calls.md
index cafff5d96c..52d1f86f6f 100644
--- a/docs/agent-guide/calls.md
+++ b/docs/agent-guide/calls.md
@@ -212,25 +212,99 @@ Backgrounds use a simple menu with None, Light blur, Strong blur, and image uplo
Selected devices and backgrounds carry into the call; unsupported browsers use
the system speaker. If a background cannot be applied, the camera stays off
until the user retries or chooses None. The screen uses a gray join
-button. The in-call header has a gray `Copy Meeting Url` button with a copy icon
-and shows the current local time before the call name. Owners can click the name
+button. During a desktop or tablet call, `Copy Meeting Url` sits at the
+bottom-left; narrow panes show only its copy icon. Active phone calls fill the
+available viewport, retaining header islands for Back and Copy Meeting Url.
+The header shows the current local time before the call name. Owners can click the name
to rename it, then Save or press Enter; Cancel or Escape discards the edit. Guests and other participants see a
read-only name.
Join-preview and in-call controls use the standard Macro icon buttons. In a
-call, the microphone and camera are split buttons (`ButtonGroup`): the left half
-toggles the device (pressed while on), and the caret opens a settings menu above
-the toolbar on click only; hovering opens nothing. **Audio settings** lists
-microphones, speakers (when the browser can choose one), and noise suppression.
+call, a fully rounded toolbar contains the controls. The microphone and camera
+are split buttons (`ButtonGroup`): the left half
+toggles the device, with a failure-colored slashed icon when off, and the caret
+opens a settings menu above the toolbar on click only; hovering opens nothing.
+**Audio settings** lists microphones, speakers (when the browser can choose one),
+and a noise suppression switch with its label on the left.
**Video settings** lists cameras and the background effects as tiles: None,
Light blur, Strong blur, a selected custom image, and Upload. Screen share is
-the same kind of split button: the left half starts or stops sharing (pressed
-while sharing), and **Screen share settings** holds **Share audio**, off by
-default, saved per device, and locked while sharing. With it on, the browser
-picker offers tab audio (and system audio where Chromium supports it), and other
-participants hear it alongside microphones, even away from the Call tab. Leave
-call is a separate button. Click outside or press Escape to close a menu.
-The controls also work by keyboard and touch.
+also a split button: the left half starts or stops sharing (pressed while
+sharing), and **Screen share settings** holds **Share audio**, off by default,
+saved per device, and locked while sharing. With it on, the browser picker offers
+tab audio (and system audio where Chromium supports it), and other participants
+hear it alongside microphones, even away from the Call tab. Leave call is a
+separate button. Live channel calls also include **Call sharing** in the toolbar:
+its menu offers **Team sharing** and **Private**, each with a short explanation
+and a checkmark on the current choice. The icon changes between team and lock.
+Audio settings, video settings, screen share settings, and call sharing use
+bottom drawers on phones, with a handle and scrollable options; desktop and
+tablet keep dropdowns.
+The sharing icons align with the option titles, with short descriptions below.
+Click outside or press Escape to close and return focus to the opener. The
+controls also work by keyboard and touch.
+The floating mobile **New** action is hidden while the call view is open and
+returns when you leave the call view. Phone calls also hide the app's bottom
+navigation and channel Invite action, but keep the channel header island visible.
+Invite returns when you leave the call tab, including in the block-hosted channel
+header; Invite remains available on setup screens, desktop, and tablets. Back
+returns to the app without hanging up; when a channel has no navigation history, Back opens its
+Messages tab instead. Only **Leave call** ends participation.
+
+Focus is unavailable when you are the only participant. Otherwise, click or tap
+a participant, including your own tile, to focus them. Focusing
+someone else keeps your own tile in the small picture-in-picture window;
+focusing yourself moves the remote participant grid into that window instead.
+Tap a tile in the small window to switch focus, or use the solid **Back to grid**
+button on the focused tile to restore the grid. If that participant leaves, the grid
+returns automatically. Focus changes keep the existing video tracks mounted.
+A talking participant has an accent-colored border above their video or avatar.
+
+Open **Chat** and **Participants** from the button beside the media controls.
+The sidebar and phone drawer share a compact grouped section switcher at the top.
+**Participants** shows the live attendee count and a scrollable roster, including
+you and connected guests but excluding recording agents. Rows show names,
+avatars, microphone and camera state, and a speaking indicator. Off microphones
+and cameras use the failure color. Known users use the shared user icon:
+hover it on desktop or tap it on touch to open the profile card; guests use
+the shared avatar fallback.
+This is the current call roster, not the channel member list. Participant media
+controls remain read-only. The roster remains available when chat is unavailable,
+without starting message queries.
+
+On phones, the fully rounded control bar fits its buttons instead of filling the
+available width. Controls have 8px gaps, expanding to 12px in roomy bars and
+contracting on narrow phones so all controls fit. The sidebar button stays
+separate on the right with a 48px tap target and the row keeps its side gutters.
+On phones at most 416px wide, the sidebar button moves below the bar so the
+additional screen-share settings control fits without clipping. Controls wrap
+on smaller available widths without shrinking their split-button segments.
+On desktop, the sidebar button stays at the bottom-right and Copy Meeting Url
+stays at the bottom-left, without horizontal padding on the footer row. On
+phones, Copy Meeting Url uses the shared `CopyButton` in a standard 40px
+header island, without custom button colors or sizing. Media controls occupy a
+separate row below the video, never over it. Controls remain visible while idle;
+auto-hide is disabled for now. Header islands also stay visible. Check 320px
+phones, safe-area insets, and rotation.
+
+In wide desktop panes, the sidebar fills the call content height alongside the
+video and controls, with a rounded, raised background. Drag its divider, or focus
+the divider and use the arrow keys, to resize it between 280px and 480px while
+leaving at least 320px for the call. It starts at 360px and retains its resized
+width when closed and reopened. Narrow desktop panes overlay the sidebar;
+phones use the shared bottom sheet instead of a resize handle.
+
+Both presentations have a **Close chat and participants** button beside the tabs.
+Dismiss the sheet with that button, its handle, backdrop, or Escape; desktop also
+closes with Escape. Opening and closing animate unless reduced motion is enabled.
+The desktop sidebar stays anchored to the right edge and closes to the right,
+without crossing the call area. Closing returns focus to the footer button.
+Switching tabs, closing, and resizing preserve the message draft and scroll
+position. Tab changes keep keyboard focus on the selected tab instead of moving
+it into the composer; reopening retains the existing autofocus behavior.
+Message hover actions stay within the chat's scroll viewport. The toolbar wraps
+its action groups when the sidebar is narrow, keeping the final actions inside
+the visible surface. Check the first and last visible messages while scrolling,
+with every action available. Check both signed-in and guest calls.
In the macOS desktop app, Screen share opens Macro's own **Share your screen**
picker (screens first, the main display preselected, then open windows), since
@@ -290,19 +364,22 @@ opening the call tab alone does not create a link. If loading fails, click again
to retry. If clipboard access fails, a selectable URL appears below the button.
A channel call's **Share** dialog has a `Team access` control (None or View) for the same canonical
-team share. Its side panel has a `Sharing` section with one `Share with team` checkbox, and the
-in-call controls carry the same checkbox while a call is live. It is canonical team sharing (the
-same `Team access` model documents and AI chats use), fixed at **view**. While the call is **live**
-the checkbox is a pending toggle (on by default for channel calls)
-that any participant with edit access can flip;
-other participants see it update live. When the call ends it is applied: with the toggle on,
-everyone on the creator's team can open the recorded call, read the transcript and AI summary,
-and find it under Calls and in search; off means nothing is shared. Afterwards only the call's
-**creator** can change it — everyone else sees the checkbox read-only with a note saying so.
+team share. Its side panel has a `Sharing` section with one `Share with team` checkbox.
+While a call is live, the controls bar instead has a **Call sharing** dropdown with
+**Team sharing** and **Private** options. Each option explains the resulting team
+access under its name; choosing the current option does not save again. Controls
+are disabled while connecting or saving. Team sharing is canonical **view** access
+(the same `Team access` model documents and AI chats use), enabled by default for
+channel calls. Any participant with edit access can change it, and other
+participants see it update live. When the call ends, **Team sharing** lets the
+creator's team open the recorded call, read the transcript and AI summary, and find
+it under Calls and in search; **Private** grants no automatic team access.
+Afterwards only the call's **creator** can change it; everyone else sees the
+side-panel checkbox read-only with a note saying so.
Team sharing is independent of channel access and of link sharing.
Standalone instant and scheduled calls are excluded from team memory. They have no
-`Share with team` or `Team access` controls during the call or on the saved recording.
+team-sharing or `Team access` controls during the call or on the saved recording.
Signed-in participants keep direct access to their recordings, transcripts, and summaries;
joining a standalone call never makes its content available to the wider team.
diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.md
index af24a4bd83..d738060bf1 100644
--- a/docs/agent-guide/channels.md
+++ b/docs/agent-guide/channels.md
@@ -1429,11 +1429,21 @@ produce one connection; leaving from either control ends the same call. Navigate
away and return while connected to check that the call and its controls remain
usable.
-The **Open chat** button in its own island at the far right of the bottom toolbar
-opens the chat beside the video. The panel has no header or divider above the
-composer. The media controls stay centered. On narrow screens it overlays the
-video. The same toolbar button, now **Close chat**, or Escape closes the panel
-and returns focus to the chat button; reopening preserves the draft and scroll
+The **Open chat** button at the bottom-right opens chat beside the video.
+**Copy Meeting Url** sits at the bottom-left on desktop and becomes icon-only in narrow panes.
+Active phone calls keep the channel header island and place Copy Meeting Url
+in a matching header island using the shared `CopyButton`. The media control bar
+fills the space beside the separate chat button, below the video and within side
+insets. Back keeps the call running. Controls and header islands stay visible;
+idle auto-hide is disabled. Phone calls hide the app's bottom navigation and
+channel Invite action; Invite returns when leaving the live call tab. Tap or click a participant to
+focus them and tap again to return to the grid; speakers have an accent border.
+The panel has a **Call chat** heading and
+spans the full call content height, including the media controls row. The controls
+stay centered under the video on wide panes. In narrow desktop panes, chat overlays
+the video. On phones, chat opens in the shared bottom sheet; drag the handle, tap the backdrop, or press Escape
+to dismiss it. On desktop, **Close chat** or Escape closes the panel. Closing
+returns focus to the chat button, and reopening preserves the draft and scroll
position. The call continues while chat is open or closed.
Signed-in participants in channel, quick, and scheduled calls use the same chat
@@ -1526,8 +1536,9 @@ cancellation, and focus restoration before sending invites.
Inset tabs sit in the channel header:
`Messages` / `Attachments` / `Calls` / `Participants`.
-`Ask Macro`, `Invite`, and `Call` actions remain in the header. On narrow desktop
-panes, the tabs collapse from text labels to icons. Standalone mobile channels
+`Ask Macro`, `Invite`, and `Call` actions remain in channel headers, with the
+live-phone-call exceptions described above. On narrow desktop panes, the tabs
+collapse from text labels to icons. Standalone mobile channels
keep view selection in the title menu. In both a single channel and an adjacent
channel split, the message composer stays fully visible at the bottom. The
`Calls` tab lists
diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.md
index 02344e0e84..e735df2938 100644
--- a/docs/agent-guide/navigation.md
+++ b/docs/agent-guide/navigation.md
@@ -1020,7 +1020,13 @@ hides during search, when a page supplies its own reply or compose controls
(including the full-screen new-email composer, whose send actions sit in its
header), or when an editable field outside Ask AI is focused on a touch device. The AI draft
is preserved when the row returns.
-The New button also hides while the software keyboard is open.
+The New button also hides while the software keyboard is open or a live call
+view is in the foreground. Leaving the call view restores the current page's
+action, even if the call continues in the background.
+Active phone calls hide the bottom dock but retain the channel header island.
+Their Back button returns to the app while the call continues; tablets keep app
+chrome. Phone media controls sit below the video and hide when idle without
+resizing it; the header islands remain visible.
After closing mobile search with the keyboard open or leaving a focused editor,
verify that the current view’s New action returns once the keyboard closes.
Removing the focused editor must not leave the action hidden on subsequent views.