Add non-destructive dev seed on startup

This commit is contained in:
t.indorf
2026-05-06 22:31:07 +02:00
parent 9f452fccac
commit b686e714ff
77 changed files with 10862 additions and 87 deletions
+42
View File
@@ -0,0 +1,42 @@
"use client";
import { useTransition } from "react";
import { Loader2, BellRing } from "lucide-react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { triggerAlertAction } from "./actions";
export function AlertButton({
assignmentId,
parentUserId,
}: {
assignmentId: string;
parentUserId: string;
}) {
const [isPending, startTransition] = useTransition();
const handleAlert = () => {
if (!confirm("Bist du sicher? Dies löst den Notdienst-Alarm aus.")) return;
startTransition(async () => {
const result = await triggerAlertAction(assignmentId, parentUserId);
if ("error" in result && result.error) {
toast.error(result.error);
} else {
toast.success("Alarm erfolgreich ausgelöst. E-Mail wurde versendet.");
}
});
};
return (
<Button variant="destructive" onClick={handleAlert} disabled={isPending}>
{isPending ? (
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
) : (
<BellRing className="mr-2 h-4 w-4" />
)}
Alarm auslösen
</Button>
);
}