Updated Dialogues

This commit is contained in:
headlesdev
2025-05-18 20:15:23 +02:00
parent e374ecebe5
commit 4f00b0b532
4 changed files with 186 additions and 89 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import useNetworks from "@/hooks/useNetworks";
import { Trash2, AlertTriangle } from "lucide-react";
interface DeleteNetworkProps {
networkId: string;
@@ -7,17 +8,44 @@ interface DeleteNetworkProps {
export default function DeleteNetwork({ networkId }: DeleteNetworkProps) {
const { deleteNetwork } = useNetworks();
const handleDelete = () => {
deleteNetwork(networkId);
};
return (
<div>
<dialog id="delete_network" className="modal">
<div className="modal-box w-2/3 max-w-2/3">
<h3 className="text-lg font-bold">Delete Network</h3>
<p className="py-4">Are you sure you want to delete this network?</p>
<div className="modal-box w-11/12 max-w-md border-l-4 border-error">
<div className="flex items-center gap-3 mb-3">
<div className="bg-error text-error-content rounded-full p-2 flex items-center justify-center">
<Trash2 className="h-6 w-6" />
</div>
<h3 className="font-bold text-xl">Delete Network</h3>
</div>
<div className="bg-base-200 p-4 rounded-lg mb-4">
<p className="text-sm">
<span className="font-medium">Are you sure you want to delete this network?</span>
</p>
<p className="text-sm mt-2">
This will also delete all servers & applications associated with it.
</p>
<div className="mt-2 flex items-center gap-2 text-error">
<AlertTriangle className="h-5 w-5" />
<span className="font-bold">This action cannot be undone.</span>
</div>
</div>
<div className="modal-action">
<form method="dialog">
<button className="btn">Cancel</button>
<button className="btn btn-primary" onClick={() => deleteNetwork(networkId)}>Delete</button>
<form method="dialog" className="flex gap-2">
<button className="btn btn-outline">Cancel</button>
<button
className="btn btn-error text-error-content"
onClick={handleDelete}
>
Delete Network
</button>
</form>
</div>
</div>