BranchLink
handles onPress
A branch's name as a link: it reads that branch in this browser, and shows its history.
import { navigate } from "#codebase/tcmts/react"; import { at, toasts } from "#codebase/tcmts/share"; import { readBranch } from "#codebase/tcmts/studio"; import { Button } from "react-aria-components"; export function BranchLink({ branch }: { branch: string }) { return ( <Button className="linkbtn mono" onPress={() => { void readBranch(branch).then( () => navigate(at("/history")), (e: Error) => toasts.add( { title: "Couldn't read it", description: e.message, tone: "bad" }, { timeout: 6000 }, ), ); }} > {branch} </Button> ); }