Skip to content

[WIP] ref(flags): add feedback button for suspect table #92146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions static/app/components/issues/suspect/suspectTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ import {useEffect} from 'react';
import styled from '@emotion/styled';
import Color from 'color';

import {useAnalyticsArea} from 'sentry/components/analyticsArea';
import {Flex} from 'sentry/components/container/flex';
import {Button} from 'sentry/components/core/button';
import {NumberInput} from 'sentry/components/core/input/numberInput';
import {Tooltip} from 'sentry/components/core/tooltip';
import {OrderBy, SortBy} from 'sentry/components/events/featureFlags/utils';
import useSuspectFlagScoreThreshold from 'sentry/components/issues/suspect/useSuspectFlagScoreThreshold';
import Link from 'sentry/components/links/link';
import {IconMegaphone} from 'sentry/icons/iconMegaphone';
import {IconSentry} from 'sentry/icons/iconSentry';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Group} from 'sentry/types/group';
import {trackAnalytics} from 'sentry/utils/analytics';
import toRoundedPercent from 'sentry/utils/number/toRoundedPercent';
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import {DrawerTab} from 'sentry/views/issueDetails/groupDistributions/types';
Expand Down Expand Up @@ -67,13 +71,18 @@ export default function SuspectTable({debugSuspectScores, environments, group}:
return null;
}

const header = (
<TagHeader>
{t('Suspect Flags')}
{debugThresholdInput}
<FeedbackButton />
</TagHeader>
);

if (isPending) {
return (
<GradientBox>
<TagHeader>
{t('Suspect Flags')}
{debugThresholdInput}
</TagHeader>
{header}
{t('Loading...')}
</GradientBox>
);
Expand All @@ -82,21 +91,15 @@ export default function SuspectTable({debugSuspectScores, environments, group}:
if (!susFlags.length) {
return (
<GradientBox>
<TagHeader>
{t('Suspect Flags')}
{debugThresholdInput}
</TagHeader>
{header}
{t('Nothing suspicious')}
</GradientBox>
);
}

return (
<GradientBox>
<TagHeader>
{t('Suspect Flags')}
{debugThresholdInput}
</TagHeader>
{header}

<TagValueGrid>
{susFlags.map(flag => {
Expand Down Expand Up @@ -135,6 +138,30 @@ export default function SuspectTable({debugSuspectScores, environments, group}:
);
}

function FeedbackButton() {
const openFeedbackForm = useFeedbackForm();
const title = t('Give feedback on Suspect Tags/Flags');
const area = useAnalyticsArea();

return (
<Button
title={title}
aria-label={title}
icon={<IconMegaphone />}
size="xs"
onClick={() =>
openFeedbackForm?.({
messagePlaceholder: t('How can we make Suspect Tags and Flags better for you?'),
tags: {
['feedback.source']: area,
['feedback.owner']: 'replay',
},
})
}
/>
);
}

const GradientBox = styled('div')`
border: 1px solid ${p => p.theme.border};
background: ${p => p.theme.background};
Expand Down
Loading