| 1 |
import React from 'react' |
| 2 |
import { __, _n, sprintf } from '@wordpress/i18n' |
| 3 |
|
| 4 |
export interface EnvironmentDisclosureProps { |
| 5 |
summary: Record<string, string> |
| 6 |
errorCount: number |
| 7 |
} |
| 8 |
|
| 9 |
export const EnvironmentDisclosure: React.FC<EnvironmentDisclosureProps> = ({ summary, errorCount }) => |
| 10 |
<details className="code-snippets-feedback-disclosure"> |
| 11 |
<summary>{__('What gets sent with this report', 'code-snippets')}</summary> |
| 12 |
|
| 13 |
<dl className="code-snippets-feedback-disclosure__list"> |
| 14 |
{Object.entries(summary).map(([label, value]) => |
| 15 |
<React.Fragment key={label}> |
| 16 |
<dt>{label}</dt> |
| 17 |
<dd>{value}</dd> |
| 18 |
</React.Fragment> |
| 19 |
)} |
| 20 |
|
| 21 |
<dt>{__('JavaScript errors', 'code-snippets')}</dt> |
| 22 |
<dd> |
| 23 |
{0 === errorCount |
| 24 |
? __('none on this page', 'code-snippets') |
| 25 |
// translators: %d: number of JavaScript errors captured on the current page. |
| 26 |
: sprintf(_n('%d error captured', '%d errors captured', errorCount, 'code-snippets'), errorCount)} |
| 27 |
</dd> |
| 28 |
</dl> |
| 29 |
|
| 30 |
<p className="code-snippets-feedback-disclosure__note"> |
| 31 |
{__('Your site address, email address and full plugin list stay with the Code Snippets team. Only the report itself and the version numbers appear on the public issue tracker.', 'code-snippets')} |
| 32 |
</p> |
| 33 |
</details> |
| 34 |
|