12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import styled from '@emotion/styled';
- import {LinkButton} from 'sentry/components/button';
- import {space} from 'sentry/styles/space';
- import type {Event} from 'sentry/types/event';
- import type {Group} from 'sentry/types/group';
- import {IssueCategory} from 'sentry/types/group';
- import {trackAnalytics} from 'sentry/utils/analytics';
- import type {IssueTypeConfig, ResourceLink} from 'sentry/utils/issueTypeConfig/types';
- import useOrganization from 'sentry/utils/useOrganization';
- type Props = {
- configResources: NonNullable<IssueTypeConfig['resources']>;
- eventPlatform: Event['platform'];
- group: Group;
- };
- export default function Resources({configResources, eventPlatform, group}: Props) {
- const organization = useOrganization();
- const links: ResourceLink[] = [
- ...configResources.links,
- ...(configResources.linksByPlatform[eventPlatform ?? ''] ?? []),
- ];
- return (
- <div>
- {group.issueCategory !== IssueCategory.ERROR && configResources.description}
- <LinkSection>
- {links.map(({link, text}) => (
- <StyledLinkButton
- priority="link"
- onClick={() =>
- trackAnalytics('issue_details.resources_link_clicked', {
- organization,
- resource: text,
- group_id: group.id,
- })
- }
- key={link}
- href={link}
- external
- >
- {text}
- </StyledLinkButton>
- ))}
- </LinkSection>
- </div>
- );
- }
- const LinkSection = styled('div')`
- display: flex;
- flex-direction: column;
- gap: ${space(1)};
- margin-top: ${space(1)};
- `;
- const StyledLinkButton = styled(LinkButton)`
- text-decoration: underline;
- align-self: flex-start;
- `;
|