import React, { FC, useEffect } from 'react'; import { Text } from 'ink'; import { TruffleArtifact } from '../../services'; import { Select, ChevronText } from '../helpers'; import { StringElt } from '.'; export interface StageSelectArtifactProps { artifacts: TruffleArtifact[] setArtifact: (contract: TruffleArtifact) => void progressMsgs: StringElt[] addProgressMsg: (msg:StringElt)=>void } export const StageSelectArtifact: FC = (props) => { const { artifacts, setArtifact, progressMsgs, addProgressMsg } = props; useEffect(function autoSelectLoneArtifact(){ if (artifacts.length === 1) { setArtifact(artifacts[0]) addProgressMsg( Automatically using the {artifacts[0].contract_name} contract; it is the only one which has been deployed. ) } }, [artifacts]) return (