releaseStats.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import styled from '@emotion/styled';
  2. import DeployBadge from 'sentry/components/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 {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.Wrap>
  19. <SidebarSection.Title>
  20. {lastDeploy?.dateFinished ? t('Date Deployed') : t('Date Created')}
  21. </SidebarSection.Title>
  22. <SidebarSection.Content>
  23. <TimeSince date={lastDeploy?.dateFinished ?? dateCreated} />
  24. </SidebarSection.Content>
  25. </SidebarSection.Wrap>
  26. <SidebarSection.Wrap>
  27. <SidebarSection.Title>{t('Last Deploy')}</SidebarSection.Title>
  28. <SidebarSection.Content>
  29. {lastDeploy?.dateFinished ? (
  30. <DeployBadge
  31. deploy={lastDeploy}
  32. orgSlug={organization.slug}
  33. version={version}
  34. projectId={project.id}
  35. />
  36. ) : (
  37. <NotAvailable />
  38. )}
  39. </SidebarSection.Content>
  40. </SidebarSection.Wrap>
  41. </Container>
  42. );
  43. }
  44. const Container = styled('div')`
  45. display: grid;
  46. grid-template-columns: 50% 50%;
  47. grid-row-gap: ${space(2)};
  48. `;
  49. export default ReleaseStats;