diff --git a/backend/server/src/Sandbox.ts b/backend/server/src/Sandbox.ts index db14c68..09b58a8 100644 --- a/backend/server/src/Sandbox.ts +++ b/backend/server/src/Sandbox.ts @@ -75,7 +75,13 @@ export class Sandbox { } else { console.log("Creating container", this.sandboxId) // Create a new container with a specified template and timeout - const templateTypes = ["vanillajs", "reactjs", "nextjs", "streamlit"] + const templateTypes = [ + "vanillajs", + "reactjs", + "nextjs", + "streamlit", + "php", + ] const template = templateTypes.includes(this.type) ? `gitwit-${this.type}` : `base` diff --git a/frontend/components/editor/navbar/run.tsx b/frontend/components/editor/navbar/run.tsx index c6020aa..6327bc6 100644 --- a/frontend/components/editor/navbar/run.tsx +++ b/frontend/components/editor/navbar/run.tsx @@ -34,7 +34,12 @@ export default function RunButtonModal({ } } }, [terminals, isRunning]) - + // commands to run in the terminal + const COMMANDS = { + streamlit: "./venv/bin/streamlit run main.py --server.runOnSave true", + php: "echo http://localhost:80 && npx vite", + default: "npm run dev", + } as const const handleRun = async () => { if (isRunning && lastCreatedTerminalRef.current) { await closeTerminal(lastCreatedTerminalRef.current) @@ -43,9 +48,7 @@ export default function RunButtonModal({ previewPanelRef.current?.collapse() } else if (!isRunning && terminals.length < 4) { const command = - sandboxData.type === "streamlit" - ? "./venv/bin/streamlit run main.py --server.runOnSave true" - : "npm run dev" + COMMANDS[sandboxData.type as keyof typeof COMMANDS] ?? COMMANDS.default try { // Create a new terminal with the appropriate command diff --git a/frontend/lib/data/index.ts b/frontend/lib/data/index.ts index 4720d03..bdf1a8a 100644 --- a/frontend/lib/data/index.ts +++ b/frontend/lib/data/index.ts @@ -33,4 +33,11 @@ export const projectTemplates: { description: "A faster way to build and share data apps", disabled: false, }, + { + id: "php", + name: "PHP", + description: "PHP development environment", + icon: "/project-icons/php.svg", + disabled: false + }, ] diff --git a/frontend/public/project-icons/php.svg b/frontend/public/project-icons/php.svg new file mode 100644 index 0000000..357eb48 --- /dev/null +++ b/frontend/public/project-icons/php.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file