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.

2.7 KB
Raw Blame
import ArrowsClockwiseIcon from '@icon/system/regular/arrows-clockwise.svg';
import CircleNotchIcon from '@icon/system/regular/circle-notch.svg';
import GitBranchIcon from '@icon/system/regular/git-branch.svg';
import WarningCircleIcon from '@icon/system/regular/warning-circle.svg';
import { Button } from '@ui';
import { type JSX, Show } from 'solid-js';

/** A full-pane message for the states with nothing to diff. */
export function ChangesNotice(props: {
  icon?: JSX.Element;
  title: string;
  detail?: string;
  /** Show the retry action. */
  onRefresh?: () => void;
  refreshing?: boolean;
}) {
  return (
    <div class="flex flex-1 flex-col items-center justify-center gap-2 px-6 py-10 text-center">
      <span class="text-ink-placeholder [&>svg]:size-6">
        {props.icon ?? <GitBranchIcon />}
      </span>
      <p class="text-sm font-medium text-ink">{props.title}</p>
      <Show when={props.detail}>
        <p class="max-w-sm text-xs leading-relaxed text-ink-muted">
          {props.detail}
        </p>
      </Show>
      <Show when={props.onRefresh}>
        <Button
          variant="secondary"
          size="sm"
          class="mt-2 gap-1.5"
          disabled={props.refreshing}
          onClick={() => props.onRefresh?.()}
        >
          <ArrowsClockwiseIcon
            class={
              props.refreshing
                ? 'size-3 shrink-0 touch:size-6 animate-spin'
                : 'size-3 shrink-0 touch:size-6'
            }
          />
          <span>Refresh changes</span>
        </Button>
      </Show>
    </div>
  );
}

/** A thin strip over the diff stack while a capture runs or after one failed. */
export function CaptureBanner(props: {
  tone: 'progress' | 'failure';
  text: string;
  onRefresh?: () => void;
  refreshing?: boolean;
}) {
  return (
    <div
      class={
        props.tone === 'failure'
          ? 'flex shrink-0 items-center gap-2 border-b border-edge-muted bg-failure-bg px-3 py-1.5 text-xs text-failure'
          : 'flex shrink-0 items-center gap-2 border-b border-edge-muted bg-accent-bg px-3 py-1.5 text-xs text-accent'
      }
      role="status"
    >
      {props.tone === 'failure' ? (
        <WarningCircleIcon class="size-3.5 shrink-0" />
      ) : (
        <CircleNotchIcon class="size-3.5 shrink-0 animate-spin" />
      )}
      <span class="min-w-0 flex-1 truncate" title={props.text}>
        {props.text}
      </span>
      <Show when={props.onRefresh}>
        <Button
          variant="ghost"
          size="xs"
          class="text-current"
          disabled={props.refreshing}
          onClick={() => props.onRefresh?.()}
        >
          Try again
        </Button>
      </Show>
    </div>
  );
}