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.

701 B
Raw Blame
import { formatVideoTimestamp } from '@core/util/duration';
import {
  type ContentHitData,
  hitHasSender,
  isCallRecordHit,
} from '../types/search';
import { formatRelativeTimestamp } from '../utils/timestamp';

interface SearchTimestampProps {
  hit?: ContentHitData;
}

/**
 * Displays the timestamp of a search hit (for channel/email/call_record)
 */
export function SearchTimestamp(props: SearchTimestampProps) {
  const formatted = () => {
    const hit = props.hit;
    if (!hit) return '';
    if (isCallRecordHit(hit)) return formatVideoTimestamp(hit.videoSeconds);
    if (hitHasSender(hit)) return formatRelativeTimestamp(hit.sentAt);
    return '';
  };

  return <>{formatted()}</>;
}