import { useState } from 'react';
import { Copy, Check, Server, Wrench } from 'lucide-react';
import { useGlobal } from 'hooks/useGlobal';
import { useResources, type Resource } from '@/state/useResources';
const CopyCommand = ({ command }: { command: string }) => {
const [copied, setCopied] = useState(false);
const copy = () => {
navigator.clipboard.writeText(command);
setCopied(true);
setTimeout(() => setCopied(false), 1500);
};
return (
{command}
);
};
const CommandRow = ({ label, command }: { label: string; command: string }) => (
{label}:
);
export const Resources = () => {
const { resources } = useResources();
const [selectedId] = useGlobal('RESOURCE_SELECTED', null);
const resource = resources?.find((r: Resource) => r.id === selectedId);
if (!resource) {
return (
Select a resource to view details
);
}
return (
{resource.port ? (
) : (
)}
{resource.name}
{resource.subtitle}
{resource.type}
{resource.port && (
:{resource.port}
)}
{resource.installed ? (
{resource.version ?? 'Running'}
) : (
Not installed
)}
{resource.description}
{resource.installCommand && }
{resource.uninstallCommand && }
{resource.manageCommand && }
{resource.verifyCommand && }
{resource.updateCommand && }
);
};