Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.4 KB
Raw Blame
'use client';

import { Block } from '@lobehub/ui';
import { memo } from 'react';

import ImageItem from '@/components/ImageItem';

import { ActionButtons } from './ActionButtons';
import { styles } from './styles';
import { type SuccessStateProps } from './types';
import { getThumbnailMaxWidth } from './utils';

// Success state component
export const SuccessState = memo<SuccessStateProps>(
  ({
    generation,
    generationBatch,
    prompt,
    aspectRatio,
    onDelete,
    onDownload,
    onCopySeed,
    onShare,
    seedTooltip,
  }) => {
    return (
      <Block
        align={'center'}
        className={styles.imageContainer}
        justify={'center'}
        variant={'filled'}
        style={{
          aspectRatio,
          maxWidth: getThumbnailMaxWidth(generation, generationBatch),
        }}
      >
        <ImageItem
          alt={prompt}
          style={{ height: '100%', width: '100%' }}
          // Thumbnail quality is too bad
          url={generation.asset!.url}
          preview={{
            src: generation.asset!.url,
          }}
        />
        <ActionButtons
          showDownload
          seedTooltip={seedTooltip}
          showCopySeed={!!generation.seed}
          onCopySeed={onCopySeed}
          onDelete={onDelete}
          onDownload={onDownload}
          onShare={onShare}
        />
      </Block>
    );
  },
);

SuccessState.displayName = 'SuccessState';