Alter Maintenance-Screen hinzugefügt

This commit is contained in:
PxlLoewe
2025-07-03 21:17:23 -07:00
parent 2ff2c3274a
commit 7c050cf42e
16 changed files with 168 additions and 199 deletions

View File

@@ -80,7 +80,7 @@ export const VerticalNav = async () => {
)}
{session.user.permissions.includes("ADMIN_MESSAGE") && (
<li>
<Link href="/admin/message">Service Nachrichten</Link>
<Link href="/admin/config">Config</Link>
</li>
)}
{session.user.permissions.includes("ADMIN_USER") && (

View File

@@ -1,19 +1,12 @@
import { prisma } from "@repo/db";
import { MessageCircleWarning } from "lucide-react";
const fetchMainMessage = async () => {
return await prisma.notam.findFirst({
where: {
active: true,
},
});
};
export const WarningAlert = async () => {
const mainMessage = await fetchMainMessage();
if (mainMessage?.showUntilActive && new Date(mainMessage.showUntil) < new Date()) {
return <></>;
}
const mainMessage = await await prisma.notam.findFirst({
orderBy: {
createdAt: "desc",
},
});
let msgColor;
switch (mainMessage?.color) {
@@ -33,14 +26,14 @@ export const WarningAlert = async () => {
msgColor = "alert alert-soft ml-3 py-2 flex items-center gap-2";
}
if ((mainMessage?.message == "" && !mainMessage?.wartungsmodus) || !mainMessage) {
return <></>;
if ((mainMessage?.message == "" && !mainMessage?.maintenanceEnabled) || !mainMessage) {
return null;
} else {
return (
<div role="alert" className={msgColor}>
<MessageCircleWarning />
<span className="font-bold m-0">
{mainMessage?.wartungsmodus ? "Wartungsmodus aktiv!" : mainMessage?.message}
{mainMessage?.maintenanceEnabled ? "Wartungsmodus aktiv!" : mainMessage?.message}
</span>
</div>
);