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): unify share links and glassify call settings (#7172)

Eric Hayescb6d071aa07a
diff --git a/apps/web/src/features/channel/Call/ActiveCallLink.tsx b/apps/web/src/features/channel/Call/ActiveCallLink.tsx
index 0f6d962b98..6b3e5e5bbd 100644
--- a/apps/web/src/features/channel/Call/ActiveCallLink.tsx
+++ b/apps/web/src/features/channel/Call/ActiveCallLink.tsx
@@ -1,82 +1,31 @@
import { useCallLinkQuery } from '@queries/call/meetings';
-import { createSignal, Show, Suspense } from 'solid-js';
-import { MeetingLink } from '../../meetings/components/meeting-link';
+import { Show, Suspense } from 'solid-js';
+import { MeetingCopyButton } from '../../meetings/components/meeting-copy-button';
import { useQuickCallsFlag } from '../../meetings/use-quick-calls-flag';
import { useCallContext } from './CallContext';
import { getMeetingUrl } from './call-link';
function ActiveCallLinkContent() {
const call = useCallContext();
- // Creating a share link grants access, so require an explicit request.
- const [requested, setRequested] = createSignal(false);
- const link = useCallLinkQuery(() =>
- requested() ? (call.activeCallId() ?? undefined) : undefined
- );
- const [copied, setCopied] = createSignal(false);
- const [copyError, setCopyError] = createSignal(false);
- const url = () =>
- link.isSuccess ? getMeetingUrl(link.data.shareToken) : undefined;
+ // Creating a share link grants access, so fetch only on an explicit copy.
+ const link = useCallLinkQuery(() => call.activeCallId() ?? undefined, {
+ enabled: false,
+ });
+ const url = () => (link.isSuccess ? getMeetingUrl(link.data.shareToken) : '');
async function copy() {
- const value = url();
- if (!value) return;
- try {
- await navigator.clipboard.writeText(value);
- setCopied(true);
- setCopyError(false);
- } catch {
- setCopyError(true);
- }
+ if (!call.activeCallId()) return;
+ const result = await link.refetch();
+ if (!result.isSuccess) throw result.error;
+ await navigator.clipboard.writeText(getMeetingUrl(result.data.shareToken));
}
return (
- <Show
- when={requested()}
- fallback={
- <button
- type="button"
- class="text-xs text-accent"
- onClick={() => setRequested(true)}
- >
- Get shareable call link
- </button>
- }
- >
- <Show
- when={url()}
- fallback={
- <Show
- when={link.isError}
- fallback={
- <p class="text-xs text-ink-muted">Preparing call link…</p>
- }
- >
- <button
- type="button"
- class="text-xs text-accent"
- onClick={() => void link.refetch()}
- >
- Could not load call link. Try again
- </button>
- </Show>
- }
- >
- {(url) => (
- <div class="min-w-0">
- <MeetingLink
- url={url()}
- copied={copied()}
- onCopy={() => void copy()}
- />
- <p class="mt-1 text-xs text-ink-muted">
- {copyError()
- ? 'Select the link to copy it manually.'
- : 'Anyone signed in to Macro with this link can join.'}
- </p>
- </div>
- )}
- </Show>
- </Show>
+ <MeetingCopyButton
+ url={url()}
+ onCopy={copy}
+ disabled={!call.activeCallId()}
+ />
);
}
@@ -84,9 +33,7 @@ export function ActiveCallLink() {
const flag = useQuickCallsFlag();
return (
<Show when={!flag().loading && flag().enabled}>
- <Suspense
- fallback={<p class="text-xs text-ink-muted">Loading call link…</p>}
- >
+ <Suspense>
<ActiveCallLinkContent />
</Suspense>
</Show>
diff --git a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
index 4544fa56bd..f643b89197 100644
--- a/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
+++ b/apps/web/src/features/channel/Call/CallControls/CallControlBar.tsx
@@ -224,7 +224,7 @@ export function CallControlBar(props: {
cancelIntent();
}}
>
- <div class="rounded-xl border border-edge-muted bg-panel shadow-md">
+ <div class="rounded-xl bg-menu-glass text-ink glass">
<div
aria-hidden={displayedSection() !== 'audio'}
inert={displayedSection() !== 'audio'}
@@ -270,7 +270,7 @@ export function CallControlBar(props: {
</div>
</div>
</div>
- <div class="mx-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-1 rounded-xl border border-edge-muted bg-panel p-1.5 shadow-sm @sm:gap-2">
+ <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">
<MediaGroup
kind="audio"
active={!props.audioMuted}
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
new file mode 100644
index 0000000000..38317795e8
--- /dev/null
+++ b/apps/web/src/features/channel/Call/tests/active-call-link.test.tsx
@@ -0,0 +1,93 @@
+/** @vitest-environment jsdom */
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
+import { errAsync, okAsync } from 'neverthrow';
+import type { JSX } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ActiveCallLink } from '../ActiveCallLink';
+
+const mocks = vi.hoisted(() => ({
+ getCallLink: vi.fn(),
+ writeText: vi.fn(),
+}));
+
+vi.mock('@service-call/client', () => ({
+ callServiceClient: { getCallLink: mocks.getCallLink },
+}));
+vi.mock('../CallContext', () => ({
+ useCallContext: () => ({ activeCallId: () => 'call-id' }),
+}));
+vi.mock('../../../meetings/use-quick-calls-flag', () => ({
+ useQuickCallsFlag: () => () => ({ loading: false, enabled: true }),
+}));
+vi.mock('@ui', async () => ({
+ ...(await import('../../../../components/ui/components/Button')),
+ Tooltip: (props: { children: JSX.Element }) => props.children,
+}));
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.getCallLink.mockReturnValue(okAsync({ shareToken: 'share-token' }));
+ mocks.writeText.mockResolvedValue(undefined);
+ Object.defineProperty(navigator, 'clipboard', {
+ configurable: true,
+ value: { writeText: mocks.writeText },
+ });
+});
+afterEach(cleanup);
+
+function setup() {
+ const client = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ render(() => (
+ <QueryClientProvider client={client}>
+ <ActiveCallLink />
+ </QueryClientProvider>
+ ));
+ return screen.getByRole('button', { name: 'Copy Meeting Url' });
+}
+
+describe('channel call link', () => {
+ it('creates and copies a link only after an explicit click', async () => {
+ const button = setup();
+ expect(mocks.getCallLink).not.toHaveBeenCalled();
+ expect(screen.queryByRole('textbox')).toBeNull();
+ fireEvent.click(button);
+ await waitFor(() =>
+ expect(mocks.writeText).toHaveBeenCalledWith(
+ expect.stringContaining('/app/meet/join/share-token')
+ )
+ );
+ expect(mocks.getCallLink).toHaveBeenCalledWith('call-id');
+ expect(screen.getByRole('status').textContent).toBe('Meeting URL copied');
+ });
+
+ it('offers a retry when loading the link fails', async () => {
+ mocks.getCallLink.mockReturnValueOnce(
+ errAsync([{ code: 'UNAVAILABLE', message: 'Unavailable' }])
+ );
+ const button = setup();
+ fireEvent.click(button);
+ await screen.findByText('Could not load call link. Try again.');
+ expect(mocks.writeText).not.toHaveBeenCalled();
+ expect(screen.queryByRole('textbox')).toBeNull();
+ fireEvent.click(button);
+ await waitFor(() => expect(mocks.writeText).toHaveBeenCalledTimes(1));
+ });
+
+ it('provides a selectable URL when clipboard access fails', async () => {
+ mocks.writeText.mockRejectedValue(new Error('Clipboard denied'));
+ fireEvent.click(setup());
+ const input = await screen.findByRole('textbox', { name: 'Call link' });
+ expect((input as HTMLInputElement).value).toContain(
+ '/app/meet/join/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 5ac16b05e0..3a4e55d027 100644
--- a/apps/web/src/features/meetings/components/meeting-copy-button.tsx
+++ b/apps/web/src/features/meetings/components/meeting-copy-button.tsx
@@ -6,9 +6,11 @@ import { createSignal, onCleanup, Show } from 'solid-js';
export function MeetingCopyButton(props: {
url: string;
onCopy: () => Promise<void>;
+ disabled?: boolean;
}) {
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(() => {
@@ -17,6 +19,9 @@ export function MeetingCopyButton(props: {
});
async function copy() {
+ if (copying()) return;
+ setCopying(true);
+ setError(false);
try {
await props.onCopy();
if (disposed) return;
@@ -29,6 +34,8 @@ export function MeetingCopyButton(props: {
clearTimeout(reset);
setCopied(false);
setError(true);
+ } finally {
+ if (!disposed) setCopying(false);
}
}
@@ -38,6 +45,8 @@ export function MeetingCopyButton(props: {
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={() => void copy()}
>
@@ -51,15 +60,19 @@ export function MeetingCopyButton(props: {
</span>
<Show when={error()}>
<p role="status" class="mt-2 text-xs">
- Could not copy. Select the URL to copy it manually.
+ {props.url
+ ? 'Could not copy. Select the URL to copy it manually.'
+ : 'Could not load call link. Try again.'}
</p>
- <input
- aria-label="Call link"
- readOnly
- value={props.url}
- onFocus={(event) => event.currentTarget.select()}
- class="mt-1 w-full bg-transparent text-xs text-ink-muted outline-none"
- />
+ <Show when={props.url}>
+ <input
+ aria-label="Call link"
+ readOnly
+ value={props.url}
+ onFocus={(event) => event.currentTarget.select()}
+ class="mt-1 w-full bg-transparent text-xs text-ink-muted outline-none"
+ />
+ </Show>
</Show>
</div>
);
diff --git a/apps/web/src/lib/queries/call/meetings.ts b/apps/web/src/lib/queries/call/meetings.ts
index d18e9079cb..b168ddfa36 100644
--- a/apps/web/src/lib/queries/call/meetings.ts
+++ b/apps/web/src/lib/queries/call/meetings.ts
@@ -106,11 +106,14 @@ export function useCancelMeetingMutation() {
}));
}
-export function useCallLinkQuery(callId: Accessor<string | undefined>) {
+export function useCallLinkQuery(
+ callId: Accessor<string | undefined>,
+ options?: { enabled?: boolean }
+) {
return useQuery(() => ({
queryKey: callKeys.link(callId() ?? '').queryKey,
queryFn: () => throwOnErr(() => callServiceClient.getCallLink(callId()!)),
- enabled: Boolean(callId()),
+ enabled: Boolean(callId()) && (options?.enabled ?? true),
staleTime: Infinity,
retry: false,
}));
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index fff297f963..9726f793cc 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1145,7 +1145,8 @@ Join-preview and in-call controls use the standard Macro icon buttons. Pause
over the microphone, camera, or background group to reveal an animated settings popover
above the call toolbar; click its caret to keep it open. Brief pointer passes
do not open settings, and moving into the popover keeps it open. Settings
-respect reduced-motion preferences.
+respect reduced-motion preferences. The toolbar and settings panels use Macro's
+shared glass surface in both light and dark themes.
Audio settings include microphone, speaker, and noise suppression. Camera
settings include the camera selector. Clicking the background icon toggles the
selected effect off/on, restoring the last blur strength or image (Strong blur
@@ -1156,6 +1157,11 @@ The controls also work by keyboard and touch.
### Sharing a call
+With quick calls enabled, channel calls use the same **Copy Meeting Url** button
+as instant and scheduled calls. Clicking it creates the share link and copies it;
+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