Translate attachments and admin audit screens
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
|
||||
import { api } from "../api";
|
||||
import { useToast } from "../toast";
|
||||
import { useI18n } from "../i18n/I18nProvider";
|
||||
|
||||
type AuditItem = {
|
||||
id: number;
|
||||
@@ -38,6 +39,7 @@ function canUndo(type: string) {
|
||||
|
||||
export default function AdminAuditPage() {
|
||||
const { toast } = useToast();
|
||||
const { t } = useI18n();
|
||||
const [items, setItems] = useState<AuditItem[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [busyId, setBusyId] = useState<number | null>(null);
|
||||
@@ -77,7 +79,7 @@ export default function AdminAuditPage() {
|
||||
setBusyId(e.id);
|
||||
try {
|
||||
await api.post(`/jobapplications/${e.jobApplicationId}/restore`, {});
|
||||
toast("Restored.", "success");
|
||||
toast(t("adminAuditRestored"), "success");
|
||||
await load();
|
||||
} catch (err: any) {
|
||||
const msg = err?.response?.data || err?.message || "Restore failed.";
|
||||
@@ -92,35 +94,35 @@ export default function AdminAuditPage() {
|
||||
return (
|
||||
<Paper sx={{ mt: 0, p: 2 }}>
|
||||
<Typography variant="h5" sx={{ fontWeight: 900, mb: 1 }}>
|
||||
Audit log
|
||||
{t("adminAuditTitle")}
|
||||
</Typography>
|
||||
<Typography sx={{ color: "text.secondary", mb: 2 }}>
|
||||
Admin-only.
|
||||
{t("adminAuditSubtitle")}
|
||||
</Typography>
|
||||
|
||||
<TableContainer sx={{ borderRadius: 2, border: "1px solid", borderColor: "divider" }}>
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell sx={{ width: 165 }}>At</TableCell>
|
||||
<TableCell sx={{ width: 160 }}>Type</TableCell>
|
||||
<TableCell>Job</TableCell>
|
||||
<TableCell sx={{ width: 220 }}>User</TableCell>
|
||||
<TableCell>Details</TableCell>
|
||||
<TableCell sx={{ width: 170 }}>Actions</TableCell>
|
||||
<TableCell sx={{ width: 165 }}>{t("adminAuditAt")}</TableCell>
|
||||
<TableCell sx={{ width: 160 }}>{t("adminAuditType")}</TableCell>
|
||||
<TableCell>{t("adminAuditJob")}</TableCell>
|
||||
<TableCell sx={{ width: 220 }}>{t("adminAuditUser")}</TableCell>
|
||||
<TableCell>{t("adminAuditDetails")}</TableCell>
|
||||
<TableCell sx={{ width: 170 }}>{t("adminAuditActions")}</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{loading ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={6}>
|
||||
<Typography sx={{ color: "text.secondary" }}>Loading...</Typography>
|
||||
<Typography sx={{ color: "text.secondary" }}>{t("loading")}</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : rows.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={6}>
|
||||
<Typography sx={{ color: "text.secondary" }}>No events.</Typography>
|
||||
<Typography sx={{ color: "text.secondary" }}>{t("adminAuditNoEvents")}</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user