diff --git a/app/app/files/edit/page.tsx b/app/app/files/edit/page.tsx index 7cc26f0..2d9f377 100644 --- a/app/app/files/edit/page.tsx +++ b/app/app/files/edit/page.tsx @@ -13,61 +13,67 @@ function Page() { const searchParams = useSearchParams(); const serverId = searchParams.get("serverid") || ""; const path = searchParams.get("path") || ""; - const [code, setCode] = useState("dupa"); - const pterodactyl = new Pterodactyl(); + const [code, setCode] = useState(""); - useEffect(() => { - const startupApp = async () => { - const panelApp = new Panel(); + useEffect( + function () { + async function startupApp() { + const panelApp = new Panel(); + const pterodactyl = new Pterodactyl(); - const credentials = await panelApp.getCredentials(); - pterodactyl.setApiKey(credentials.api_key); - pterodactyl.setServerId(serverId); - setCode(await pterodactyl.files.getContent(path)); - }; + const credentials = await panelApp.getCredentials(); + pterodactyl.setApiKey(credentials.api_key); + pterodactyl.setServerId(serverId); + setCode(await pterodactyl.files.getContent(path)); + } - if (serverId && path) { - startupApp(); - } - }, [serverId, path]); + if (serverId && path) { + startupApp(); + } + }, + [serverId, path] + ); return ( <> - -
  • -
    - -
    - {serverId} -
  • -
  • - +
    + +
  • - +
    - / -
    -
  • - {path - .split("/") - .filter((p) => p !== "") - .map((element, index) => { - const tmp_path = path - .split("/") - .slice(0, index + 2) - .join("/"); - return ( -
  • - -
    - -
    - {element} -
    -
  • - ); - })} -
    + {serverId} + +
  • + +
    + +
    + / +
    +
  • + {path + .split("/") + .filter((p) => p !== "") + .map((element, index) => { + const tmp_path = path + .split("/") + .slice(0, index + 2) + .join("/"); + return ( +
  • + +
    + +
    + {element} +
    +
  • + ); + })} + + + ); diff --git a/app/components/FilesEditor/index.tsx b/app/components/FilesEditor/index.tsx index ddc1954..061a17c 100644 --- a/app/components/FilesEditor/index.tsx +++ b/app/components/FilesEditor/index.tsx @@ -100,17 +100,6 @@ const Index = () => { setContextMenu(initialContextMenuState); }, []); - const changeDirectory = useCallback( - (newPath: string) => { - if (pterodactyl) { - pterodactyl.helpers.setWorkingDirectory(newPath); - fetchFiles(); - // setPath(newPath); - } - }, - [pterodactyl, fetchFiles] - ); - useEffect(() => { if (!apiKey || !serverId) return; // Upewniamy się, że mamy apiKey i serverId @@ -142,7 +131,7 @@ const Index = () => { )} {serverId && ( -
    +