Deploy to Dokku when the deploy button is clicked.

This commit is contained in:
James Murdza
2024-08-09 16:43:25 -07:00
parent d4c65ad1a3
commit 86db64a83b
3 changed files with 19 additions and 5 deletions

View File

@ -2,26 +2,30 @@
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { useTerminal } from "@/context/TerminalContext";
import { Play, Pause } from "lucide-react";
export default function DeployButtonModal() {
const { deploy } = useTerminal();
const [isDeploying, setIsDeploying] = useState(false);
const handleDeploy = () => {
if (isDeploying) {
console.log("Stopping deployment...");
} else {
console.log("Starting deployment...");
setIsDeploying(true);
deploy(() => {
setIsDeploying(false);
});
}
setIsDeploying(!isDeploying);
};
return (
<>
<Button variant="outline" onClick={handleDeploy}>
{isDeploying ? <Pause className="w-4 h-4 mr-2" /> : <Play className="w-4 h-4 mr-2" />}
{isDeploying ? "Deployed" : "Deploy"}
{isDeploying ? "Deploying" : "Deploy"}
</Button>
</>
);