import 'package:flutter/material.dart';

import 'package:pweb/controllers/payouts/multiple_payouts.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class UploadPanelStatus extends StatelessWidget {
  const UploadPanelStatus({
    super.key,
    required this.controller,
  });

  final MultiplePayoutsController controller;

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final l10n = AppLocalizations.of(context)!;
    
    if (controller.sentCount <= 0 && controller.error == null) {
      return const SizedBox.shrink();
    }

    return Column(
      children: [
        if (controller.sentCount > 0) ...[
          const SizedBox(height: 8),
          Text(
            '${l10n.payout}: ${controller.sentCount}',
            style: theme.textTheme.bodySmall?.copyWith(
              color: theme.colorScheme.primary,
            ),
          ),
        ],
        if (controller.error != null) ...[
          const SizedBox(height: 8),
          Text(
            controller.error.toString(),
            style: theme.textTheme.bodySmall?.copyWith(
              color: theme.colorScheme.error,
            ),
          ),
        ],
      ],
    );
  }
}
