import React from 'react' import { __ } from '@wordpress/i18n' import { createInterpolateElement } from '@wordpress/element' import { ImportCard } from '../../common/ImportCard' import type { ReactNode } from 'react' export interface ImportResult { success: boolean message: string imported?: number warnings?: string[] step: 'upload' | 'select' } export interface ImportResultDisplayProps { success: boolean message: ReactNode warnings?: string[] step: 'upload' | 'select' } export const ImportResultDisplay: React.FC = ({ success, message, warnings, step }) =>

{'upload' === step && (success ? __('File upload successful', 'code-snippets') : __('File upload error', 'code-snippets'))} {'select' === step && (success ? __('Import successful', 'code-snippets') : __('Import error', 'code-snippets'))}

{message}

{success && (

{createInterpolateElement( __('Go to All Snippets to activate your imported snippets.', 'code-snippets'), { // eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/control-has-associated-label a: } )}

)} {warnings && 0 < warnings.length && (

{__('Warnings:', 'code-snippets')}

    {warnings.map(warning =>
  • {warning}
  • )}
)}