|
| 1 | +import { CardContent } from "@/components/ui/card"; |
| 2 | +import { Separator } from "@/components/ui/separator"; |
| 3 | +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; |
| 4 | +import { Service } from "@elixir-cloud/cloud-registry/providers"; |
| 5 | +import { Building2, Clock, Settings, Tag } from "lucide-react"; |
| 6 | + |
| 7 | +type Props = { |
| 8 | + serviceInfo: Service; |
| 9 | +}; |
| 10 | + |
| 11 | +function ServiceInfoCardContent({ serviceInfo }: Props) { |
| 12 | + if (serviceInfo === undefined) return null; |
| 13 | + |
| 14 | + return ( |
| 15 | + <CardContent className="space-y-6"> |
| 16 | + <p className="text-sm text-slate-600 leading-relaxed">{serviceInfo.description}</p> |
| 17 | + |
| 18 | + <div className="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm"> |
| 19 | + <div className="space-y-2"> |
| 20 | + <div className="flex items-center gap-2 text-slate-500"> |
| 21 | + <Building2 className="w-4 h-4" /> |
| 22 | + <span className="font-medium">Organization</span> |
| 23 | + </div> |
| 24 | + <Tooltip> |
| 25 | + <TooltipTrigger asChild> |
| 26 | + <a |
| 27 | + href={serviceInfo.organization.url} |
| 28 | + className="text-blue-600 hover:underline block pl-6 max-w-max" |
| 29 | + > |
| 30 | + {serviceInfo.organization.name} |
| 31 | + </a> |
| 32 | + </TooltipTrigger> |
| 33 | + <TooltipContent>{serviceInfo.organization.url}</TooltipContent> |
| 34 | + </Tooltip> |
| 35 | + </div> |
| 36 | + |
| 37 | + <div className="space-y-2"> |
| 38 | + <div className="flex items-center gap-2 text-slate-500"> |
| 39 | + <Tag className="w-4 h-4" /> |
| 40 | + <span className="font-medium">Build Version</span> |
| 41 | + </div> |
| 42 | + <code className="text-xs bg-slate-100 px-2 py-1 rounded ml-6 text-slate-800"> |
| 43 | + {serviceInfo.version} |
| 44 | + </code> |
| 45 | + </div> |
| 46 | + |
| 47 | + <Separator className="md:col-span-2" /> |
| 48 | + |
| 49 | + <div className="space-y-3"> |
| 50 | + <div className="flex items-center gap-2 text-slate-500 mb-1"> |
| 51 | + <Settings className="w-4 h-4" /> |
| 52 | + <span className="font-medium">Registry Type</span> |
| 53 | + </div> |
| 54 | + <ul className="pl-6 space-y-1 text-xs"> |
| 55 | + <li> |
| 56 | + <span className="text-slate-400">Artifact:</span>{" "} |
| 57 | + {serviceInfo.type.artifact} |
| 58 | + </li> |
| 59 | + <li> |
| 60 | + <span className="text-slate-400">Group:</span> {serviceInfo.type.group} |
| 61 | + </li> |
| 62 | + <li> |
| 63 | + <span className="text-slate-400">Spec Version:</span> |
| 64 | + {serviceInfo.type.version} |
| 65 | + </li> |
| 66 | + </ul> |
| 67 | + </div> |
| 68 | + |
| 69 | + <div className="space-y-3"> |
| 70 | + <div className="flex items-center gap-2 text-slate-500 mb-1"> |
| 71 | + <Clock className="w-4 h-4" /> |
| 72 | + <span className="font-medium">Lifecycle</span> |
| 73 | + </div> |
| 74 | + <div className="pl-6 text-xs text-slate-600 space-y-0.5"> |
| 75 | + <p>Created At: {new Date(serviceInfo.createdAt).toLocaleString()}</p> |
| 76 | + <p>Updated At: {new Date(serviceInfo.updatedAt).toLocaleString()}</p> |
| 77 | + <p>Environment: {serviceInfo.environment.toUpperCase()}</p> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + </CardContent> |
| 82 | + ); |
| 83 | +} |
| 84 | + |
| 85 | +export default ServiceInfoCardContent; |
0 commit comments