diff --git a/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx b/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx index 40cf217d..4b6b358b 100644 --- a/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx +++ b/src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx @@ -110,8 +110,6 @@ import { } from "@app/components/PathMatchRenameModal"; import { Badge } from "@app/components/ui/badge"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@app/components/ui/tooltip"; -import { TargetModal } from "@app/components/TargetModal"; -import { TargetDisplay } from "@app/components/TargetDisplay"; const addTargetSchema = z .object({ diff --git a/src/app/[orgId]/settings/resources/create/page.tsx b/src/app/[orgId]/settings/resources/create/page.tsx index 644141c7..10828275 100644 --- a/src/app/[orgId]/settings/resources/create/page.tsx +++ b/src/app/[orgId]/settings/resources/create/page.tsx @@ -94,8 +94,6 @@ import { DomainRow } from "../../../../../components/DomainsTable"; import { finalizeSubdomainSanitize } from "@app/lib/subdomain-utils"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@app/components/ui/tooltip"; import { PathMatchDisplay, PathMatchModal, PathRewriteDisplay, PathRewriteModal } from "@app/components/PathMatchRenameModal"; -import { TargetModal } from "@app/components/TargetModal"; -import { TargetDisplay } from "@app/components/TargetDisplay"; import { Badge } from "@app/components/ui/badge"; diff --git a/src/components/TargetDisplay.tsx b/src/components/TargetDisplay.tsx deleted file mode 100644 index 5ca0a9a7..00000000 --- a/src/components/TargetDisplay.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Globe, Hash, Shield } from "lucide-react"; - -interface TargetDisplayProps { - value: { - method?: string | null; - ip?: string; - port?: number; - }; - showMethod?: boolean; -} - -export function TargetDisplay({ value, showMethod = true }: TargetDisplayProps) { - const { method, ip, port } = value; - - if (!ip && !port && !method) { - return Not configured; - } - - - - return ( -
- {showMethod && method && ( - - {method === "https" && } - - {method}:// - - - )} - {ip && ( - - {ip} - {port && :} - - )} - {port && ( - - {port} - - )} -
- ); -} diff --git a/src/components/TargetModal.tsx b/src/components/TargetModal.tsx deleted file mode 100644 index 8a5ec336..00000000 --- a/src/components/TargetModal.tsx +++ /dev/null @@ -1,144 +0,0 @@ - -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; -import { useState } from "react"; - -interface TargetConfig { - method?: string | null; - ip?: string; - port?: number; -} - -interface TargetModalProps { - value: TargetConfig; - onChange: (config: TargetConfig) => void; - trigger: React.ReactNode; - showMethod?: boolean; -} - -export function TargetModal({ - value, - onChange, - trigger, - showMethod = true -}: TargetModalProps) { - const [open, setOpen] = useState(false); - const [config, setConfig] = useState(value); - - const handleSave = () => { - onChange(config); - setOpen(false); - }; - - const parseHostTarget = (input: string) => { - const protocolMatch = input.match(/^(https?|h2c):\/\//); - const protocol = protocolMatch ? protocolMatch[1] : null; - const withoutProtocol = input.replace(/^(https?|h2c):\/\//, ''); - - const portMatch = withoutProtocol.match(/:(\d+)(?:\/|$)/); - const port = portMatch ? parseInt(portMatch[1], 10) : null; - const host = withoutProtocol.replace(/:\d+(?:\/|$)/, '').replace(/\/$/, ''); - - return { protocol, host, port }; - }; - - const handleHostChange = (input: string) => { - const trimmed = input.trim(); - const hasProtocol = /^(https?|h2c):\/\//.test(trimmed); - const hasPort = /:\d+(?:\/|$)/.test(trimmed); - - if (hasProtocol || hasPort) { - const parsed = parseHostTarget(trimmed); - setConfig({ - ...config, - ...(hasProtocol && parsed.protocol ? { method: parsed.protocol } : {}), - ip: parsed.host, - ...(hasPort && parsed.port ? { port: parsed.port } : {}) - }); - } else { - setConfig({ ...config, ip: trimmed }); - } - }; - - return ( - - {trigger} - - - Configure Target - -
- {showMethod && ( -
- - -
- )} -
- - setConfig({ ...config, ip: e.target.value })} - onBlur={(e) => handleHostChange(e.target.value)} - /> -

- You can also paste: http://example.com:8080 -

-
-
- - - setConfig({ - ...config, - port: parseInt(e.target.value, 10) || undefined - }) - } - /> -
-
-
- - -
-
-
- ); -} \ No newline at end of file