Skip to content

Commit 8b4181c

Browse files
ref(js): Convert events/userFeedback to a FC (#43283)
1 parent 6627fa5 commit 8b4181c

File tree

1 file changed

+40
-46
lines changed

1 file changed

+40
-46
lines changed

static/app/components/events/userFeedback.tsx

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Component} from 'react';
21
import styled from '@emotion/styled';
32

43
import ActivityAuthor from 'sentry/components/activity/author';
@@ -18,52 +17,47 @@ type Props = {
1817
className?: string;
1918
};
2019

21-
export class EventUserFeedback extends Component<Props> {
22-
getUrl() {
23-
const {report, orgId, issueId} = this.props;
20+
export function EventUserFeedback({className, report, orgId, issueId}: Props) {
21+
const user = report.user || {
22+
name: report.name,
23+
email: report.email,
24+
id: '',
25+
username: '',
26+
ip_address: '',
27+
};
2428

25-
return `/organizations/${orgId}/issues/${issueId}/events/${report.eventID}/?referrer=user-feedback`;
26-
}
27-
28-
render() {
29-
const {className, report} = this.props;
30-
const user = report.user || {
31-
name: report.name,
32-
email: report.email,
33-
id: '',
34-
username: '',
35-
ip_address: '',
36-
};
37-
38-
return (
39-
<div className={className}>
40-
<ActivityItem
41-
date={report.dateCreated}
42-
author={{type: 'user', user}}
43-
header={
44-
<div>
45-
<ActivityAuthor>{report.name}</ActivityAuthor>
46-
<Clipboard value={report.email}>
47-
<Email>
48-
{report.email}
49-
<StyledIconCopy size="xs" />
50-
</Email>
51-
</Clipboard>
52-
{report.eventID && (
53-
<ViewEventLink to={this.getUrl()}>{t('View event')}</ViewEventLink>
54-
)}
55-
</div>
56-
}
57-
>
58-
<p
59-
dangerouslySetInnerHTML={{
60-
__html: nl2br(escape(report.comments)),
61-
}}
62-
/>
63-
</ActivityItem>
64-
</div>
65-
);
66-
}
29+
return (
30+
<div className={className}>
31+
<ActivityItem
32+
date={report.dateCreated}
33+
author={{type: 'user', user}}
34+
header={
35+
<div>
36+
<ActivityAuthor>{report.name}</ActivityAuthor>
37+
<Clipboard value={report.email}>
38+
<Email>
39+
{report.email}
40+
<StyledIconCopy size="xs" />
41+
</Email>
42+
</Clipboard>
43+
{report.eventID && (
44+
<ViewEventLink
45+
to={`/organizations/${orgId}/issues/${issueId}/events/${report.eventID}/?referrer=user-feedback`}
46+
>
47+
{t('View event')}
48+
</ViewEventLink>
49+
)}
50+
</div>
51+
}
52+
>
53+
<p
54+
dangerouslySetInnerHTML={{
55+
__html: nl2br(escape(report.comments)),
56+
}}
57+
/>
58+
</ActivityItem>
59+
</div>
60+
);
6761
}
6862

6963
const Email = styled('span')`

0 commit comments

Comments
 (0)