-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(issue-details): Add streamlined sidebar and activity (#78043)
new version of #77958 , which was reverted because the condition for not using a grid layout was being read as false (undefined) on non-issues pages. this pr updates it to only change the layout of the issue details container so it won't affect any other page.
- Loading branch information
1 parent
1eead49
commit 1d65341
Showing
6 changed files
with
932 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
static/app/views/issueDetails/streamline/activitySection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {Fragment} from 'react'; | ||
import styled from '@emotion/styled'; | ||
|
||
import Timeline from 'sentry/components/timeline'; | ||
import TimeSince from 'sentry/components/timeSince'; | ||
import type {Group} from 'sentry/types/group'; | ||
import useOrganization from 'sentry/utils/useOrganization'; | ||
import {groupActivityTypeIconMapping} from 'sentry/views/issueDetails/streamline/groupActivityIcons'; | ||
import getGroupActivityItem from 'sentry/views/issueDetails/streamline/groupActivityItem'; | ||
|
||
function StreamlinedActivitySection({group}: {group: Group}) { | ||
const organization = useOrganization(); | ||
|
||
return ( | ||
<Fragment> | ||
<Timeline.Container> | ||
{group.activity.map(item => { | ||
const authorName = item.user ? item.user.name : 'Sentry'; | ||
const {title, message} = getGroupActivityItem( | ||
item, | ||
organization, | ||
group.project.id, | ||
<Author>{authorName}</Author> | ||
); | ||
|
||
const Icon = groupActivityTypeIconMapping[item.type]?.Component ?? null; | ||
|
||
return ( | ||
<Timeline.Item | ||
title={title} | ||
timestamp={<TimeSince date={item.dateCreated} />} | ||
icon={ | ||
Icon && <Icon {...groupActivityTypeIconMapping[item.type].defaultProps} /> | ||
} | ||
key={item.id} | ||
> | ||
{message} | ||
</Timeline.Item> | ||
); | ||
})} | ||
</Timeline.Container> | ||
</Fragment> | ||
); | ||
} | ||
|
||
const Author = styled('span')` | ||
font-weight: ${p => p.theme.fontWeightBold}; | ||
`; | ||
|
||
export default StreamlinedActivitySection; |
67 changes: 67 additions & 0 deletions
67
static/app/views/issueDetails/streamline/groupActivityIcons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { | ||
IconAdd, | ||
IconCheckmark, | ||
IconClose, | ||
IconDelete, | ||
IconEdit, | ||
IconFile, | ||
IconFire, | ||
IconFlag, | ||
IconGraph, | ||
IconLock, | ||
IconMute, | ||
IconNext, | ||
IconPlay, | ||
IconPrevious, | ||
IconRefresh, | ||
IconUnsubscribed, | ||
IconUser, | ||
} from 'sentry/icons'; | ||
import {GroupActivityType} from 'sentry/types/group'; | ||
|
||
interface IconWithDefaultProps { | ||
Component: React.ComponentType<any> | null; | ||
defaultProps: {locked?: boolean; type?: string}; | ||
} | ||
|
||
export const groupActivityTypeIconMapping: Record< | ||
GroupActivityType, | ||
IconWithDefaultProps | ||
> = { | ||
[GroupActivityType.NOTE]: {Component: IconFile, defaultProps: {}}, | ||
[GroupActivityType.SET_RESOLVED]: {Component: IconCheckmark, defaultProps: {}}, | ||
[GroupActivityType.SET_RESOLVED_BY_AGE]: {Component: IconCheckmark, defaultProps: {}}, | ||
[GroupActivityType.SET_RESOLVED_IN_RELEASE]: { | ||
Component: IconCheckmark, | ||
defaultProps: {}, | ||
}, | ||
[GroupActivityType.SET_RESOLVED_IN_COMMIT]: { | ||
Component: IconCheckmark, | ||
defaultProps: {}, | ||
}, | ||
[GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST]: { | ||
Component: IconCheckmark, | ||
defaultProps: {}, | ||
}, | ||
[GroupActivityType.SET_UNRESOLVED]: {Component: IconClose, defaultProps: {}}, | ||
[GroupActivityType.SET_IGNORED]: {Component: IconMute, defaultProps: {}}, | ||
[GroupActivityType.SET_PUBLIC]: {Component: IconLock, defaultProps: {}}, | ||
[GroupActivityType.SET_PRIVATE]: {Component: IconLock, defaultProps: {locked: true}}, | ||
[GroupActivityType.SET_REGRESSION]: {Component: IconFire, defaultProps: {}}, | ||
[GroupActivityType.CREATE_ISSUE]: {Component: IconAdd, defaultProps: {}}, | ||
[GroupActivityType.UNMERGE_SOURCE]: {Component: IconPrevious, defaultProps: {}}, | ||
[GroupActivityType.UNMERGE_DESTINATION]: {Component: IconPrevious, defaultProps: {}}, | ||
[GroupActivityType.FIRST_SEEN]: {Component: IconFlag, defaultProps: {}}, | ||
[GroupActivityType.ASSIGNED]: {Component: IconUser, defaultProps: {}}, | ||
[GroupActivityType.UNASSIGNED]: {Component: IconUnsubscribed, defaultProps: {}}, | ||
[GroupActivityType.MERGE]: {Component: IconNext, defaultProps: {}}, | ||
[GroupActivityType.REPROCESS]: {Component: IconRefresh, defaultProps: {}}, | ||
[GroupActivityType.MARK_REVIEWED]: {Component: IconCheckmark, defaultProps: {}}, | ||
[GroupActivityType.AUTO_SET_ONGOING]: {Component: IconPlay, defaultProps: {}}, | ||
[GroupActivityType.SET_ESCALATING]: { | ||
Component: IconGraph, | ||
defaultProps: {type: 'area'}, | ||
}, | ||
[GroupActivityType.SET_PRIORITY]: {Component: IconEdit, defaultProps: {}}, | ||
[GroupActivityType.DELETED_ATTACHMENT]: {Component: IconDelete, defaultProps: {}}, | ||
}; |
Oops, something went wrong.