Empty.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import type { Table as ReactTable } from "@tanstack/react-table";
  2. import { T } from "src/locale";
  3. interface Props {
  4. tableInstance: ReactTable<any>;
  5. onNew?: () => void;
  6. onNewCustom?: () => void;
  7. isFiltered?: boolean;
  8. }
  9. export default function Empty({ tableInstance, onNew, onNewCustom, isFiltered }: Props) {
  10. return (
  11. <tr>
  12. <td colSpan={tableInstance.getVisibleFlatColumns().length}>
  13. <div className="text-center my-4">
  14. {isFiltered ? (
  15. <h2>
  16. <T id="empty-search" />
  17. </h2>
  18. ) : (
  19. <>
  20. <h2>
  21. <T id="certificates.empty" />
  22. </h2>
  23. <p className="text-muted">
  24. <T id="empty-subtitle" />
  25. </p>
  26. <div className="dropdown">
  27. <button
  28. type="button"
  29. className="btn dropdown-toggle btn-pink my-3"
  30. data-bs-toggle="dropdown"
  31. >
  32. <T id="certificates.add" />
  33. </button>
  34. <div className="dropdown-menu">
  35. <a
  36. className="dropdown-item"
  37. href="#"
  38. onClick={(e) => {
  39. e.preventDefault();
  40. onNew?.();
  41. }}
  42. >
  43. <T id="lets-encrypt" />
  44. </a>
  45. <a
  46. className="dropdown-item"
  47. href="#"
  48. onClick={(e) => {
  49. e.preventDefault();
  50. onNewCustom?.();
  51. }}
  52. >
  53. <T id="certificates.custom" />
  54. </a>
  55. </div>
  56. </div>
  57. </>
  58. )}
  59. </div>
  60. </td>
  61. </tr>
  62. );
  63. }