Merge branch 'refs/heads/main' into production
This commit is contained in:
commit
171a9ce3c6
@ -65,6 +65,7 @@ export default function Navbar({
|
|||||||
<RunButtonModal
|
<RunButtonModal
|
||||||
isRunning={isRunning}
|
isRunning={isRunning}
|
||||||
setIsRunning={setIsRunning}
|
setIsRunning={setIsRunning}
|
||||||
|
sandboxData={sandboxData}
|
||||||
/>
|
/>
|
||||||
<div className="flex items-center h-full space-x-4">
|
<div className="flex items-center h-full space-x-4">
|
||||||
<Avatars />
|
<Avatars />
|
||||||
|
@ -5,16 +5,19 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { useTerminal } from "@/context/TerminalContext";
|
import { useTerminal } from "@/context/TerminalContext";
|
||||||
import { usePreview } from "@/context/PreviewContext";
|
import { usePreview } from "@/context/PreviewContext";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import { Sandbox } from "@/lib/types";
|
||||||
|
|
||||||
export default function RunButtonModal({
|
export default function RunButtonModal({
|
||||||
isRunning,
|
isRunning,
|
||||||
setIsRunning,
|
setIsRunning,
|
||||||
|
sandboxData,
|
||||||
}: {
|
}: {
|
||||||
isRunning: boolean;
|
isRunning: boolean;
|
||||||
setIsRunning: (running: boolean) => void;
|
setIsRunning: (running: boolean) => void;
|
||||||
|
sandboxData: Sandbox;
|
||||||
}) {
|
}) {
|
||||||
const { createNewTerminal, terminals, closeTerminal } = useTerminal();
|
const { createNewTerminal, terminals, closeTerminal } = useTerminal();
|
||||||
const { setIsPreviewCollapsed, previewPanelRef} = usePreview();
|
const { setIsPreviewCollapsed, previewPanelRef } = usePreview();
|
||||||
|
|
||||||
const handleRun = () => {
|
const handleRun = () => {
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
@ -36,12 +39,16 @@ export default function RunButtonModal({
|
|||||||
console.log('Opening Preview Window');
|
console.log('Opening Preview Window');
|
||||||
|
|
||||||
if (terminals.length < 4) {
|
if (terminals.length < 4) {
|
||||||
createNewTerminal("yarn install && yarn start");
|
if (sandboxData.type === "streamlit") {
|
||||||
// For testing:
|
createNewTerminal(
|
||||||
//createNewTerminal("echo http://localhost:3000");
|
"pip install -r requirements.txt && streamlit run main.py --server.runOnSave true"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
createNewTerminal("yarn install && yarn start");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
toast.error("You reached the maximum # of terminals.");
|
toast.error("You reached the maximum # of terminals.");
|
||||||
console.error('Maximum number of terminals reached.');
|
console.error("Maximum number of terminals reached.");
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsPreviewCollapsed(false);
|
setIsPreviewCollapsed(false);
|
||||||
|
@ -12,7 +12,7 @@ export type User = {
|
|||||||
export type Sandbox = {
|
export type Sandbox = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: "react" | "node";
|
type: string;
|
||||||
visibility: "public" | "private";
|
visibility: "public" | "private";
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
userId: string;
|
userId: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user