autofixFeedback.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {useRef} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Button} from 'sentry/components/button';
  4. import {IconMegaphone} from 'sentry/icons/iconMegaphone';
  5. import {t} from 'sentry/locale';
  6. import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
  7. function AutofixFeedback() {
  8. const buttonRef = useRef<HTMLButtonElement>(null);
  9. const openForm = useFeedbackForm();
  10. if (!openForm) {
  11. return null;
  12. }
  13. return (
  14. <StyledButton
  15. ref={buttonRef}
  16. size="zero"
  17. borderless
  18. icon={<IconMegaphone />}
  19. onClick={() =>
  20. openForm({
  21. messagePlaceholder: t('How can we make Autofix better for you?'),
  22. tags: {
  23. ['feedback.source']: 'issue_details_ai_autofix',
  24. ['feedback.owner']: 'ml-ai',
  25. },
  26. })
  27. }
  28. >
  29. {t('Give Feedback')}
  30. </StyledButton>
  31. );
  32. }
  33. const StyledButton = styled(Button)`
  34. padding: 0;
  35. margin: 0;
  36. font-size: ${p => p.theme.fontSizeSmall};
  37. font-weight: ${p => p.theme.fontWeightNormal};
  38. color: ${p => p.theme.subText};
  39. `;
  40. export default AutofixFeedback;