RouterDebugger.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import { getAppRoutes } from '../../routes/routes';
  4. import { PageContents } from '../components/Page/PageContents';
  5. import { RouteDescriptor } from './types';
  6. export const RouterDebugger: React.FC<any> = () => {
  7. const manualRoutes: RouteDescriptor[] = [];
  8. return (
  9. <PageContents>
  10. <h1>Static routes</h1>
  11. <ul>
  12. {getAppRoutes().map((r, i) => {
  13. if (r.path.indexOf(':') > -1 || r.path.indexOf('test') > -1) {
  14. if (r.path.indexOf('test') === -1) {
  15. manualRoutes.push(r);
  16. }
  17. return null;
  18. }
  19. return (
  20. <li key={i}>
  21. <Link target="_blank" to={r.path}>
  22. {r.path}
  23. </Link>
  24. </li>
  25. );
  26. })}
  27. </ul>
  28. <h1>Dynamic routes - check those manually</h1>
  29. <ul>
  30. {manualRoutes.map((r, i) => {
  31. return (
  32. <li key={i}>
  33. <Link key={`${i}-${r.path}`} target="_blank" to={r.path}>
  34. {r.path}
  35. </Link>
  36. </li>
  37. );
  38. })}
  39. </ul>
  40. </PageContents>
  41. );
  42. };