viewTrendsButton.tsx 793 B

123456789101112131415161718192021222324252627
  1. import {Button} from 'sentry/components/button';
  2. import {t} from 'sentry/locale';
  3. import {useLocation} from 'sentry/utils/useLocation';
  4. import {useNavigate} from 'sentry/utils/useNavigate';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. import {trendsTargetRoute} from 'sentry/views/performance/utils';
  7. export function ViewTrendsButton() {
  8. const location = useLocation();
  9. const organization = useOrganization();
  10. const navigate = useNavigate();
  11. const handleTrendsClick = () => {
  12. const target = trendsTargetRoute({organization, location});
  13. navigate(target);
  14. };
  15. return (
  16. <Button
  17. size="sm"
  18. priority="primary"
  19. data-test-id="landing-header-trends"
  20. onClick={() => handleTrendsClick()}
  21. >
  22. {t('View Trends')}
  23. </Button>
  24. );
  25. }