AbortMergeButton

tcmts.studio.AbortMergeButton · #vghshzwv · term · runs in the browser

handles onPress

Drop the merge waiting apart (tcm merge --abort), asking first: what settled it so far goes with it.

import { abortMerge, toldOf } from "#codebase/tcmts/studio";
import { Button, Dialog, DialogTrigger, Heading, Popover } from "react-aria-components";

export function AbortMergeButton({ theirs, into }: { theirs: string; into: string }) {
  return (
    <DialogTrigger>
      <Button className="btn">Drop the merge</Button>
      <Popover className="menu-pop getit" placement="bottom end" offset={6}>
        <Dialog className="getit-body" aria-label="Drop the merge">
          {({ close }) => (
            <>
              <Heading slot="title" className="getit-title">
                Drop merging {theirs}?
              </Heading>
              <p>{`${into} stays as it was all along, and what settled the merge so far goes with it. Merging again starts over.`}</p>
              <div className="actions">
                <Button className="btn" onPress={close}>
                  Keep it
                </Button>
                <Button
                  className="btn danger"
                  onPress={() => {
                    close();
                    void toldOf(abortMerge(), "Dropped the merge", "Couldn't drop the merge");
                  }}
                >
                  Drop it
                </Button>
              </div>
            </>
          )}
        </Dialog>
      </Popover>
    </DialogTrigger>
  );
}

uses

used by