fix: build issues

This commit is contained in:
Kentai Radiquum 2025-05-06 00:18:48 +05:00
parent d2da453808
commit 237ce9879d
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
5 changed files with 15 additions and 7 deletions

View file

@ -3,6 +3,7 @@
import { Geist, Geist_Mono } from "next/font/google"; import { Geist, Geist_Mono } from "next/font/google";
import { Menu } from "./components/Sidebar"; import { Menu } from "./components/Sidebar";
import { Bounce, ToastContainer } from "react-toastify"; import { Bounce, ToastContainer } from "react-toastify";
import { Suspense } from "react";
const geistSans = Geist({ const geistSans = Geist({
variable: "--font-geist-sans", variable: "--font-geist-sans",
@ -24,7 +25,9 @@ export const App = ({ children }: APPProps) => {
className={`${geistSans.variable} ${geistMono.variable} antialiased flex h-screen overflow-hidden`} className={`${geistSans.variable} ${geistMono.variable} antialiased flex h-screen overflow-hidden`}
> >
<Menu></Menu> <Menu></Menu>
<div className="p-2 overflow-auto w-full">{children}</div> <div className="p-2 overflow-auto w-full">
<Suspense>{children}</Suspense>
</div>
<ToastContainer <ToastContainer
position="bottom-right" position="bottom-right"
autoClose={5000} autoClose={5000}

View file

@ -32,7 +32,7 @@ export const ModTable = () => {
<Checkbox /> <Checkbox />
</TableCell> </TableCell>
<TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white"> <TableCell className="whitespace-nowrap font-medium text-gray-900 dark:text-white">
Apple MacBook Pro 17" Apple MacBook Pro 17
</TableCell> </TableCell>
<TableCell>Sliver</TableCell> <TableCell>Sliver</TableCell>
<TableCell>Laptop</TableCell> <TableCell>Laptop</TableCell>

View file

@ -32,7 +32,7 @@ export const Menu = () => {
packsData.map((pack) => { packsData.map((pack) => {
return ( return (
<SidebarItem <SidebarItem
href={`/pack/?id=${pack._id}`} href={`/pack?id=${pack._id}`}
key={pack._id} key={pack._id}
theme={{ theme={{
content: { content: {

View file

@ -5,7 +5,6 @@ import { Label, TextInput, Select } from "flowbite-react";
import { useState } from "react"; import { useState } from "react";
import { HiUser, HiAnnotation } from "react-icons/hi"; import { HiUser, HiAnnotation } from "react-icons/hi";
import { Button } from "flowbite-react"; import { Button } from "flowbite-react";
import { useRouter } from "next/navigation";
import mc from "../../../api/mc_version.json"; import mc from "../../../api/mc_version.json";
import { PACKS_ENDPOINT, PACK_ENDPOINT } from "@/api/ENDPOINTS"; import { PACKS_ENDPOINT, PACK_ENDPOINT } from "@/api/ENDPOINTS";
@ -13,7 +12,6 @@ import { toast } from "react-toastify";
const mcr = mc.reverse(); const mcr = mc.reverse();
export default function PackNew() { export default function PackNew() {
const router = useRouter();
const [image, setImage] = useState<null | string>(null); const [image, setImage] = useState<null | string>(null);
const [imageMime, setImageMime] = useState<null | string>(null); const [imageMime, setImageMime] = useState<null | string>(null);
const [packInfo, setPackInfo] = useState({ const [packInfo, setPackInfo] = useState({
@ -96,7 +94,10 @@ export default function PackNew() {
closeOnClick: true, closeOnClick: true,
draggable: true, draggable: true,
}); });
router.push(`/pack/?id=${data.id}`); const ur = new URL(window.location.href);
ur.searchParams.set("id", data.id);
ur.pathname = "/pack";
window.location.href = ur.href;
} }
_submit(); _submit();

View file

@ -8,6 +8,7 @@ from io import BytesIO
import base64 import base64
import json import json
@apiPack.route("/<id>", methods=["GET"]) @apiPack.route("/<id>", methods=["GET"])
def getPack(id): def getPack(id):
if not os.path.exists(f"{PACKS_FOLDER}/{id}/packfile.json"): if not os.path.exists(f"{PACKS_FOLDER}/{id}/packfile.json"):
@ -21,12 +22,15 @@ def getPack(id):
return jsonify(pack) return jsonify(pack)
@apiPack.route("/<id>/image", methods=["GET"]) @apiPack.route("/<id>/image", methods=["GET"])
def getPackImage(id): def getPackImage(id):
if not os.path.exists(f"{PACKS_FOLDER}/{id}/packicon.png"): if not os.path.exists(f"{PACKS_FOLDER}/{id}/packicon.png"):
return redirect(url_for("static", filename="defaulticon.png")) return redirect(url_for("static", filename="defaulticon.png"))
return send_file(f"{PACKS_FOLDER}/{id}/packicon.png") with open(f"{PACKS_FOLDER}/{id}/packicon.png", mode="rb") as fp:
f = BytesIO(fp.read())
return send_file(f, mimetype="image/png")
@apiPack.route("/<id>/image/edit", methods=["POST"]) @apiPack.route("/<id>/image/edit", methods=["POST"])