| 1 |
import React from 'react' |
| 2 |
import { __, sprintf } from '@wordpress/i18n' |
| 3 |
import type { FeedbackReportResponse } from '../../types/Feedback' |
| 4 |
|
| 5 |
export interface FeedbackSuccessProps { |
| 6 |
result: FeedbackReportResponse |
| 7 |
} |
| 8 |
|
| 9 |
/** Only a tracker link the plugin published is worth offering as one. */ |
| 10 |
const isTrackerUrl = (url: string): boolean => url.startsWith('https://github.com/') |
| 11 |
|
| 12 |
export const FeedbackSuccess: React.FC<FeedbackSuccessProps> = ({ result }) => |
| 13 |
<div className="code-snippets-feedback-success"> |
| 14 |
<h3>{__('Report sent', 'code-snippets')}</h3> |
| 15 |
<p> |
| 16 |
{result.reference |
| 17 |
// translators: %s: reference number identifying the report. |
| 18 |
? sprintf(__('Reference %s.', 'code-snippets'), result.reference) |
| 19 |
: __('The team will pick it up from here.', 'code-snippets')} |
| 20 |
{' '} |
| 21 |
{result.url && isTrackerUrl(result.url) && |
| 22 |
<a href={result.url} target="_blank" rel="noopener noreferrer"> |
| 23 |
{__('Track it on GitHub', 'code-snippets')} |
| 24 |
</a>} |
| 25 |
</p> |
| 26 |
</div> |
| 27 |
|