Add shared ConfirmDialog; upgrade wordfilter with client actions and toasts.
Local Build and Deploy / deploy (push) Successful in 1m6s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 20:28:43 +02:00
1 parent 1039044e48
commit a2ca9b3c23
9 files changed
+366 -149

No files matched your search

+10 -1
View File
@@ -4,10 +4,12 @@ import Image from "next/image";
import { useTranslations } from "next-intl";
import { useRef, useState } from "react";
import { deleteFavicon, saveFavicon } from "@/actions/save-favicon";
import { useConfirmDialog } from "@/components/admin/confirm-dialog";
import { FaviconGenerator } from "./favicon-generator";
export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
const t = useTranslations("pages.admin.favicon");
const { confirm, dialog: confirmDialog } = useConfirmDialog();
const [uploading, setUploading] = useState(false);
const [deleting, setDeleting] = useState(false);
const [preview, setPreview] = useState<string | null>(currentUrl);
@@ -33,7 +35,13 @@ export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
}
async function handleDelete() {
if (!confirm(t("confirmDelete"))) return;
const ok = await confirm({
title: t("delete"),
description: t("confirmDelete"),
confirmLabel: t("delete"),
cancelLabel: t("cancel"),
});
if (!ok) return;
setDeleting(true);
setMessage(null);
const result = await deleteFavicon();
@@ -66,6 +74,7 @@ export function FaviconForm({ currentUrl }: { currentUrl: string | null }) {
return (
<div className="grid gap-6 lg:grid-cols-2">
{confirmDialog}
<div className="admin-card">
<h3 className="text-sm font-extrabold text-[var(--admin-text)] mb-4">
{t("uploadLabel")}