Files
moybeach-main/app/admin/users/DeleteUserButton.tsx
T

28 lines
818 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client';
import { Trash2 } from 'lucide-react';
import { deleteUser } from './actions';
export function DeleteUserButton({ userId, username, disabled }: { userId: string; username: string; disabled: boolean }) {
if (disabled) return null;
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
if (!confirm(`"${username}" kullanıcısı silinsin mi?`)) {
e.preventDefault();
}
};
return (
<form action={deleteUser} onSubmit={handleSubmit}>
<input type="hidden" name="id" value={userId} />
<button
type="submit"
title="Kullanıcıyı Sil"
className="p-2 text-red-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors"
>
<Trash2 className="w-4 h-4" />
</button>
</form>
);
}