releaseStats.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import styled from '@emotion/styled';
  2. import DeployBadge from 'sentry/components/badge/deployBadge';
  3. import NotAvailable from 'sentry/components/notAvailable';
  4. import * as SidebarSection from 'sentry/components/sidebarSection';
  5. import TimeSince from 'sentry/components/timeSince';
  6. import {t} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. import type {Organization} from 'sentry/types/organization';
  9. import type {Release, ReleaseProject} from 'sentry/types/release';
  10. type Props = {
  11. organization: Organization;
  12. project: Required<ReleaseProject>;
  13. release: Release;
  14. };
  15. function ReleaseStats({organization, release, project}: Props) {
  16. const {lastDeploy, dateCreated, version} = release;
  17. return (
  18. <Container>
  19. <SidebarSection.Wrap>
  20. <SidebarSection.Title>
  21. {lastDeploy?.dateFinished ? t('Date Deployed') : t('Date Created')}
  22. </SidebarSection.Title>
  23. <SidebarSection.Content>
  24. <TimeSince date={lastDeploy?.dateFinished ?? dateCreated} />
  25. </SidebarSection.Content>
  26. </SidebarSection.Wrap>
  27. <SidebarSection.Wrap>
  28. <SidebarSection.Title>{t('Last Deploy')}</SidebarSection.Title>
  29. <SidebarSection.Content>
  30. {lastDeploy?.dateFinished ? (
  31. <DeployBadge
  32. deploy={lastDeploy}
  33. orgSlug={organization.slug}
  34. version={version}
  35. projectId={project.id}
  36. />
  37. ) : (
  38. <NotAvailable />
  39. )}
  40. </SidebarSection.Content>
  41. </SidebarSection.Wrap>
  42. </Container>
  43. );
  44. }
  45. const Container = styled('div')`
  46. display: grid;
  47. grid-template-columns: 50% 50%;
  48. grid-row-gap: ${space(2)};
  49. `;
  50. export default ReleaseStats;