Skip to content

Commit 42c7662

Browse files
feat(feedback): allow giving feedback about the feedback summary (#95347)
1 parent 45ce583 commit 42c7662

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

static/app/components/feedback/feedbackSummary.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,63 @@
11
import styled from '@emotion/styled';
22

3+
import {Button} from 'sentry/components/core/button';
4+
import {Flex} from 'sentry/components/core/layout';
35
import useFeedbackSummary from 'sentry/components/feedback/list/useFeedbackSummary';
46
import LoadingIndicator from 'sentry/components/loadingIndicator';
7+
import {IconThumb} from 'sentry/icons';
58
import {IconSeer} from 'sentry/icons/iconSeer';
69
import {t} from 'sentry/locale';
710
import {space} from 'sentry/styles/space';
11+
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
812
import useOrganization from 'sentry/utils/useOrganization';
913

1014
export default function FeedbackSummary() {
1115
const {isError, isPending, summary, tooFewFeedbacks} = useFeedbackSummary();
1216

1317
const organization = useOrganization();
1418

19+
const openForm = useFeedbackForm();
20+
1521
if (!organization.features.includes('user-feedback-ai-summaries')) {
1622
return null;
1723
}
1824

25+
const feedbackButton = ({type}: {type: 'positive' | 'negative'}) => {
26+
return openForm ? (
27+
<Button
28+
aria-label={t('Give feedback on the AI-powered summary')}
29+
icon={<IconThumb direction={type === 'positive' ? 'up' : 'down'} />}
30+
title={type === 'positive' ? t('I like this') : t(`I don't like this`)}
31+
size={'xs'}
32+
onClick={() =>
33+
openForm({
34+
messagePlaceholder:
35+
type === 'positive'
36+
? t('What did you like about the AI-powered summary?')
37+
: t('How can we make the summary work better for you?'),
38+
tags: {
39+
['feedback.source']: 'feedback_ai_summary',
40+
['feedback.owner']: 'replay',
41+
['feedback.type']: type,
42+
},
43+
})
44+
}
45+
/>
46+
) : null;
47+
};
48+
1949
return (
2050
<SummaryIconContainer>
2151
<IconSeer size="xs" />
2252
<SummaryContainer>
23-
<SummaryHeader>{t('Feedback Summary')}</SummaryHeader>
53+
<Flex justify="space-between" align="center">
54+
<SummaryHeader>{t('Summary')}</SummaryHeader>
55+
<Flex gap={space(0.5)}>
56+
{feedbackButton({type: 'positive'})}
57+
{feedbackButton({type: 'negative'})}
58+
</Flex>
59+
</Flex>
60+
2461
{isPending ? (
2562
<LoadingContainer>
2663
<StyledLoadingIndicator size={24} />

0 commit comments

Comments
 (0)