2024-07-23 17:30:49 -04:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { useState } from "react";
|
|
|
|
import { Button } from "@/components/ui/button";
|
2024-08-09 16:43:25 -07:00
|
|
|
import { useTerminal } from "@/context/TerminalContext";
|
2024-07-23 17:30:49 -04:00
|
|
|
import { Play, Pause } from "lucide-react";
|
|
|
|
|
|
|
|
export default function DeployButtonModal() {
|
2024-08-09 16:43:25 -07:00
|
|
|
const { deploy } = useTerminal();
|
2024-07-23 17:30:49 -04:00
|
|
|
const [isDeploying, setIsDeploying] = useState(false);
|
|
|
|
|
|
|
|
const handleDeploy = () => {
|
|
|
|
if (isDeploying) {
|
|
|
|
console.log("Stopping deployment...");
|
|
|
|
} else {
|
|
|
|
console.log("Starting deployment...");
|
2024-08-09 16:43:25 -07:00
|
|
|
setIsDeploying(true);
|
|
|
|
deploy(() => {
|
|
|
|
setIsDeploying(false);
|
|
|
|
});
|
2024-07-23 17:30:49 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button variant="outline" onClick={handleDeploy}>
|
|
|
|
{isDeploying ? <Pause className="w-4 h-4 mr-2" /> : <Play className="w-4 h-4 mr-2" />}
|
2024-08-09 16:43:25 -07:00
|
|
|
{isDeploying ? "Deploying" : "Deploy"}
|
2024-07-23 17:30:49 -04:00
|
|
|
</Button>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|