import { Button } from './ui'
import { t } from '@/lib/i18n'

interface ArticleFormButtonsProps {
  loading: boolean
  relayStatuses?: unknown
  onCancel?: () => void
  onPreview?: () => void
}

export function ArticleFormButtons({ loading, onCancel, onPreview }: ArticleFormButtonsProps): React.ReactElement {
  return (
    <div className="space-y-3 pt-4">
      <div className="flex gap-3">
        <Button
          type="submit"
          variant="primary"
          disabled={loading}
          loading={loading}
          className="flex-1"
        >
          {loading ? t('publish.publishing') : t('publish.button')}
        </Button>
        {onPreview && (
          <Button
            type="button"
            variant="secondary"
            onClick={onPreview}
            disabled={loading}
          >
            {t('article.preview.button')}
          </Button>
        )}
        {onCancel && (
          <Button
            type="button"
            variant="ghost"
            onClick={onCancel}
          >
            {t('common.back')}
          </Button>
        )}
      </div>
    </div>
  )
}
