1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import styled from '@emotion/styled';
- import type {Location} from 'history';
- import {Button, LinkButton} from 'sentry/components/button';
- import Collapsible from 'sentry/components/collapsible';
- import IdBadge from 'sentry/components/idBadge';
- import {extractSelectionParameters} from 'sentry/components/organizations/pageFilters/utils';
- import * as SidebarSection from 'sentry/components/sidebarSection';
- import {t, tn} from 'sentry/locale';
- import {space} from 'sentry/styles/space';
- import type {Organization} from 'sentry/types/organization';
- import type {ReleaseProject} from 'sentry/types/release';
- type Props = {
- location: Location;
- organization: Organization;
- projects: ReleaseProject[];
- version: string;
- };
- function OtherProjects({projects, location, version, organization}: Props) {
- return (
- <SidebarSection.Wrap>
- <SidebarSection.Title>
- {tn(
- 'Other Project for This Release',
- 'Other Projects for This Release',
- projects.length
- )}
- </SidebarSection.Title>
- <SidebarSection.Content>
- <Collapsible
- expandButton={({onExpand, numberOfHiddenItems}) => (
- <Button priority="link" onClick={onExpand}>
- {tn(
- 'Show %s collapsed project',
- 'Show %s collapsed projects',
- numberOfHiddenItems
- )}
- </Button>
- )}
- >
- {projects.map(project => (
- <Row key={project.id}>
- <IdBadge project={project} avatarSize={16} />
- <LinkButton
- size="xs"
- to={{
- pathname: `/organizations/${
- organization.slug
- }/releases/${encodeURIComponent(version)}/`,
- query: {
- ...extractSelectionParameters(location.query),
- project: project.id,
- yAxis: undefined,
- },
- }}
- >
- {t('View')}
- </LinkButton>
- </Row>
- ))}
- </Collapsible>
- </SidebarSection.Content>
- </SidebarSection.Wrap>
- );
- }
- const Row = styled('div')`
- display: grid;
- grid-template-columns: 1fr max-content;
- align-items: center;
- justify-content: space-between;
- margin-bottom: ${space(0.75)};
- font-size: ${p => p.theme.fontSizeMedium};
- @media (min-width: ${p => p.theme.breakpoints.medium}) and (max-width: ${p =>
- p.theme.breakpoints.large}) {
- grid-template-columns: 200px max-content;
- }
- `;
- export default OtherProjects;
|