organizationAvatar.tsx 827 B

1234567891011121314151617181920212223242526272829
  1. import BaseAvatar from 'sentry/components/avatar/baseAvatar';
  2. import {OrganizationSummary} from 'sentry/types';
  3. import {explodeSlug} from 'sentry/utils';
  4. type Props = {
  5. organization?: OrganizationSummary;
  6. } & Omit<BaseAvatar['props'], 'uploadPath' | 'uploadId'>;
  7. const OrganizationAvatar = ({organization, ...props}: Props) => {
  8. if (!organization) {
  9. return null;
  10. }
  11. const slug = (organization && organization.slug) || '';
  12. const title = explodeSlug(slug);
  13. return (
  14. <BaseAvatar
  15. {...props}
  16. type={(organization.avatar && organization.avatar.avatarType) || 'letter_avatar'}
  17. uploadPath="organization-avatar"
  18. uploadId={organization.avatar && organization.avatar.avatarUuid}
  19. letterId={slug}
  20. tooltip={slug}
  21. title={title}
  22. />
  23. );
  24. };
  25. export default OrganizationAvatar;