blob: ab1d8719f87af9189ec06e8cba61663e79eca259 [file] [log] [blame]
gio5f2f1002025-03-20 18:38:48 +04001import { NodeAppDetails } from "./node-app";
2import { NodeGatewayHttpsDetails } from "./node-gateway-https";
gio5f2f1002025-03-20 18:38:48 +04003import { NodeVolumeDetails } from "./node-volume";
4import { NodePostgreSQLDetails } from "./node-postgresql";
5import { NodeMongoDBDetails } from "./node-mongodb";
6import { NodeGithubDetails } from "./node-github";
7import { NodeGatewayTCPDetails } from "./node-gateway-tcp";
gio3fb133d2025-06-13 07:20:24 +00008import { NodeDetailsProps } from "@/lib/types";
gio5fa66962025-06-13 09:30:40 +00009import { cn } from "@/lib/utils";
gio5f2f1002025-03-20 18:38:48 +040010
gio5fa66962025-06-13 09:30:40 +000011export function NodeDetails(props: NodeDetailsProps & { className?: string }) {
12 const { className, ...rest } = props;
giofcefd7c2025-05-13 08:01:07 +000013 return (
gio5fa66962025-06-13 09:30:40 +000014 <div className={cn("px-1 flex flex-col gap-2", className)}>
15 <NodeDetailsImpl {...rest} />
giofcefd7c2025-05-13 08:01:07 +000016 </div>
17 );
18}
19
gio3fb133d2025-06-13 07:20:24 +000020function NodeDetailsImpl(props: NodeDetailsProps) {
21 const { node, ...rest } = props;
gio08acd3a2025-06-12 12:15:30 +000022 switch (node.type) {
giod0026612025-05-08 13:00:36 +000023 case "app":
gio3fb133d2025-06-13 07:20:24 +000024 return <NodeAppDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000025 case "gateway-https":
gio3fb133d2025-06-13 07:20:24 +000026 return <NodeGatewayHttpsDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000027 case "gateway-tcp":
gio3fb133d2025-06-13 07:20:24 +000028 return <NodeGatewayTCPDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000029 case "volume":
gio3fb133d2025-06-13 07:20:24 +000030 return <NodeVolumeDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000031 case "postgresql":
gio3fb133d2025-06-13 07:20:24 +000032 return <NodePostgreSQLDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000033 case "mongodb":
gio3fb133d2025-06-13 07:20:24 +000034 return <NodeMongoDBDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000035 case "github":
gio3fb133d2025-06-13 07:20:24 +000036 return <NodeGithubDetails {...rest} node={node} />;
giod0026612025-05-08 13:00:36 +000037 default:
38 return <>nooo</>;
39 }
40}