From c6558e6ce182e3d8b2737cbc0a95c64628afb29a Mon Sep 17 00:00:00 2001 From: LordMathis Date: Tue, 22 Jul 2025 19:02:57 +0200 Subject: [PATCH] Change InstanceCard buttons to icons --- ui/src/components/InstanceCard.tsx | 78 +++++++++++++++++++++--------- ui/src/components/InstanceList.tsx | 5 +- 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/ui/src/components/InstanceCard.tsx b/ui/src/components/InstanceCard.tsx index 081a951..ccc4d01 100644 --- a/ui/src/components/InstanceCard.tsx +++ b/ui/src/components/InstanceCard.tsx @@ -2,14 +2,16 @@ import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Instance } from '@/types/instance' -import { useInstances } from '@/hooks/useInstances' +import { Edit, FileText, Play, Square, Trash2 } from 'lucide-react' interface InstanceCardProps { instance: Instance + startInstance: (name: string) => void + stopInstance: (name: string) => void + deleteInstance: (name: string) => void } -function InstanceCard({ instance }: InstanceCardProps) { - const { startInstance, stopInstance, deleteInstance } = useInstances() +function InstanceCard({ instance, startInstance, stopInstance, deleteInstance }: InstanceCardProps) { const handleStart = () => { startInstance(instance.name) @@ -25,6 +27,16 @@ function InstanceCard({ instance }: InstanceCardProps) { } } + const handleEdit = () => { + // Logic for editing the instance (e.g., open a modal) + console.log(`Edit instance: ${instance.name}`) + } + + const handleLogs = () => { + // Logic for viewing logs (e.g., open a logs page) + console.log(`View logs for instance: ${instance.name}`) + } + return ( @@ -37,33 +49,53 @@ function InstanceCard({ instance }: InstanceCardProps) { -
- {!instance.running ? ( - - ) : ( - - )} +
+ + + + + + +
diff --git a/ui/src/components/InstanceList.tsx b/ui/src/components/InstanceList.tsx index 1fb0398..d0078a7 100644 --- a/ui/src/components/InstanceList.tsx +++ b/ui/src/components/InstanceList.tsx @@ -2,7 +2,7 @@ import { useInstances } from '@/hooks/useInstances' import InstanceCard from '@/components/InstanceCard' function InstanceList() { - const { instances, loading, error } = useInstances() + const { instances, loading, error, startInstance, stopInstance, deleteInstance } = useInstances() if (loading) { return ( @@ -46,6 +46,9 @@ function InstanceList() { ))}