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.

762 B
Raw Blame
import { type Accessor, createContext, useContext } from 'solid-js';
import type { ComposerMode } from '../core/mode';

/**
 * The design's `data-mode` vocabulary: `macro` is Chat (and Auto), `work` is Code. The
 * stylesheet keys its per-mode rules on it, and dialogs rendered through a
 * portal read it here so they can carry the same attribute.
 */
export type DataMode = 'macro' | 'work';

export function dataModeFor(mode: ComposerMode): DataMode {
  return mode === 'code' ? 'work' : 'macro';
}

const defaultMode: Accessor<DataMode> = () => 'macro';
const DataModeContext = createContext(defaultMode);

export const DataModeProvider = DataModeContext.Provider;

export function useDataMode(): Accessor<DataMode> {
  return useContext(DataModeContext);
}