Skip to content

Commit 6cdaf88

Browse files
committed
👔 Remove onClick handler, and move to using theme spacing
1 parent 4eb8681 commit 6cdaf88

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

static/app/components/searchQueryBuilder/askSeer.tsx

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ import type {ComboBoxState} from '@react-stately/combobox';
66
import {FeatureBadge} from 'sentry/components/core/badge/featureBadge';
77
import InteractionStateLayer from 'sentry/components/core/interactionStateLayer';
88
import {makeOrganizationSeerSetupQueryKey} from 'sentry/components/events/autofix/useOrganizationSeerSetup';
9-
import {
10-
setupCheckQueryKey,
11-
useSeerAcknowledgeMutation,
12-
} from 'sentry/components/events/autofix/useSeerAcknowledgeMutation';
9+
import {setupCheckQueryKey} from 'sentry/components/events/autofix/useSeerAcknowledgeMutation';
1310
import ExternalLink from 'sentry/components/links/externalLink';
1411
import LoadingIndicator from 'sentry/components/loadingIndicator';
1512
import {useSearchQueryBuilder} from 'sentry/components/searchQueryBuilder/context';
1613
import {IconSeer} from 'sentry/icons';
1714
import {t, tct} from 'sentry/locale';
18-
import {space} from 'sentry/styles/space';
1915
import {trackAnalytics} from 'sentry/utils/analytics';
2016
import {useIsFetching, useIsMutating} from 'sentry/utils/queryClient';
2117
import useOrganization from 'sentry/utils/useOrganization';
@@ -24,10 +20,8 @@ export const ASK_SEER_ITEM_KEY = 'ask_seer';
2420
export const ASK_SEER_CONSENT_ITEM_KEY = 'ask_seer_consent';
2521

2622
function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
27-
const organization = useOrganization();
2823
const itemRef = useRef<HTMLDivElement>(null);
2924
const [optionDisableOverride, setOptionDisableOverride] = useState(false);
30-
const {mutate: seerAcknowledgeMutate} = useSeerAcknowledgeMutation();
3125

3226
const {optionProps, labelProps, isFocused, isPressed} = useOption(
3327
{
@@ -41,28 +35,15 @@ function AskSeerConsentOption<T>({state}: {state: ComboBoxState<T>}) {
4135
itemRef
4236
);
4337

44-
const handleClick = () => {
45-
trackAnalytics('trace.explorer.ai_query_interface', {
46-
organization,
47-
action: 'consent_accepted',
48-
});
49-
seerAcknowledgeMutate();
50-
};
51-
5238
return (
53-
<AskSeerListItem
54-
ref={itemRef}
55-
onClick={handleClick}
56-
{...optionProps}
57-
justifyContent="space-between"
58-
>
39+
<AskSeerListItem ref={itemRef} {...optionProps} justifyContent="space-between">
5940
<InteractionStateLayer isHovered={isFocused} isPressed={isPressed} />
60-
<div style={{display: 'flex', alignItems: 'center', gap: space(1)}}>
41+
<AskSeerConsentLabelWrapper>
6142
<IconSeer />
6243
<AskSeerLabel {...labelProps}>
6344
{t('Enable Gen AI')} <FeatureBadge type="beta" />
6445
</AskSeerLabel>
65-
</div>
46+
</AskSeerConsentLabelWrapper>
6647
<SeerConsentText>
6748
{tct(
6849
'Query assistant requires Generative AI which is subject to our [dataProcessingPolicy:data processing policy].',
@@ -188,7 +169,7 @@ const AskSeerListItem = styled('div')<{justifyContent?: 'flex-start' | 'space-be
188169
display: flex;
189170
align-items: center;
190171
width: 100%;
191-
padding: ${space(1)} ${space(1.5)};
172+
padding: ${p => p.theme.space.md} ${p => p.theme.space.lg};
192173
background: transparent;
193174
border-radius: 0;
194175
background-color: none;
@@ -198,7 +179,7 @@ const AskSeerListItem = styled('div')<{justifyContent?: 'flex-start' | 'space-be
198179
font-weight: ${p => p.theme.fontWeight.bold};
199180
text-align: left;
200181
justify-content: ${p => p.justifyContent ?? 'flex-start'};
201-
gap: ${space(1)};
182+
gap: ${p => p.theme.space.md};
202183
list-style: none;
203184
margin: 0;
204185
@@ -220,6 +201,12 @@ const AskSeerLabel = styled('span')<{width?: 'auto'}>`
220201
font-weight: ${p => p.theme.fontWeight.bold};
221202
display: flex;
222203
align-items: center;
223-
gap: ${space(1)};
204+
gap: ${p => p.theme.space.md};
224205
width: ${p => p.width};
225206
`;
207+
208+
const AskSeerConsentLabelWrapper = styled('div')`
209+
display: flex;
210+
align-items: center;
211+
gap: ${p => p.theme.space.md};
212+
`;

0 commit comments

Comments
 (0)