added email verification
This commit is contained in:
36
apps/hub/app/_components/EmailVerification.tsx
Normal file
36
apps/hub/app/_components/EmailVerification.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
import { useSession } from "next-auth/react";
|
||||
import toast from "react-hot-toast";
|
||||
import { sendVerificationLink } from "(app)/admin/user/action";
|
||||
import { TriangleAlert } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "_components/ui/Button";
|
||||
|
||||
export const EmailVerification = () => {
|
||||
const session = useSession();
|
||||
const [loading, setLoading] = useState(false);
|
||||
return (
|
||||
<div role="alert" className="alert alert-warning">
|
||||
<TriangleAlert />
|
||||
<div>
|
||||
<h3 className="font-bold">Email Addresse nicht bestätigt!</h3>
|
||||
<div className="text-xs">
|
||||
Wenn deine Email Addresse nicht bestätigt ist kannst du dich nicht Verbinden
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
isLoading={loading}
|
||||
className="btn btn-sm"
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
if (!session.data?.user?.id) return;
|
||||
await sendVerificationLink(session.data.user.id); // Replace "userId" with the actual user ID
|
||||
toast.success("Verifizierungslink gesendet! Bitte prüfe deine E-Mails.");
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
Link senden
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -76,9 +76,13 @@ export const HorizontalNav = () => (
|
||||
<div className="flex items-center ml-auto">
|
||||
<ul className="flex space-x-2 px-1">
|
||||
<li>
|
||||
<Link href={process.env.NEXT_PUBLIC_DISPATCH_URL || "#!"} rel="noopener noreferrer">
|
||||
<a
|
||||
href={process.env.NEXT_PUBLIC_DISPATCH_URL || "#!"}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<button className="btn btn-sm btn-outline btn-primary">Zur Leitstelle</button>
|
||||
</Link>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/logout">
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
import {
|
||||
HomeIcon,
|
||||
PersonIcon,
|
||||
GearIcon,
|
||||
ExitIcon,
|
||||
LockClosedIcon,
|
||||
RocketIcon,
|
||||
} from "@radix-ui/react-icons";
|
||||
import Link from "next/link";
|
||||
|
||||
export const VerticalNav = () => {
|
||||
return (
|
||||
<div className="w-64 bg-base-300 p-4 rounded-lg shadow-md">
|
||||
<ul className="menu">
|
||||
<li>
|
||||
<Link href="/">
|
||||
<HomeIcon /> Dashboard
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/profile">
|
||||
<PersonIcon /> Profil
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/events">
|
||||
<RocketIcon />
|
||||
Events & Kurse
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<details open>
|
||||
<summary>
|
||||
<LockClosedIcon />
|
||||
Admin
|
||||
</summary>
|
||||
<ul>
|
||||
<li>
|
||||
<Link href="/admin/user">Benutzer</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/admin/station">Stationen</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/admin/event">Events</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/settings">
|
||||
<GearIcon />
|
||||
Einstellungen
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const HorizontalNav = () => (
|
||||
<div className="navbar bg-base-200 shadow-md rounded-lg mb-4">
|
||||
<div className="flex-1">
|
||||
<a className="btn btn-ghost normal-case text-xl">
|
||||
Virtual Air Rescue - HUB
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex-none">
|
||||
<ul className="flex space-x-2 px-1">
|
||||
<li>
|
||||
<Link href="/">
|
||||
<button className="btn btn-sm btn-outline btn-info">
|
||||
Zur Leitstelle
|
||||
</button>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/logout">
|
||||
<button className="btn btn-sm">
|
||||
<ExitIcon /> Logout
|
||||
</button>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user