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(style): restyle call team share toggle (#3200)

Aidan Holloway-Bidwell9bd5da168450
diff --git a/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx b/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
index ed9ca2603d..97abe76de5 100644
--- a/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
+++ b/js/app/packages/channel/Call/CallControls/CallControlsDefaultAndPanelRow.tsx
@@ -7,12 +7,10 @@ import {
import Microphone from '@icon/regular/microphone.svg';
import MicrophoneSlash from '@icon/regular/microphone-slash.svg';
import Screencast from '@icon/regular/screencast.svg';
-import Users from '@icon/regular/users.svg';
import VideoCamera from '@icon/regular/video-camera.svg';
import VideoCameraSlash from '@icon/regular/video-camera-slash.svg';
import { DropdownMenu } from '@kobalte/core/dropdown-menu';
import PhoneDisconnect from '@macro-icons/wide/call-disconnect.svg';
-import { useToggleShareWithTeamMutation } from '@queries/call/call';
import { cn } from '@ui';
import { type Accessor, For, Show } from 'solid-js';
import { BACKGROUND_IMAGES, useCallContext } from '../CallContext';
@@ -156,15 +154,6 @@ export function CallControlsDefaultAndPanelRow(
const isConnecting = () => callCtx.isConnecting();
const size = () => props.size();
const iconClass = () => (size() === 'sm' ? 'w-4 h-4' : 'w-5 h-5');
- const toggleShareWithTeam = useToggleShareWithTeamMutation();
-
- const handleToggleShareWithTeam = async () => {
- const callId = callCtx.activeCallId();
- if (!callId) return;
- const newValue = await toggleShareWithTeam.mutateAsync(callId);
- callCtx.setSharedWithTeam(newValue);
- };
-
return (
<div
data-call-controls
@@ -246,16 +235,6 @@ export function CallControlsDefaultAndPanelRow(
<Screencast class={iconClass()} />
</CallControlButton>
- <CallControlButton
- class="border-0"
- size={size()}
- onClick={handleToggleShareWithTeam}
- active={callCtx.isSharedWithTeam()}
- disabled={isConnecting()}
- >
- <Users class={iconClass()} />
- </CallControlButton>
-
<CallControlButton
class="border-0"
size={size()}
diff --git a/js/app/packages/channel/Call/CallControls/CallControlsPanelSmallRow.tsx b/js/app/packages/channel/Call/CallControls/CallControlsPanelSmallRow.tsx
index 2e6d97b0a4..80628f54b6 100644
--- a/js/app/packages/channel/Call/CallControls/CallControlsPanelSmallRow.tsx
+++ b/js/app/packages/channel/Call/CallControls/CallControlsPanelSmallRow.tsx
@@ -1,16 +1,18 @@
+import { MiniToggleSwitch } from '@core/component/FormControls/MiniToggleSwitch';
import { DropdownMenuContent, MENU_ITEM_CLASS } from '@core/component/Menu';
import CheckIcon from '@icon/bold/check-bold.svg';
+import Info from '@icon/regular/info.svg';
import Microphone from '@icon/regular/microphone.svg';
import MicrophoneSlash from '@icon/regular/microphone-slash.svg';
import Screencast from '@icon/regular/screencast.svg';
-import Users from '@icon/regular/users.svg';
import VideoCamera from '@icon/regular/video-camera.svg';
import VideoCameraSlash from '@icon/regular/video-camera-slash.svg';
import VideoConference from '@icon/regular/video-conference.svg';
import { DropdownMenu } from '@kobalte/core/dropdown-menu';
import PhoneDisconnect from '@macro-icons/wide/call-disconnect.svg';
+import ShareNetwork from '@phosphor-icons/core/assets/regular/share-network.svg';
import { useToggleShareWithTeamMutation } from '@queries/call/call';
-import { cn } from '@ui';
+import { cn, Tooltip } from '@ui';
import { For, Show } from 'solid-js';
import { useCallContext } from '../CallContext';
@@ -56,8 +58,7 @@ export function CallControlsPanelSmallRow(
disabled={isConnecting()}
class={cn(
'flex items-center justify-center size-4 shrink-0 rounded-md border-0 bg-transparent transition-colors',
- isConnecting() &&
- 'opacity-50 pointer-events-none cursor-not-allowed',
+ isConnecting() && 'opacity-50 pointer-events-none',
!isConnecting() &&
(!callCtx.isAudioMuted() ||
!callCtx.isVideoMuted() ||
@@ -241,12 +242,27 @@ export function CallControlsPanelSmallRow(
onSelect={() => void handleToggleShareWithTeam()}
>
<div class="flex min-w-0 flex-1 items-center gap-2">
- <Users class="size-4 shrink-0" />
+ <ShareNetwork class="size-4 shrink-0" />
<span class="min-w-0 flex-1">
{callCtx.isSharedWithTeam()
? 'Shared with team'
: 'Share with team'}
</span>
+ <div class="ml-auto flex items-center gap-1.5 shrink-0">
+ <MiniToggleSwitch
+ checked={callCtx.isSharedWithTeam()}
+ size="SM"
+ compact
+ activeTrackClass="bg-ink-muted"
+ switchRootClass="pointer-events-none"
+ />
+ <Tooltip
+ placement="left"
+ label="When on, all team members can view and search this call's transcript and AI summary."
+ >
+ <Info class="size-3 text-ink-subtle" />
+ </Tooltip>
+ </div>
</div>
</DropdownMenu.Item>
diff --git a/js/app/packages/channel/Call/CallOverlay.tsx b/js/app/packages/channel/Call/CallOverlay.tsx
index 7c3546e511..81d36f8cdb 100644
--- a/js/app/packages/channel/Call/CallOverlay.tsx
+++ b/js/app/packages/channel/Call/CallOverlay.tsx
@@ -1,5 +1,8 @@
+import { MiniToggleSwitch } from '@core/component/FormControls/MiniToggleSwitch';
import { tryMacroId, useDisplayName } from '@core/user';
-import { cn } from '@ui';
+import ShareNetwork from '@phosphor-icons/core/assets/regular/share-network.svg';
+import { useToggleShareWithTeamMutation } from '@queries/call/call';
+import { cn, Tooltip } from '@ui';
import { type RemoteParticipant, Track } from 'livekit-client';
import { For, type JSXElement, Show } from 'solid-js';
import { useCallContext } from './CallContext';
@@ -142,6 +145,14 @@ function ScreenShareTile(props: { participant: RemoteParticipant }) {
export function CallOverlay(props: { onLeave: () => void }) {
const callCtx = useCallContext();
const isConnecting = () => callCtx.isConnecting();
+ const toggleShareWithTeam = useToggleShareWithTeamMutation();
+
+ const handleToggleShareWithTeam = async () => {
+ const callId = callCtx.activeCallId();
+ if (!callId) return;
+ const newValue = await toggleShareWithTeam.mutateAsync(callId);
+ callCtx.setSharedWithTeam(newValue);
+ };
const participants = () =>
Array.from(callCtx.remoteParticipants().values()).filter((p) => !p.isAgent);
@@ -241,8 +252,41 @@ export function CallOverlay(props: { onLeave: () => void }) {
</div>
{/* Controls bar */}
- <div class="flex items-center justify-center p-3 pt-1 bg-surface-1">
+ <div class="relative flex items-center justify-center p-3 pt-1 bg-surface-1">
<CallControls onLeave={props.onLeave} />
+ <div class="absolute left-3 flex items-center gap-2">
+ <span class="text-xs text-ink-muted whitespace-nowrap inline-grid">
+ <span class="col-start-1 row-start-1 invisible" aria-hidden>
+ Shared with team
+ </span>
+ <span class="col-start-1 row-start-1">
+ {callCtx.isSharedWithTeam()
+ ? 'Shared with team'
+ : 'Share with team'}
+ </span>
+ </span>
+ <Tooltip
+ placement="top"
+ label="When on, all team members can view and search this call's transcript and AI summary."
+ >
+ <div class="flex items-center gap-1">
+ <ShareNetwork
+ class={cn(
+ 'size-3 shrink-0',
+ callCtx.isSharedWithTeam() ? 'text-ink' : 'text-ink-muted'
+ )}
+ aria-hidden
+ />
+ <MiniToggleSwitch
+ checked={callCtx.isSharedWithTeam()}
+ onChange={() => void handleToggleShareWithTeam()}
+ disabled={isConnecting()}
+ size="SM"
+ activeTrackClass="bg-ink-muted"
+ />
+ </div>
+ </Tooltip>
+ </div>
</div>
</div>
);
diff --git a/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx b/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx
index 11d09de66f..84ad6aa46f 100644
--- a/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx
+++ b/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx
@@ -1,7 +1,11 @@
+import { MiniToggleSwitch } from '@core/component/FormControls/MiniToggleSwitch';
import { StackedAvatarsRow } from '@core/component/StackedAvatarsRow';
import ArrowsOut from '@icon/regular/arrows-out.svg';
-import { cn, Surface } from '@ui';
+import ShareNetwork from '@phosphor-icons/core/assets/regular/share-network.svg';
+import { useToggleShareWithTeamMutation } from '@queries/call/call';
+import { cn, Surface, Tooltip } from '@ui';
import { type Component, createMemo, Show } from 'solid-js';
+import { useCallContext } from '../CallContext';
import type { CallControlsVariant } from '../CallControls/CallControls';
import { CallControls } from '../CallControls/CallControls';
import type { InCallPanelProps } from '../InCallPanel/types';
@@ -25,6 +29,15 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {
onLeaveCall: props.onLeaveCall,
onJoinCall: props.onJoinCall,
});
+ const callCtx = useCallContext();
+ const toggleShareWithTeam = useToggleShareWithTeamMutation();
+
+ const handleToggleShareWithTeam = async () => {
+ const callId = callCtx.activeCallId();
+ if (!callId) return;
+ const newValue = await toggleShareWithTeam.mutateAsync(callId);
+ callCtx.setSharedWithTeam(newValue);
+ };
/** Memo so `props.isSlim` (boolean or accessor) always drives updates. */
const isSlimLayout = createMemo((): boolean => {
@@ -84,10 +97,8 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {
const headerRowClass = createMemo(() =>
cn(
- 'py-1 px-2 border-b border-edge-muted bg-accent/5 rounded-t-lg flex items-center gap-1 min-w-0 w-full',
- !slim() || showExpandToFullCall()
- ? 'justify-between gap-0'
- : 'justify-center'
+ 'py-1 px-2 border-b border-edge-muted bg-accent/5 rounded-t-lg flex items-center min-w-0 w-full',
+ slim() ? 'justify-center' : 'justify-between'
)
);
@@ -119,25 +130,52 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {
</Show>
</div>
- <Show when={showExpandToFullCall()}>
- <button
- type="button"
- class={cn(
- 'shrink-0 transition-colors hover:bg-accent/30 outline-0 outline-accent/50 hover:outline-1 hover-transition-outline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-edge-muted',
- slim() && 'animate-pulse hover:outline-0'
- )}
- title="Open full call view"
- aria-label="Open full call view"
- onClick={() => {
- const id = panel.callCtx.activeChannelId();
- if (id) void openChannelCallTab(id);
- }}
- >
- <ArrowsOut
- class={cn('text-accent', slim() ? 'size-3.5' : 'size-4')}
- />
- </button>
- </Show>
+ <div class="flex items-center gap-1 shrink-0">
+ <Show when={!slim()}>
+ <Tooltip
+ placement="top"
+ label="When on, all team members can view and search this call's transcript and AI summary."
+ >
+ <div class="flex items-center gap-1 px-1">
+ <ShareNetwork
+ class={cn(
+ 'size-3 shrink-0',
+ callCtx.isSharedWithTeam() ? 'text-ink' : 'text-ink-muted'
+ )}
+ aria-hidden
+ />
+ <MiniToggleSwitch
+ checked={callCtx.isSharedWithTeam()}
+ onChange={() => void handleToggleShareWithTeam()}
+ disabled={callCtx.isConnecting()}
+ size="SM"
+ compact
+ activeTrackClass="bg-ink-muted"
+ />
+ </div>
+ </Tooltip>
+ </Show>
+
+ <Show when={showExpandToFullCall()}>
+ <button
+ type="button"
+ class={cn(
+ 'shrink-0 transition-colors hover:bg-accent/30 outline-0 outline-accent/50 hover:outline-1 hover-transition-outline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-edge-muted',
+ slim() && 'animate-pulse hover:outline-0'
+ )}
+ title="Open full call view"
+ aria-label="Open full call view"
+ onClick={() => {
+ const id = panel.callCtx.activeChannelId();
+ if (id) void openChannelCallTab(id);
+ }}
+ >
+ <ArrowsOut
+ class={cn('text-accent', slim() ? 'size-3.5' : 'size-4')}
+ />
+ </button>
+ </Show>
+ </div>
</div>
<div
diff --git a/js/app/packages/core/component/FormControls/MiniToggleSwitch.tsx b/js/app/packages/core/component/FormControls/MiniToggleSwitch.tsx
index becdd1cc44..b83e0ce9b4 100644
--- a/js/app/packages/core/component/FormControls/MiniToggleSwitch.tsx
+++ b/js/app/packages/core/component/FormControls/MiniToggleSwitch.tsx
@@ -25,6 +25,8 @@ export const MiniToggleSwitch: Component<
animateFlicker?: boolean;
animateFlickerOnDeactivate?: boolean;
size?: 'SM' | 'Base';
+ compact?: boolean;
+ activeTrackClass?: string;
disabled?: boolean;
trueLabel?: string;
falseLabel?: string;
@@ -67,7 +69,7 @@ export const MiniToggleSwitch: Component<
[`${sizeClass[props.size || 'Base']}`]: true,
[`${props.switchRootClass}`]: !!props.switchRootClass,
'flex-row-reverse': props.labelPlacement === 'right',
- 'opacity-50 cursor-not-allowed': props.disabled,
+ 'opacity-50': props.disabled,
}}
checked={checked()}
onChange={onChange}
@@ -78,7 +80,6 @@ export const MiniToggleSwitch: Component<
class={props.labelClass}
classList={{
[`${sizeClass[props.size || 'Base']}`]: true,
- 'cursor-not-allowed': props.disabled,
'whitespace-nowrap': true,
}}
>
@@ -90,19 +91,24 @@ export const MiniToggleSwitch: Component<
<KSwitch.Input class="absolute inset-0 size-full! pointer-events-none" />
<KSwitch.Control class="relative">
<div
- class="relative w-8 h-3 touch:w-12 touch:h-8 rounded-full transition-colors duration-80"
+ class="relative rounded-full transition-colors duration-80"
classList={{
+ 'w-8 h-3 touch:w-12 touch:h-8': !props.compact,
+ 'w-6 h-2.5': !!props.compact,
'bg-edge': !checked(),
- 'bg-accent': checked(),
+ [props.activeTrackClass ?? 'bg-accent']: checked(),
}}
aria-hidden
>
- {/* Toggle thumb */}
<div
- class="absolute top-0.5 size-2 touch:size-7 rounded-full bg-panel transition-transform duration-200 ease-click"
+ class="absolute top-0.5 rounded-full bg-panel transition-transform duration-200 ease-click"
classList={{
+ 'size-2 touch:size-7': !props.compact,
+ 'size-1.5': !!props.compact,
'translate-x-0.5': !checked(),
- 'translate-x-5.5 touch:translate-x-4.5': checked(),
+ 'translate-x-5.5 touch:translate-x-4.5':
+ !props.compact && checked(),
+ 'translate-x-4': !!props.compact && checked(),
}}
/>
</div>