fix: resolve critical bugs and improve admin panel reliability
- Fix missing await in pets API route causing empty responses - Fix updateSetting to use upsert pattern instead of update-only - Create missing /api/admin/sounds/upload route (upload was broken) - Wire bulk delete actions in catalog table - Replace native confirm() with useConfirmDialog() across rooms and clone pages - Add error logging to silent catch blocks in radio actions and audit route - Add graceful degradation to devops health endpoint - Add cache eviction to clone icon route to prevent memory leak - Internationalize hardcoded Italian strings to English - Remove placeholder created_at fields from prefix API responses - Remove dead code and fix type errors in translations and import pages - Standardize PERMS import path in analytics export route
This commit is contained in:
1 parent
6f53ca514d
commit
1b817fe434
19 files changed
+255
-89
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -370,6 +371,7 @@ interface FurniGridProps {
|
||||
const PER_PAGE = 50;
|
||||
|
||||
function FurniGrid({ source }: FurniGridProps) {
|
||||
const { confirm, dialog: confirmDialog } = useConfirmDialog();
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [activeSearch, setActiveSearch] = useState("");
|
||||
const [items, setItems] = useState<FurniItem[]>([]);
|
||||
@@ -554,13 +556,12 @@ function FurniGrid({ source }: FurniGridProps) {
|
||||
toast.info("Nothing to clone — everything is already present");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!window.confirm(
|
||||
`Clone ALL ${names.length} furni from "${source.name}"? This can take a while.`,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const confirmed = await confirm({
|
||||
title: "Clone All Furni",
|
||||
description: `Clone ALL ${names.length} furni from "${source.name}"? This can take a while.`,
|
||||
confirmLabel: "Clone All",
|
||||
});
|
||||
if (!confirmed) return;
|
||||
batchAbortRef.current?.abort();
|
||||
const abort = new AbortController();
|
||||
batchAbortRef.current = abort;
|
||||
@@ -614,6 +615,7 @@ function FurniGrid({ source }: FurniGridProps) {
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{confirmDialog}
|
||||
{/* Stats bar */}
|
||||
{stats && (
|
||||
<div className="flex items-center gap-3 flex-wrap">
|
||||
|
||||
@@ -396,14 +396,6 @@ export function ImportFurniClient({ source }: { source: FurniImportSource }) {
|
||||
}
|
||||
}, [statusFilter, activeSearch, fetchItems]);
|
||||
|
||||
function _doSearch(e?: React.FormEvent) {
|
||||
e?.preventDefault();
|
||||
setActiveSearch(searchTerm);
|
||||
setPage(1);
|
||||
fetchItems(searchTerm, 1, statusFilter);
|
||||
}
|
||||
void _doSearch;
|
||||
|
||||
function goPage(p: number) {
|
||||
setPage(p);
|
||||
fetchItems(activeSearch, p, statusFilter);
|
||||
|
||||
@@ -215,7 +215,7 @@ export function NitroEditorDialog({
|
||||
return;
|
||||
}
|
||||
|
||||
toast.success("Nitro metadata salvato");
|
||||
toast.success("Nitro metadata saved");
|
||||
setMetadata(metadataToSave);
|
||||
setOriginalMetadata(JSON.parse(JSON.stringify(metadataToSave)));
|
||||
setOriginalFlags({ ...flags });
|
||||
@@ -392,7 +392,7 @@ export function NitroEditorDialog({
|
||||
<section className="rounded-lg border bg-card p-4">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Ruler className="w-4 h-4 text-muted-foreground" />
|
||||
<h3 className="text-sm font-medium">Dimensioni</h3>
|
||||
<h3 className="text-sm font-medium">Dimensions</h3>
|
||||
</div>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
<div>
|
||||
@@ -400,7 +400,7 @@ export function NitroEditorDialog({
|
||||
htmlFor="dim-x"
|
||||
className="text-xs text-muted-foreground"
|
||||
>
|
||||
X (larghezza)
|
||||
X (width)
|
||||
</Label>
|
||||
<Input
|
||||
id="dim-x"
|
||||
@@ -432,7 +432,7 @@ export function NitroEditorDialog({
|
||||
htmlFor="dim-z"
|
||||
className="text-xs text-muted-foreground"
|
||||
>
|
||||
Z (altezza)
|
||||
Z (height)
|
||||
</Label>
|
||||
<Input
|
||||
id="dim-z"
|
||||
@@ -451,7 +451,7 @@ export function NitroEditorDialog({
|
||||
<section className="rounded-lg border bg-card p-4">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<MousePointerClick className="w-4 h-4 text-muted-foreground" />
|
||||
<h3 className="text-sm font-medium">Interazione</h3>
|
||||
<h3 className="text-sm font-medium">Interaction</h3>
|
||||
</div>
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex items-center justify-between rounded-md border px-3 py-2 hover:bg-muted/50 transition-colors">
|
||||
@@ -489,7 +489,7 @@ export function NitroEditorDialog({
|
||||
<section className="rounded-lg border bg-card p-4">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Compass className="w-4 h-4 text-muted-foreground" />
|
||||
<h3 className="text-sm font-medium">Direzioni</h3>
|
||||
<h3 className="text-sm font-medium">Directions</h3>
|
||||
<span className="text-xs text-muted-foreground ml-auto">
|
||||
{directions.length} attive
|
||||
</span>
|
||||
@@ -784,7 +784,7 @@ export function NitroEditorDialog({
|
||||
variant="secondary"
|
||||
className="text-[10px] gap-1 animate-[pulse_1s_ease-in-out_1]"
|
||||
>
|
||||
Modifiche non salvate
|
||||
Unsaved changes
|
||||
</Badge>
|
||||
)}
|
||||
<div className="flex-1" />
|
||||
|
||||
Reference in new issue
Block a user