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.3 KB
Raw Blame
import { useBlockEntityCommands } from '@app/features/next-soup/actions';
import { createSearchParams } from '@app/lib/split-router';
import {
  ChannelDetail,
  ChannelDetailTopBar,
} from '@channel/Channel/ChannelDetail';
import type { ChannelTargetRequest } from '@channel/Channel/ChannelSurface';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import type { ChannelEntity } from '@entity';
import { channelsSearch } from '../channels-route';

/** Adapts a resolved conversation and navigation intent to the shared surface. */
export function ChannelDetailView(props: {
  channel: ChannelEntity;
  target?: ChannelTargetRequest;
}) {
  const panel = useSplitPanelOrThrow();
  const [search] = createSearchParams(channelsSearch);
  useBlockEntityCommands({
    id: props.channel.id,
    scopeId: panel.splitHotkeyScope,
    resolveEntity: () => props.channel,
  });

  return (
    <ChannelDetail
      channelId={props.channel.id}
      target={props.target}
      navigationRequest={search.seek}
      fallbackName={props.channel.name}
      autofocus={false}
    >
      {(channel) => (
        <ChannelDetailTopBar
          channelId={channel.channelId}
          fallbackName={props.channel.name}
        />
      )}
    </ChannelDetail>
  );
}