viewTrendsButton.tsx 917 B

1234567891011121314151617181920212223242526272829
  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 {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
  7. import {trendsTargetRoute} from 'sentry/views/performance/utils';
  8. export function ViewTrendsButton() {
  9. const location = useLocation();
  10. const organization = useOrganization();
  11. const navigate = useNavigate();
  12. const {view} = useDomainViewFilters();
  13. const handleTrendsClick = () => {
  14. const target = trendsTargetRoute({organization, location, view});
  15. navigate(target);
  16. };
  17. return (
  18. <Button
  19. size="sm"
  20. priority="primary"
  21. data-test-id="landing-header-trends"
  22. onClick={() => handleTrendsClick()}
  23. >
  24. {t('View Trends')}
  25. </Button>
  26. );
  27. }