More react

- consolidated lang items
- proxy host paths work
This commit is contained in:
Jamie Curnow committed 2025-10-16 18:59:19 +10:00
1 parent 7af01d0fc7
commit f2b5b19a83
56 files changed
+946 -928

No files matched your search

-64
View File
@@ -1,64 +0,0 @@
import type { Table as ReactTable } from "@tanstack/react-table";
import { T } from "src/locale";
interface Props {
tableInstance: ReactTable<any>;
onNew?: () => void;
onNewCustom?: () => void;
isFiltered?: boolean;
}
export default function Empty({ tableInstance, onNew, onNewCustom, isFiltered }: Props) {
return (
<tr>
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
<div className="text-center my-4">
{isFiltered ? (
<h2>
<T id="empty-search" />
</h2>
) : (
<>
<h2>
<T id="certificates.empty" />
</h2>
<p className="text-muted">
<T id="empty-subtitle" />
</p>
<div className="dropdown">
<button
type="button"
className="btn dropdown-toggle btn-pink my-3"
data-bs-toggle="dropdown"
>
<T id="certificates.add" />
</button>
<div className="dropdown-menu">
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
onNew?.();
}}
>
<T id="lets-encrypt" />
</a>
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
onNewCustom?.();
}}
>
<T id="certificates.custom" />
</a>
</div>
</div>
</>
)}
</div>
</td>
</tr>
);
}
+52 -4
View File
@@ -2,10 +2,9 @@ import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
import { useMemo } from "react";
import type { Certificate } from "src/api/backend";
import { DomainsFormatter, GravatarFormatter } from "src/components";
import { DomainsFormatter, EmptyData, GravatarFormatter } from "src/components";
import { TableLayout } from "src/components/Table/TableLayout";
import { intl, T } from "src/locale";
import Empty from "./Empty";
interface Props {
data: Certificate[];
@@ -69,7 +68,11 @@ export default function Table({ data, isFetching }: Props) {
</button>
<div className="dropdown-menu dropdown-menu-end">
<span className="dropdown-header">
<T id="certificates.actions-title" data={{ id: info.row.original.id }} />
<T
id="object.actions-title"
tData={{ object: "certificate" }}
data={{ id: info.row.original.id }}
/>
</span>
<a className="dropdown-item" href="#">
<IconEdit size={16} />
@@ -107,5 +110,50 @@ export default function Table({ data, isFetching }: Props) {
enableSortingRemoval: false,
});
return <TableLayout tableInstance={tableInstance} emptyState={<Empty tableInstance={tableInstance} />} />;
const customAddBtn = (
<div className="dropdown">
<button type="button" className="btn dropdown-toggle btn-pink my-3" data-bs-toggle="dropdown">
<T id="object.add" tData={{ object: "certificate" }} />
</button>
<div className="dropdown-menu">
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
// onNew();
}}
>
<T id="lets-encrypt" />
</a>
<a
className="dropdown-item"
href="#"
onClick={(e) => {
e.preventDefault();
// onNewCustom();
}}
>
<T id="certificates.custom" />
</a>
</div>
</div>
);
return (
<TableLayout
tableInstance={tableInstance}
emptyState={
<EmptyData
object="certificate"
objects="certificates"
tableInstance={tableInstance}
// onNew={onNew}
// isFiltered={isFiltered}
color="pink"
customAddBtn={customAddBtn}
/>
}
/>
);
}
@@ -29,7 +29,7 @@ export default function TableWrapper() {
<div className="row w-full">
<div className="col">
<h2 className="mt-1 mb-0">
<T id="certificates.title" />
<T id="certificates" />
</h2>
</div>
<div className="col-md-auto col-sm-12">
@@ -51,7 +51,7 @@ export default function TableWrapper() {
className="btn btn-sm dropdown-toggle btn-pink mt-1"
data-bs-toggle="dropdown"
>
<T id="certificates.add" />
<T id="object.add" tData={{ object: "certificate" }} />
</button>
<div className="dropdown-menu">
<a className="dropdown-item" href="#">