Empty.tsx 870 B

123456789101112131415161718192021222324252627282930
  1. import type { Table as ReactTable } from "@tanstack/react-table";
  2. import { Button } from "src/components";
  3. import { intl } from "src/locale";
  4. interface Props {
  5. tableInstance: ReactTable<any>;
  6. onNew?: () => void;
  7. isFiltered?: boolean;
  8. }
  9. export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
  10. return (
  11. <tr>
  12. <td colSpan={tableInstance.getVisibleFlatColumns().length}>
  13. <div className="text-center my-4">
  14. {isFiltered ? (
  15. <h2>{intl.formatMessage({ id: "empty-search" })}</h2>
  16. ) : (
  17. <>
  18. <h2>{intl.formatMessage({ id: "proxy-hosts.empty" })}</h2>
  19. <p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
  20. <Button className="btn-lime my-3" onClick={onNew}>
  21. {intl.formatMessage({ id: "proxy-hosts.add" })}
  22. </Button>
  23. </>
  24. )}
  25. </div>
  26. </td>
  27. </tr>
  28. );
  29. }