feat: add PHP template
This commit is contained in:
parent
a293d98a21
commit
4db378b5f1
@ -75,7 +75,13 @@ export class Sandbox {
|
|||||||
} else {
|
} else {
|
||||||
console.log("Creating container", this.sandboxId)
|
console.log("Creating container", this.sandboxId)
|
||||||
// Create a new container with a specified template and timeout
|
// 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)
|
const template = templateTypes.includes(this.type)
|
||||||
? `gitwit-${this.type}`
|
? `gitwit-${this.type}`
|
||||||
: `base`
|
: `base`
|
||||||
|
@ -34,7 +34,12 @@ export default function RunButtonModal({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [terminals, isRunning])
|
}, [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 () => {
|
const handleRun = async () => {
|
||||||
if (isRunning && lastCreatedTerminalRef.current) {
|
if (isRunning && lastCreatedTerminalRef.current) {
|
||||||
await closeTerminal(lastCreatedTerminalRef.current)
|
await closeTerminal(lastCreatedTerminalRef.current)
|
||||||
@ -43,9 +48,7 @@ export default function RunButtonModal({
|
|||||||
previewPanelRef.current?.collapse()
|
previewPanelRef.current?.collapse()
|
||||||
} else if (!isRunning && terminals.length < 4) {
|
} else if (!isRunning && terminals.length < 4) {
|
||||||
const command =
|
const command =
|
||||||
sandboxData.type === "streamlit"
|
COMMANDS[sandboxData.type as keyof typeof COMMANDS] ?? COMMANDS.default
|
||||||
? "./venv/bin/streamlit run main.py --server.runOnSave true"
|
|
||||||
: "npm run dev"
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create a new terminal with the appropriate command
|
// Create a new terminal with the appropriate command
|
||||||
|
@ -33,4 +33,11 @@ export const projectTemplates: {
|
|||||||
description: "A faster way to build and share data apps",
|
description: "A faster way to build and share data apps",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "php",
|
||||||
|
name: "PHP",
|
||||||
|
description: "PHP development environment",
|
||||||
|
icon: "/project-icons/php.svg",
|
||||||
|
disabled: false
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
7
frontend/public/project-icons/php.svg
Normal file
7
frontend/public/project-icons/php.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="800px" height="800px" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="16" cy="16" r="14" fill="#8892BF"/>
|
||||||
|
<path d="M14.4392 10H16.1192L15.6444 12.5242H17.154C17.9819 12.5419 18.5986 12.7269 19.0045 13.0793C19.4184 13.4316 19.5402 14.1014 19.3698 15.0881L18.5541 19.4889H16.8497L17.6288 15.2863C17.7099 14.8457 17.6856 14.533 17.5558 14.348C17.426 14.163 17.146 14.0705 16.7158 14.0705L15.3644 14.0573L14.3661 19.4889H12.6861L14.4392 10Z" fill="white"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.74092 12.5243H10.0036C10.9612 12.533 11.6552 12.8327 12.0854 13.4229C12.5156 14.0132 12.6576 14.8193 12.5115 15.8414C12.4548 16.3085 12.3289 16.7665 12.1341 17.2159C11.9474 17.6652 11.6878 18.0704 11.355 18.4317C10.9491 18.8898 10.5149 19.1805 10.0523 19.304C9.58969 19.4274 9.11076 19.489 8.61575 19.489H7.15484L6.69222 22H5L6.74092 12.5243ZM7.43485 17.9956L8.16287 14.0441H8.40879C8.49815 14.0441 8.5914 14.0396 8.6888 14.0309C9.33817 14.0221 9.87774 14.0882 10.308 14.2291C10.7462 14.37 10.8923 14.9031 10.7462 15.8282C10.5678 16.9296 10.2186 17.5727 9.69926 17.7577C9.1799 17.934 8.53053 18.0176 7.75138 18.0088H7.58094C7.53224 18.0088 7.48355 18.0043 7.43485 17.9956Z" fill="white"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.4365 12.5243H21.1738L19.4329 22H21.1251L21.5878 19.489H23.0487C23.5437 19.489 24.0226 19.4274 24.4852 19.304C24.9479 19.1805 25.382 18.8898 25.7879 18.4317C26.1207 18.0704 26.3803 17.6652 26.567 17.2159C26.7618 16.7665 26.8877 16.3085 26.9444 15.8414C27.0905 14.8193 26.9486 14.0132 26.5183 13.4229C26.0881 12.8327 25.3942 12.533 24.4365 12.5243ZM22.5958 14.0441L21.8678 17.9956C21.9165 18.0043 21.9652 18.0088 22.0139 18.0088H22.1843C22.9635 18.0176 23.6128 17.934 24.1322 17.7577C24.6515 17.5727 25.0007 16.9296 25.1792 15.8282C25.3253 14.9031 25.1792 14.37 24.7409 14.2291C24.3107 14.0882 23.7711 14.0221 23.1217 14.0309C23.0243 14.0396 22.9311 14.0441 22.8417 14.0441H22.5958Z" fill="white"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
x
Reference in New Issue
Block a user