import React, {useState} from 'react';
import {ModalRenderProps} from 'sentry/actionCreators/modal';
import Button from 'sentry/components/button';
import {SelectAsyncField} from 'sentry/components/deprecatedforms';
import TimeSince from 'sentry/components/timeSince';
import Version from 'sentry/components/version';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
import {Commit} from 'sentry/types';
type Props = ModalRenderProps & {
onSelected: ({inCommit: string}) => void;
orgSlug: string;
projectSlug?: string;
};
function CustomCommitsResolutionModal({
onSelected,
orgSlug,
projectSlug,
closeModal,
Header,
Body,
Footer,
}: Props) {
const [commit, setCommit] = useState<{commit: Commit | undefined}>({commit: undefined});
const [commits, setCommits] = useState<{commits: Commit[] | undefined}>({
commits: undefined,
});
const onChange = (value: string | number | boolean) => {
if (commits === undefined) {
return;
}
setCommit({
commit: commits.commits?.find(result => result.id === value),
});
};
const onAsyncFieldResults = (results: Commit[]) => {
setCommits({
commits: results,
});
return results.map(c => ({
value: c.id,
label: