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.

758 B
Raw Blame
import { createSignal } from 'solid-js';

export type BotSettingsRequest =
  | { id: number; type: 'create'; initialChannelId?: string }
  | { id: number; type: 'detail'; botId: string };

const [botSettingsRequest, setBotSettingsRequest] =
  createSignal<BotSettingsRequest>();
let nextRequestId = 0;

export { botSettingsRequest };

export function requestBotCreation(initialChannelId?: string) {
  setBotSettingsRequest({
    id: ++nextRequestId,
    type: 'create',
    initialChannelId,
  });
}

export function requestBotDetail(botId: string) {
  setBotSettingsRequest({ id: ++nextRequestId, type: 'detail', botId });
}

export function consumeBotSettingsRequest(id: number) {
  if (botSettingsRequest()?.id === id) setBotSettingsRequest(undefined);
}