releaseStats.tsx 1.3 KB

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