Compare commits

...

4 Commits

Author SHA1 Message Date
af45b6196c chore: start to dev 2024-08-28 18:40:24 -04:00
a15c1f15f5 fix: types mismatch 2024-08-19 18:17:50 -07:00
f1a65106b0 feat: different run commands based on file types 2024-08-19 17:45:47 -07:00
5726cecb22 fix: remove undefined type 2024-08-18 12:37:08 -07:00
5 changed files with 16 additions and 8 deletions

View File

@ -93,7 +93,7 @@ export default function NewProjectModal({
open: boolean
setOpen: (open: boolean) => void
}) {
const [selected, setSelected] = useState<TOptions>("react")
const [selected, setSelected] = useState("react")
const [loading, setLoading] = useState(false)
const router = useRouter()

View File

@ -12,7 +12,7 @@ import { toast } from "sonner";
import { useEffect, useState } from "react";
import { CanvasRevealEffect } from "./projectCard/revealEffect";
const colors = {
const colors: { [key: string]: number[][] } = {
react: [
[71, 207, 237],
[30, 126, 148],

View File

@ -65,6 +65,7 @@ export default function Navbar({
<RunButtonModal
isRunning={isRunning}
setIsRunning={setIsRunning}
sandboxData={sandboxData}
/>
<div className="flex items-center h-full space-x-4">
<Avatars />

View File

@ -5,13 +5,16 @@ import { Button } from "@/components/ui/button";
import { useTerminal } from "@/context/TerminalContext";
import { usePreview } from "@/context/PreviewContext";
import { toast } from "sonner";
import { Sandbox } from "@/lib/types";
export default function RunButtonModal({
isRunning,
setIsRunning,
sandboxData,
}: {
isRunning: boolean;
setIsRunning: (running: boolean) => void;
sandboxData: Sandbox;
}) {
const { createNewTerminal, terminals, closeTerminal } = useTerminal();
const { setIsPreviewCollapsed, previewPanelRef } = usePreview();
@ -36,12 +39,16 @@ export default function RunButtonModal({
console.log('Opening Preview Window');
if (terminals.length < 4) {
createNewTerminal("yarn install && yarn start");
// For testing:
//createNewTerminal("echo http://localhost:3000");
if (sandboxData.type === "streamlit") {
createNewTerminal(
"pip install -r requirements.txt && streamlit run main.py --server.runOnSave true"
);
} else {
createNewTerminal("yarn install && yarn dev");
}
} else {
toast.error("You reached the maximum # of terminals.");
console.error('Maximum number of terminals reached.');
console.error("Maximum number of terminals reached.");
}
setIsPreviewCollapsed(false);

View File

@ -12,7 +12,7 @@ export type User = {
export type Sandbox = {
id: string;
name: string;
type: "react" | "node";
type: string;
visibility: "public" | "private";
createdAt: Date;
userId: string;