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.

fix(calls): improve controls layout and camera-off styling (#7746)

Eric Hayesab5abefea170
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
index c983739677..62bdd048cd 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
@@ -21,6 +21,7 @@ export function CallControlButton(props: {
pressed?: boolean;
disabled?: boolean;
danger?: boolean;
+ class?: string;
onClick: () => void;
children: JSX.Element;
}) {
@@ -33,7 +34,7 @@ export function CallControlButton(props: {
aria-pressed={props.pressed}
disabled={props.disabled}
onClick={props.onClick}
- class="size-10 @sm:size-12"
+ class={`size-10 @sm:size-12 ${props.class ?? ''}`}
>
{props.children}
</Button>
@@ -145,11 +146,12 @@ export function CallControlBar(props: {
<div
role="group"
aria-label={group.label}
- class="flex items-center gap-0.5"
+ class="flex items-center rounded-full border border-edge-muted bg-control"
onPointerEnter={(event) => preview(group.kind, event)}
onPointerLeave={cancelIntent}
>
<CallControlButton
+ class="rounded-r-none"
label={group.toggleLabel}
pressed={group.active}
disabled={props.disabled || group.disabled}
@@ -174,7 +176,7 @@ export function CallControlBar(props: {
?.focus();
}
}}
- class="h-10 w-5 @sm:h-12 @sm:w-8"
+ class="h-10 w-6 rounded-l-none border-l-edge-muted @sm:h-12 @sm:w-8"
>
<CaretUp
class="size-4 transition-transform duration-200 ease-out motion-reduce:transition-none"
diff --git a/apps/web/src/features/channel/Call/CallOverlay.tsx b/apps/web/src/features/channel/Call/CallOverlay.tsx
index 5274eaf2a6..3abfb24825 100644
--- a/apps/web/src/features/channel/Call/CallOverlay.tsx
+++ b/apps/web/src/features/channel/Call/CallOverlay.tsx
@@ -23,6 +23,7 @@ import {
} from './call-panel-breakpoints';
import { LK_TRACK_SOURCE } from './livekit-loader';
import { MutedMicrophoneBadge } from './MutedMicrophoneBadge';
+import { ParticipantAvatarBackground } from './ParticipantAvatarBackground';
import { TrackView } from './TrackView';
import { useActiveCallTeamShare } from './use-toggle-share-with-team';
@@ -84,8 +85,11 @@ function ParticipantAvatar(props: {
};
return (
- <div class="flex items-center justify-center size-full p-4">
- <div class={avatarClass()}>
+ <div class="relative flex items-center justify-center size-full p-4">
+ <Show when={props.userId?.trim()} keyed>
+ {(userId) => <ParticipantAvatarBackground userId={userId} />}
+ </Show>
+ <div class={cn('relative', avatarClass())}>
<Show
when={props.userId?.trim()}
keyed
@@ -419,7 +423,12 @@ export function CallOverlay(props: {
</Show>
</div>
{/* Settings expand over the tiles; sharing stays clear of the controls. */}
- <div class="relative flex shrink-0 flex-col items-center gap-2 py-3">
+ <div
+ class="relative flex shrink-0 flex-col items-center gap-2 py-3"
+ classList={{
+ '@min-[800px]/call:mr-90': canChat() && chatOpen(),
+ }}
+ >
<Show
when={
callCtx.activeChannelId() !== null &&
@@ -456,13 +465,16 @@ export function CallOverlay(props: {
</button>
</Tooltip>
</Show>
- <div class="grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-2 @min-[500px]/call:gap-3 @min-[500px]/call:px-3 @min-[800px]/call:grid-cols-[minmax(0,1fr)_minmax(0,36rem)_minmax(0,1fr)]">
- <div
- class="flex min-w-0 justify-center @min-[800px]/call:col-start-2"
- classList={{
- 'col-span-2 @min-[800px]/call:col-span-1': !canChat(),
- }}
- >
+ <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)]':
+ canChat(),
+ 'grid-cols-[minmax(0,1fr)_minmax(0,36rem)_minmax(0,1fr)]':
+ !canChat(),
+ }}
+ >
+ <div class="col-start-2 flex min-w-0 justify-center">
<CallControls onLeave={props.onLeave} />
</div>
<Show when={canChat()}>
diff --git a/apps/web/src/features/channel/Call/ParticipantAvatarBackground.tsx b/apps/web/src/features/channel/Call/ParticipantAvatarBackground.tsx
new file mode 100644
index 0000000000..408552a6b6
--- /dev/null
+++ b/apps/web/src/features/channel/Call/ParticipantAvatarBackground.tsx
@@ -0,0 +1,71 @@
+import { ENABLE_PROFILE_PICTURES } from '@core/constant/featureFlags';
+import { staticFileSizedUrl } from '@core/constant/servers';
+import { useProfilePictureUrl } from '@core/signal/profilePicture';
+import { createEffect, createSignal, on, onCleanup } from 'solid-js';
+
+/** Transparent pixels don't contribute to the visible picture's average. */
+function averageAvatarColor(pixels: Uint8ClampedArray): string | undefined {
+ let red = 0;
+ let green = 0;
+ let blue = 0;
+ let weight = 0;
+ for (let i = 0; i < pixels.length; i += 4) {
+ const alpha = pixels[i + 3];
+ red += pixels[i] * alpha;
+ green += pixels[i + 1] * alpha;
+ blue += pixels[i + 2] * alpha;
+ weight += alpha;
+ }
+ if (!weight) return;
+ return `rgb(${Math.round(red / weight)} ${Math.round(green / weight)} ${Math.round(blue / weight)})`;
+}
+
+export function ParticipantAvatarBackground(props: { userId: string }) {
+ const [url] = useProfilePictureUrl(props.userId);
+ const [color, setColor] = createSignal<string>();
+
+ createEffect(
+ on(url, (source) => {
+ setColor(undefined);
+ if (!ENABLE_PROFILE_PICTURES || !source) return;
+ const image = new Image();
+ const thumbnail = staticFileSizedUrl(source, 'small');
+ let usingOriginal = thumbnail === source;
+ image.crossOrigin = 'anonymous';
+ image.onload = () => {
+ try {
+ const canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 32;
+ const context = canvas.getContext('2d');
+ if (!context) return;
+ context.drawImage(image, 0, 0, 32, 32);
+ setColor(averageAvatarColor(context.getImageData(0, 0, 32, 32).data));
+ } catch {
+ // Some external avatars disallow canvas reads; retain the panel color.
+ }
+ };
+ image.onerror = () => {
+ if (usingOriginal) return;
+ usingOriginal = true;
+ image.src = source;
+ };
+ image.src = thumbnail;
+ onCleanup(() => {
+ image.onload = null;
+ image.onerror = null;
+ });
+ })
+ );
+
+ return (
+ <div
+ aria-hidden="true"
+ class="pointer-events-none absolute inset-0"
+ style={{
+ background: color()
+ ? `linear-gradient(135deg, color-mix(in srgb, ${color()} 24%, var(--color-panel)), color-mix(in srgb, ${color()} 8%, var(--color-panel)))`
+ : undefined,
+ }}
+ />
+ );
+}
diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.md
index 116b10bdd8..aa5aedf8a7 100644
--- a/docs/agent-guide/channels.md
+++ b/docs/agent-guide/channels.md
@@ -1204,6 +1204,14 @@ Leaving from the channel's call controls switches to `Messages` immediately.
Disconnect and server cleanup continue after that switch; slow or failed RTC
teardown must not leave the channel showing the join screen.
+In a live call, controls stay centered beneath the participant area when chat
+opens beside it. Microphone, camera, and background controls each have an icon
+button on the left and a settings caret on the right, separated by a divider.
+The icon toggles the feature; hover previews settings and the caret pins them.
+Check both chat states and narrow layouts, including Escape and keyboard focus
+in settings. Camera-off tiles use a subtle gradient from the profile picture's
+average color; missing or unreadable pictures keep the neutral panel background.
+
`Participants` tab keeps people and bots within the available page height, with
separate scrolling lists and fixed search/invite controls. Team access appears
between them when available. Search uses the shared