tabs.tsx 950 B

123456789101112131415161718192021222324252627282930313233343536
  1. import {TabList, Tabs} from 'sentry/components/tabs';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. interface Props {
  4. selected: 'replays' | 'selectors';
  5. }
  6. const SELECTOR_IDX_ROUTE = 'selectors';
  7. const REPLAY_IDX_ROUTE = '';
  8. const TABS = [
  9. {key: 'replays', label: 'Replays', to: REPLAY_IDX_ROUTE},
  10. {key: 'selectors', label: 'Selectors', to: SELECTOR_IDX_ROUTE},
  11. ];
  12. export default function ReplayTabs({selected}: Props) {
  13. const organization = useOrganization();
  14. const hasDeadClickFeature = organization.features.includes(
  15. 'session-replay-rage-dead-selectors'
  16. );
  17. return hasDeadClickFeature ? (
  18. <Tabs value={selected}>
  19. <TabList hideBorder>
  20. {TABS.map(tab => (
  21. <TabList.Item
  22. key={tab.key}
  23. to={`/organizations/${organization.slug}/replays/${tab.to}`}
  24. >
  25. {tab.label}
  26. </TabList.Item>
  27. ))}
  28. </TabList>
  29. </Tabs>
  30. ) : null;
  31. }