import { formatBytes } from '~/lib/util' import DynamicIcon, { DynamicIconName } from './DynamicIcon' import { CuratedCollectionWithStatus } from '../../types/downloads' import classNames from 'classnames' import { IconCircleCheck } from '@tabler/icons-react' export interface CuratedCollectionCardProps { collection: CuratedCollectionWithStatus onClick?: (collection: CuratedCollectionWithStatus) => void } const CuratedCollectionCard: React.FC = ({ collection, onClick }) => { const totalSizeBytes = collection.resources?.reduce( (acc, resource) => acc + resource.size_mb * 1024 * 1024, 0 ) return (
{ if (collection.all_downloaded) { return } if (onClick) { onClick(collection) } }} >

{collection.name}

{collection.all_downloaded && (

All items downloaded

)}

{collection.description}

Items: {collection.resources?.length} | Size: {formatBytes(totalSizeBytes, 0)}

) } export default CuratedCollectionCard