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.2 KB
Raw Blame
import type { CardItemType } from './types';

const DOCUMENT_KINDS: Record<string, string> = {
  md: 'Document',
  txt: 'Document',
  spreadsheet: 'Spreadsheet',
  csv: 'Spreadsheet',
  xlsx: 'Spreadsheet',
  pdf: 'PDF',
  docx: 'Word document',
  doc: 'Word document',
  pptx: 'Presentation',
  canvas: 'Canvas',
  psd: 'Photoshop file',
  fig: 'Figma file',
  png: 'Image',
  jpg: 'Image',
  jpeg: 'Image',
  gif: 'Image',
  webp: 'Image',
  svg: 'Image',
  mp4: 'Video',
  mov: 'Video',
  webm: 'Video',
};

/** What kind of document a file type is, as a reader would name it. */
export function documentKind(fileType: string | null | undefined): string {
  return (fileType && DOCUMENT_KINDS[fileType.toLowerCase()]) || 'Document';
}

// The app calls a `project` a folder and an `initiative` a project.
const ITEM_KINDS: Record<Exclude<CardItemType, 'document'>, string> = {
  email_thread: 'Email',
  calendar_event: 'Event',
  project: 'Folder',
  channel: 'Channel',
  routine: 'Routine',
  form: 'Form',
  initiative: 'Project',
};

/** What kind of item a card shows, as a reader would name it. */
export function itemKind(type: CardItemType, fileType?: string | null): string {
  return type === 'document' ? documentKind(fileType) : ITEM_KINDS[type];
}