// Copyright 2017-2026 @pezkuwi/app-preimages authors & contributors
// SPDX-License-Identifier: Apache-2.0

import React from 'react';

import { CardSummary, SummaryBox } from '@pezkuwi/react-components';
import { formatNumber } from '@pezkuwi/util';

import { useTranslation } from '../translate.js';

interface Props {
  className?: string;
  hashes?: string[];
}

function Summary ({ className, hashes }: Props): React.ReactElement<Props> {
  const { t } = useTranslation();

  return (
    <SummaryBox className={className}>
      <CardSummary label={t('images')}>
        {hashes === undefined
          ? <span className='--tmp'>99</span>
          : formatNumber(hashes.length)
        }
      </CardSummary>
    </SummaryBox>
  );
}

export default React.memo(Summary);
