From 2dfff9f9d6d015a9badc5c5c60781a73a9e3d5f3 Mon Sep 17 00:00:00 2001 From: przeq piciel Date: Tue, 10 Sep 2024 16:23:09 +0000 Subject: [PATCH] x --- app/app/files/edit/page.tsx | 22 ++++++-- app/app/files/page.tsx | 4 +- app/app/layout.tsx | 5 +- app/components/BreadCrumbs/index.tsx | 16 ++++++ app/components/FilesEditor/index.tsx | 12 ++++- app/components/WebConsole/index.tsx | 80 ++++++++++++++-------------- 6 files changed, 88 insertions(+), 51 deletions(-) create mode 100644 app/components/BreadCrumbs/index.tsx diff --git a/app/app/files/edit/page.tsx b/app/app/files/edit/page.tsx index 8105e95..287ed7e 100644 --- a/app/app/files/edit/page.tsx +++ b/app/app/files/edit/page.tsx @@ -1,14 +1,30 @@ "use client"; -import React from "react"; +import React, { useCallback } from "react"; import { useSearchParams } from "next/navigation"; +import TextEditor from "@/components/TextEditor"; +import BreadCrumbs from "@/components/FilesEditor/BreadCrumbs"; function Page() { const searchParams = useSearchParams(); - const serverId = searchParams.get("serverid"); + const serverId = searchParams.get("serverid") || ""; + const path = searchParams.get("path") || ""; - return
{serverId}
; + const changeDirectory = useCallback((path: string) => { + console.log("changeDirectory", path); + }, []); + + return ( + <> + + ; + + ); } export default Page; diff --git a/app/app/files/page.tsx b/app/app/files/page.tsx index 22ecef4..86cd3da 100644 --- a/app/app/files/page.tsx +++ b/app/app/files/page.tsx @@ -3,9 +3,7 @@ import FilesEdit from "@/components/FilesEditor"; export default function Files() { return ( <> -
- -
+ ); } diff --git a/app/app/layout.tsx b/app/app/layout.tsx index 17f6b5e..170f85f 100644 --- a/app/app/layout.tsx +++ b/app/app/layout.tsx @@ -1,7 +1,6 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; import "./globals.css"; -import { Console } from "console"; import ConsoleNavigation from "@/components/ConsoleNavigation"; const inter = Inter({ subsets: ["latin"] }); @@ -24,7 +23,9 @@ export default function RootLayout({
- {children} +
+ {children} +
diff --git a/app/components/BreadCrumbs/index.tsx b/app/components/BreadCrumbs/index.tsx new file mode 100644 index 0000000..aa633b4 --- /dev/null +++ b/app/components/BreadCrumbs/index.tsx @@ -0,0 +1,16 @@ +"use client"; + +import React, { Children } from "react"; +import { useParams } from "next/navigation"; + +interface Props { + children: React.ReactNode; +} + +const BreadCrumbs = ({ children }: Props) => { + const { serverid, path } = useParams(); + + return
{children}
; +}; + +export default BreadCrumbs; diff --git a/app/components/FilesEditor/index.tsx b/app/components/FilesEditor/index.tsx index 35758d9..340a66e 100644 --- a/app/components/FilesEditor/index.tsx +++ b/app/components/FilesEditor/index.tsx @@ -10,6 +10,7 @@ import RenamePopup from "./ContextMenu/rename"; import Pterodactyl from "@/components/Pterodactyl"; import BreadCrumbs from "./BreadCrumbs"; import { useSearchParams } from "next/navigation"; +import Link from "next/link"; interface FileAttributes { name: string; @@ -58,6 +59,7 @@ const Index = () => { const [path, setPath] = useState("/"); const urlParams = useSearchParams(); const serverId = urlParams.get("serverid"); + const pathParam = urlParams.get("path"); const setCredentials = useCallback(() => { setApiKey("ptlc_N77A2hEczFmSwGXm4cEXh4Gw3ZP0Ygr5NaBkGlE7pjU"); @@ -116,7 +118,11 @@ const Index = () => { await setCredentials(); if (apiKey && serverId) { const pteroInstance = new Pterodactyl(serverId, apiKey); - pteroInstance.helpers.setWorkingDirectory(path); + if (!pathParam) { + pteroInstance.helpers.setWorkingDirectory(path); + } else { + pteroInstance.helpers.setWorkingDirectory(pathParam); + } setPtero(pteroInstance); await fetchFiles(pteroInstance); } @@ -166,7 +172,9 @@ const Index = () => {
{file.attributes.is_file ? ( - {file.attributes.name} + + {file.attributes.name} + ) : ( diff --git a/app/components/WebConsole/index.tsx b/app/components/WebConsole/index.tsx index 4dfd7a4..d12cb78 100644 --- a/app/components/WebConsole/index.tsx +++ b/app/components/WebConsole/index.tsx @@ -156,54 +156,52 @@ const Console = () => { return ( <> -
-
-
-
- - -
-
- -
+
+
+
+ +
+
+ +
+
-
-
-
-