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.5 KB
Raw Blame
import { DiffCounts } from '@app/components/diff-view';
import GitBranchIcon from '@icon/system/regular/git-branch.svg';
import GitPullRequestIcon from '@icon/system/regular/git-pull-request.svg';
import RowsIcon from '@icon/system/regular/rows.svg';
import XIcon from '@icon/system/regular/x.svg';
import { Button } from '@ui';
import { Show } from 'solid-js';
import { describeFileCount } from '../core/changeset';
import { pullRequestNumber } from '../core/pull-request';

/** The transcript's hand-off card into the Changes pane. */
export function ChangesReadyCard(props: {
  fileCount: number;
  additions: number;
  deletions: number;
  linkedUrl: string | undefined;
  onReview: () => void;
  onViewPullRequest: () => void;
  onDismiss: () => void;
}) {
  const linkedNumber = () =>
    props.linkedUrl ? pullRequestNumber(props.linkedUrl) : undefined;
  return (
    <section
      class="flex flex-col gap-2.5 rounded-xl bg-surface-1 p-3 shadow-[inset_0_0_0_1px_var(--color-edge-muted)]"
      aria-label="Changes ready to review"
    >
      <div class="flex items-center gap-2">
        <GitBranchIcon class="size-4 shrink-0 text-accent" />
        <span class="text-[12.5px] font-semibold text-ink">
          Changes ready to review
        </span>
        <span class="flex-1" />
        <Button
          variant="ghost"
          size="icon-xs"
          tooltip="Dismiss"
          onClick={() => props.onDismiss()}
        >
          <XIcon class="size-3 touch:size-6 shrink-0 pointer-events-none" />
        </Button>
      </div>
      <div class="flex items-center gap-2 font-mono text-[11px] text-ink-placeholder">
        <span>{describeFileCount(props.fileCount)}</span>
        <DiffCounts additions={props.additions} deletions={props.deletions} />
      </div>
      <div class="flex flex-wrap gap-1.5">
        <Button
          variant="secondary"
          size="sm"
          class="gap-1.5"
          onClick={() => props.onReview()}
        >
          <RowsIcon class="size-3.5" />
          <span>Review changes</span>
        </Button>
        <Show when={props.linkedUrl}>
          <Button
            variant="secondary"
            size="sm"
            class="gap-1.5"
            onClick={props.onViewPullRequest}
          >
            <GitPullRequestIcon class="size-3.5" />
            <span>
              {linkedNumber()
                ? `Pull request #${linkedNumber()}`
                : 'Pull request'}
            </span>
          </Button>
        </Show>
      </div>
    </section>
  );
}