added dockerfile for docs
This commit is contained in:
@@ -59,16 +59,17 @@ export const ContextMenu = () => {
|
||||
const addOSMobjects = async (ignorePreviosSelected?: boolean) => {
|
||||
const res = await fetch(
|
||||
`https://overpass-api.de/api/interpreter?data=${encodeURIComponent(`
|
||||
[out:json];
|
||||
(
|
||||
way["building"](around:100, ${contextMenu.lat}, ${contextMenu.lng});
|
||||
relation["building"](around:100, ${contextMenu.lat}, ${contextMenu.lng});
|
||||
);
|
||||
out body;
|
||||
>;
|
||||
out skel qt;
|
||||
`)}`,
|
||||
[out:json];
|
||||
(
|
||||
way["leisure"~"pitch|sports_centre"](around:2000, ${contextMenu.lat}, ${contextMenu.lng});
|
||||
relation["leisure"~"pitch|sports_centre"](around:2000, ${contextMenu.lat}, ${contextMenu.lng});
|
||||
);
|
||||
out body;
|
||||
>;
|
||||
out skel qt;
|
||||
`)}`,
|
||||
);
|
||||
|
||||
const data = await res.json();
|
||||
const parsed: OSMWay[] = data.elements
|
||||
.filter((e: any) => e.type === "way")
|
||||
|
||||
2
apps/docs/.dockerignore
Normal file
2
apps/docs/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
||||
32
apps/docs/Dockerfile
Normal file
32
apps/docs/Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# --- Build stage ---
|
||||
FROM node:24-alpine3.21 AS builder
|
||||
# Consider using the latest patch version for security updates
|
||||
RUN apk update && apk upgrade
|
||||
|
||||
# Install pnpm
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Set workdir
|
||||
WORKDIR /app
|
||||
|
||||
# Copy project files
|
||||
COPY ./apps/docs .
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install
|
||||
|
||||
# Build VitePress site
|
||||
RUN pnpm build
|
||||
|
||||
# --- Serve stage ---
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built site to nginx public folder
|
||||
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,46 +1,55 @@
|
||||
import { getPublicUser, prisma } from "@repo/db";
|
||||
import { TriangleAlert } from "lucide-react";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { PenaltyCountdown } from "./PenaltyCountdown";
|
||||
import { getServerSession } from "api/auth/[...nextauth]/auth";
|
||||
|
||||
export const Penalty = async () => {
|
||||
const session = await getServerSession();
|
||||
const openPenaltys = await prisma.penalty.findMany({
|
||||
const openTimeban = await prisma.penalty.findMany({
|
||||
where: {
|
||||
userId: session?.user.id,
|
||||
until: {
|
||||
gte: new Date(),
|
||||
},
|
||||
suspended: false,
|
||||
|
||||
type: { in: ["TIME_BAN", "BAN"] },
|
||||
type: { in: ["TIME_BAN"] },
|
||||
},
|
||||
include: {
|
||||
CreatedUser: true,
|
||||
},
|
||||
});
|
||||
if (!openPenaltys[0]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const openBans = await prisma.penalty.findMany({
|
||||
where: {
|
||||
userId: session?.user.id,
|
||||
suspended: false,
|
||||
type: { in: ["BAN"] },
|
||||
},
|
||||
include: {
|
||||
CreatedUser: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log("Open Penaltys:", session);
|
||||
|
||||
return (
|
||||
<div className="card bg-error shadow-xl mb-4 col-span-6 xl:col-span-3">
|
||||
{openPenaltys[0].type === "TIME_BAN" && (
|
||||
{openTimeban[0] && openTimeban[0].type === "TIME_BAN" && (
|
||||
<div className="card-body text-base-300">
|
||||
<h2 className="card-title text-3xl">
|
||||
<TriangleAlert />
|
||||
Aktive Strafe - <PenaltyCountdown until={openPenaltys[0].until ?? new Date()} />{" "}
|
||||
Aktive Strafe - <PenaltyCountdown until={openTimeban[0].until ?? new Date()} />{" "}
|
||||
verbleibend
|
||||
</h2>
|
||||
<p className="text-left font-bold">
|
||||
Du hast eine aktive Strafe und kannst dich deshalb nicht mit dem Netzwerk verbinden.
|
||||
</p>
|
||||
<p className="text-left">
|
||||
<span className="font-bold">Grund:</span> {openPenaltys[0].reason}
|
||||
<span className="font-bold">Grund:</span> {openTimeban[0].reason}
|
||||
</p>
|
||||
<p className="text-left">
|
||||
<span className="font-bold">Admin:</span>{" "}
|
||||
{getPublicUser(openPenaltys[0].CreatedUser).fullName}
|
||||
{getPublicUser(openTimeban[0].CreatedUser).fullName}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -54,11 +63,17 @@ export const Penalty = async () => {
|
||||
Dein Fehlverhalten war so schwerwiegend, dass du dauerhaft von VirtualAirRescue
|
||||
ausgeschlossen wurdest. Du kannst dich nicht mehr mit dem Netzwerk verbinden.
|
||||
</p>
|
||||
<p className="text-left font-bold">Grund: {openPenaltys[0].reason}</p>
|
||||
<p className="text-left">
|
||||
<span className="font-bold">Admin:</span>{" "}
|
||||
{getPublicUser(openPenaltys[0].CreatedUser).fullName}
|
||||
</p>
|
||||
{openBans[0] && (
|
||||
<>
|
||||
<p className="text-left font-bold">
|
||||
Grund: {openBans[0].reason || "Keine Begründung gefunden"}
|
||||
</p>
|
||||
<p className="text-left">
|
||||
<span className="font-bold">Admin:</span>{" "}
|
||||
{getPublicUser(openBans[0].CreatedUser).fullName || "Keine Admin gefunden"}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -18,3 +18,13 @@ export const editPenalty = async (id: number, data: Prisma.PenaltyUpdateInput) =
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
export const editPenaltys = async (
|
||||
data: Prisma.PenaltyUpdateInput,
|
||||
where: Prisma.PenaltyWhereInput,
|
||||
) => {
|
||||
return await prisma.penalty.updateMany({
|
||||
where,
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ import { useSession } from "next-auth/react";
|
||||
import { setStandardName } from "../../../../../../helper/discord";
|
||||
import { penaltyColumns } from "(app)/admin/penalty/columns";
|
||||
import { PenaltyDropdown } from "(app)/admin/user/[id]/_components/AddPenaltyDropdown";
|
||||
import { addPenalty } from "(app)/admin/penalty/actions";
|
||||
import { addPenalty, editPenalty, editPenaltys } from "(app)/admin/penalty/actions";
|
||||
|
||||
interface ProfileFormProps {
|
||||
user: User;
|
||||
@@ -357,7 +357,7 @@ export const UserPenalties = ({ user }: { user: User }) => {
|
||||
userId: user.id,
|
||||
createdUserId: createdUser.id,
|
||||
});
|
||||
await editUser(user.id, { isBanned: true, permissions: [] });
|
||||
await editUser(user.id, { isBanned: true });
|
||||
penaltyTable.current?.refresh();
|
||||
toast.success("Ban wurde hinzugefügt!");
|
||||
}}
|
||||
@@ -506,6 +506,7 @@ export const AdminForm = ({
|
||||
<Button
|
||||
onClick={async () => {
|
||||
await editUser(user.id, { isBanned: false });
|
||||
await editPenaltys({ suspended: true }, { userId: user.id, type: "BAN" });
|
||||
toast.success("Nutzer wurde entsperrt!", {
|
||||
style: {
|
||||
background: "var(--color-base-100)",
|
||||
|
||||
Reference in New Issue
Block a user