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.

1.1 KB
Raw Blame
import { HeaderActionButton } from '@components/app/HeaderActionButton';
import { fireAndForget } from '@core/util/fireAndForget';
import PhoneIcon from '@icon/system/regular/phone-call.svg';
import { cn } from '@ui';
import { tourTarget } from '@ui/components/Tour';
import { Show } from 'solid-js';
import { CHANNEL_TOUR } from '../tour';
import { useStartChannelCall } from './use-start-channel-call';

export function ChannelCallButton(props: {
  channelId: string;
  grouped?: boolean;
}) {
  const call = useStartChannelCall(() => props.channelId);

  const tooltip = () => (call.isCallInProgress() ? 'Join Call' : 'Start Call');
  const label = () => (call.isCallInProgress() ? 'Join' : 'Call');

  return (
    <Show when={!call.isInThisChannel()}>
      <HeaderActionButton
        grouped={props.grouped}
        ref={tourTarget(CHANNEL_TOUR.call)}
        onClick={() => fireAndForget(call.start(), 'channel-call')}
        tooltip={tooltip()}
        label={label()}
        icon={
          <PhoneIcon class="size-3.5 touch:size-6 shrink-0 pointer-events-none" />
        }
        class={cn(call.isCallInProgress() && 'text-success')}
      />
    </Show>
  );
}