import React, { useState } from 'react'; import cx from 'classnames'; import Select from '@/_ui/Select'; import { components } from 'react-select'; import { EditVersion } from './EditVersionModal'; import { CreateVersion } from './CreateVersionModal'; import { ConfirmDialog } from '@/_components'; import { defaultAppEnvironments } from '@/_helpers/utils'; const Menu = (props) => { return (
!props?.selectProps?.value?.isReleasedVersion && props.selectProps.setShowEditAppVersion(true)} >
{props?.selectProps?.value?.appVersionName}
{!props?.selectProps?.value?.isReleasedVersion && (
)}

{props.children}
props.selectProps.setShowCreateAppVersion(true)} > Create new version
); }; const SingleValue = ({ selectProps }) => { return (

ver

{selectProps.value?.appVersionName}
); }; export const CustomSelect = ({ ...props }) => { const [showEditAppVersion, setShowEditAppVersion] = useState(false); const [showCreateAppVersion, setShowCreateAppVersion] = useState(false); const { deleteVersion, deleteAppVersion, resetDeleteModal } = props; return ( <> {showCreateAppVersion && ( )} {/* When we merge this code to EE update the defaultAppEnvironments object with rest of default environments (then delete this comment)*/} 1 ? 'Deleting a version will permanently remove it from all environments.' : '' }Are you sure you want to delete this version - ${deleteVersion.versionName}?`} onConfirm={() => deleteAppVersion(deleteVersion.versionId, deleteVersion.versionName)} onCancel={resetDeleteModal} />