import styled from '@emotion/styled'; import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator'; import Textarea from 'sentry/components/forms/controls/textarea'; import FieldGroup from 'sentry/components/forms/fieldGroup'; import FieldHelp from 'sentry/components/forms/fieldGroup/fieldHelp'; import Input from 'sentry/components/input'; import TextCopyInput from 'sentry/components/textCopyInput'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {Relay} from 'sentry/types'; type FormField = keyof Pick; type Values = Record; type Props = { disables: Partial>; errors: Partial; isFormValid: boolean; onChange: (field: FormField, value: string) => void; onSave: () => void; onValidate: (field: FormField) => () => void; onValidateKey: () => void; values: Values; }; function Form({ values, onChange, errors, onValidate, isFormValid, disables, onValidateKey, onSave, }: Props) { const handleChange = (field: FormField) => ( event: React.ChangeEvent | React.ChangeEvent ) => { onChange(field, event.target.value); }; const handleSubmit = () => { if (isFormValid) { onSave(); } }; const onCopy = (value: string) => () => { navigator.clipboard .writeText(value) .then(() => { addSuccessMessage(t('Copied to clipboard')); }) .catch(() => { addErrorMessage(t('Error copying to clipboard')); }); }; return (
{disables.publicKey ? ( {values.publicKey} ) : ( {t( 'Only enter the Public Key value from your credentials file. Never share the Secret key with Sentry or any third party' )} )}