| 1 |
import React from 'react' |
| 2 |
import { TextControl } from '@wordpress/components' |
| 3 |
import { __ } from '@wordpress/i18n' |
| 4 |
import { EnvironmentDisclosure } from './EnvironmentDisclosure' |
| 5 |
import type { FeedbackConfig, FeedbackDraft } from '../../types/Feedback' |
| 6 |
|
| 7 |
export interface ReporterFieldsProps { |
| 8 |
config: FeedbackConfig |
| 9 |
draft: FeedbackDraft |
| 10 |
updateDraft: (changes: Partial<FeedbackDraft>) => void |
| 11 |
} |
| 12 |
|
| 13 |
export const ReporterFields: React.FC<ReporterFieldsProps> = ({ config, draft, updateDraft }) => |
| 14 |
<> |
| 15 |
<div className="code-snippets-feedback-field"> |
| 16 |
<TextControl |
| 17 |
label={__('Your name', 'code-snippets')} |
| 18 |
help={__('Credited on the issue.', 'code-snippets')} |
| 19 |
value={draft.name} |
| 20 |
onChange={name => updateDraft({ name })} |
| 21 |
/> |
| 22 |
</div> |
| 23 |
|
| 24 |
<div className="code-snippets-feedback-field"> |
| 25 |
<TextControl |
| 26 |
type="email" |
| 27 |
label={__('Email for follow-up', 'code-snippets')} |
| 28 |
help={__('Never published.', 'code-snippets')} |
| 29 |
value={draft.email} |
| 30 |
onChange={email => updateDraft({ email })} |
| 31 |
/> |
| 32 |
</div> |
| 33 |
|
| 34 |
<EnvironmentDisclosure |
| 35 |
summary={config.summary} |
| 36 |
errorCount={(window.codeSnippetsErrors ?? []).length} |
| 37 |
/> |
| 38 |
</> |
| 39 |
|