Dispatch Router-Struktur; AddPenalty Layout gefixed

This commit is contained in:
PxlLoewe
2025-06-27 15:52:28 -07:00
parent 782ba7669d
commit 91ed14ac08
47 changed files with 168 additions and 179 deletions

View File

@@ -158,7 +158,7 @@ export const FirstPath = () => {
}
}}
>
{page === "path" ? "Weiter" : "Pfad auswählen"}
{page === "path" ? "Weiter" : "Intro abschließen"}
</Button>
</div>
</div>

View File

@@ -256,7 +256,7 @@ export const DispoStats = async () => {
</div>
<div className="stat-title">Disponent Login Zeit</div>
<div className="stat-value text-secondary">
{hours}h {minutes}m
{hours}h {minutes}min
</div>
</div>

View File

@@ -6,10 +6,7 @@ import {
ConnectedAircraft,
ConnectedDispatcher,
DiscordAccount,
Penalty,
PenaltyType,
PERMISSION,
Report,
Station,
User,
} from "@repo/db";
@@ -57,7 +54,7 @@ import { Error } from "_components/Error";
import { useSession } from "next-auth/react";
import { setStandardName } from "../../../../../../helper/discord";
import { penaltyColumns } from "(app)/admin/penalty/columns";
import { addPenalty, editPenalty, editPenaltys } from "(app)/admin/penalty/actions";
import { addPenalty, editPenaltys } from "(app)/admin/penalty/actions";
import { reportColumns } from "(app)/admin/report/columns";
interface ProfileFormProps {
@@ -123,26 +120,30 @@ export const ProfileForm: React.FC<ProfileFormProps> = ({ user }: ProfileFormPro
{form.formState.errors.lastname && (
<p className="text-error">{form.formState.errors.lastname?.message}</p>
)}
<label className="floating-label w-full">
<span className="text-lg flex items-center gap-2">
<EnvelopeClosedIcon /> E-Mail
</span>
<input
{...form.register("email")}
type="text"
className="input input-bordered w-full mb-2"
defaultValue={user?.email}
placeholder="E-Mail"
/>
</label>
{form.formState.errors.email && (
<p className="text-error">{form.formState.errors.email?.message}</p>
)}
{session.data?.user.permissions.includes("ADMIN_USER_ADVANCED") && (
<>
<label className="floating-label w-full">
<span className="text-lg flex items-center gap-2">
<EnvelopeClosedIcon /> E-Mail
</span>
<input
{...form.register("email")}
type="text"
className="input input-bordered w-full mb-2"
defaultValue={user?.email}
placeholder="E-Mail"
/>
</label>
{form.formState.errors.email && (
<p className="text-error">{form.formState.errors.email?.message}</p>
)}
<label className="label">
<input type="checkbox" {...form.register("emailVerified")} className="checkbox" />
Email bestätigt
</label>
<label className="label">
<input type="checkbox" {...form.register("emailVerified")} className="checkbox" />
Email bestätigt
</label>
</>
)}
<Select
isMulti
form={form}
@@ -334,7 +335,8 @@ export const UserPenalties = ({ user }: { user: User }) => {
</span>
<div className="flex gap-2">
<PenaltyDropdown
Icon={<RedoDot size={15} />}
btnName="Zeitstrafe hinzufügen"
Icon={<Timer size={15} />}
onClick={async ({ reason, until }) => {
if (!reason) return toast.error("Bitte gib einen Grund für die Strafe an.");
if (!until) return toast.error("Bitte gib eine Dauer für die Strafe ein.");
@@ -350,12 +352,13 @@ export const UserPenalties = ({ user }: { user: User }) => {
penaltyTable.current?.refresh();
toast.success("Time-Ban wurde hinzugefügt!");
}}
btnClassName="btn btn-outline btn-warning tooltip-warning"
btnTip="Timeban hinzufügen"
btnClassName="btn-outline btn-warning tooltip-warning"
btnTip="Der Nutzer wird für eine bestimmte Zeit gesperrt"
showDatePicker={true}
/>
{session.data?.user.permissions.includes("ADMIN_USER_ADVANCED") && (
<PenaltyDropdown
btnName="Bannen"
Icon={<LockKeyhole size={15} />}
onClick={async ({ reason }) => {
if (!reason) return toast.error("Bitte gib einen Grund für die Strafe an.");
@@ -371,7 +374,7 @@ export const UserPenalties = ({ user }: { user: User }) => {
penaltyTable.current?.refresh();
toast.success("Ban wurde hinzugefügt!");
}}
btnClassName="btn btn-outline btn-error tooltip-error"
btnClassName="btn-outline btn-error tooltip-error"
btnTip="Nutzerkonto sperren"
/>
)}
@@ -503,7 +506,7 @@ export const AdminForm = ({
role="submit"
className="btn-sm flex-1 min-w-[250px] btn-outline btn-warning"
>
<HobbyKnifeIcon /> HUB zugang entsperren
<HobbyKnifeIcon /> Account entsperren
</Button>
)}
{discordAccount && (

View File

@@ -1,7 +1,9 @@
import { User2 } from "lucide-react";
import { PaginatedTable } from "../../../_components/PaginatedTable";
import { getServerSession } from "api/auth/[...nextauth]/auth";
const AdminUserPage = async () => {
const session = await getServerSession();
return (
<>
<PaginatedTable
@@ -27,10 +29,14 @@ const AdminUserPage = async () => {
header: "Nachname",
accessorKey: "lastname",
},
{
header: "Email",
accessorKey: "email",
},
...(session?.user.permissions.includes("ADMIN_USER_ADVANCED")
? [
{
header: "Email",
accessorKey: "email",
},
]
: []),
]}
leftOfSearch={
<p className="text-2xl font-semibold text-left flex items-center gap-2">