'use client' import { useState } from 'react' import { ServerPack } from '@/utils/yamlParser' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog' export default function PackCard({ pack }: { pack: ServerPack }) { const [composeYaml, setComposeYaml] = useState('') const [startCommand, setStartCommand] = useState('') const generateComposeYaml = () => { const yaml = ` version: '3' services: minecraft: image: ${pack.dockerImage}:${pack.imageVersion} ports: - 25565:25565 environment: EULA: "TRUE" TYPE: ${pack.core} VERSION: ${pack.minecraftVersion} JAVA_VERSION: ${pack.javaVersion} volumes: - ./data:/data restart: unless-stopped ` setComposeYaml(yaml.trim()) } const generateStartCommand = () => { const command = ` docker run -d \\ --name minecraft-server \\ -p 25565:25565 \\ -e EULA=TRUE \\ -e TYPE=${pack.core} \\ -e VERSION=${pack.minecraftVersion} \\ -e JAVA_VERSION=${pack.javaVersion} \\ -v $(pwd)/data:/data \\ ${pack.dockerImage}:${pack.imageVersion} ` setStartCommand(command.trim()) } return (
{pack.description}
{value}