diff --git a/messages/en-US.json b/messages/en-US.json index 207485ea9..a9fb43e5f 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -4536,12 +4536,14 @@ "selectedRedirectDomain": "Selected Domain", "selectedRedirectResource": "Selected Resource", "redirectResourceNoDomain": "This resource has no domain", - "redirectSourceSectionDescription": "Choose the domain or resource this redirect applies to", + "redirectSourceSectionDescription": "Choose the domain or resource, and which incoming paths, this redirect matches", + "redirectDestinationSectionDescription": "Where matching requests are sent, and how the path changes", "redirectSettingsDescription": "Set which paths to match and where to send them", "redirectEnabledDescription": "Turn the redirect off to stop forwarding requests without deleting it", - "redirectAttachedToDescription": "Choose whether this redirect applies to a whole domain or a single resource", "redirectAttachDomain": "Domain", + "redirectAttachDomainDescription": "Apply this redirect to a whole domain", "redirectAttachResource": "Resource", + "redirectAttachResourceDescription": "Apply this redirect to a single resource", "redirectDomainRequired": "Select a domain to attach this redirect to", "redirectResourceRequired": "Select a resource to attach this redirect to", "redirectPermanent": "Permanent Redirect", diff --git a/src/components/RedirectForm.tsx b/src/components/RedirectForm.tsx index c29f86ec2..02f1007b0 100644 --- a/src/components/RedirectForm.tsx +++ b/src/components/RedirectForm.tsx @@ -58,7 +58,7 @@ import { isValidRegex } from "@server/routers/redirect/validation"; import type { AxiosResponse } from "axios"; -import { InfoIcon, Plus } from "lucide-react"; +import { ChevronDown, ChevronUp, InfoIcon, Plus } from "lucide-react"; import { useTranslations } from "next-intl"; import Link from "next/link"; import { useRouter } from "next/navigation"; @@ -111,6 +111,7 @@ export default function RedirectForm({ .join(".") : null ); + const [showAdvancedSettings, setShowAdvancedSettings] = useState(false); const formSchema = useMemo( () => @@ -320,35 +321,44 @@ export default function RedirectForm({ return ( - - - - {t("redirectSource")} - - - {t("redirectSourceSectionDescription")} - - +
+ + + + + {t("general")} + + - - - - + + - - {resourceMissingDomain && ( - - - - {t( - "redirectDomainSelectedDomainNotFound" - )} - - - )} + + ( + + + {t("name")} + + + + + + + )} + /> + + + + + + + - - ( - - - {t("name")} - - - - - - - )} - /> - + + + + {t("redirectSource")} + + + {t("redirectSourceSectionDescription")} + + + + + + + {resourceMissingDomain && ( + + + + + {t( + "redirectDomainSelectedDomainNotFound" + )} + + + + )} - + {t( "redirectAttachDomain" )} - + {t( "redirectAttachResource" )} - - {t( - "redirectAttachedToDescription" - )} - )} @@ -552,150 +576,7 @@ export default function RedirectForm({ )} - {attachTo === "resource" && ( - - - - {t("resourceDomain")} - - - - - )} - - {/* The cloud only serves HTTPS, so there is nothing to toggle there. */} - {build !== "saas" && ( - - ( - - - - - - - )} - /> - - )} - - - - - -
- - - - - {t("redirectSettings")} - - - {t("redirectSettingsDescription")} - - - - - -
- - - - - - - ( - - - {t( - "redirectDestinationHost" - )} - - - - - - {t( - "redirectDestinationHostDescription" - )} - - - - )} - /> - - - - + + + + {showAdvancedSettings && ( + <> + {/* The cloud only serves HTTPS, and resource-attached redirects inherit TLS, so there is nothing to toggle in those cases. */} + {build !== "saas" && + attachTo === "domain" && ( + + ( + + + + + + + )} + /> + + )} + + ( + + + {t("priority")} + + + + field.onChange( + e + .target + .valueAsNumber + ) + } + /> + + + {t( + "redirectPriorityDescription" + )} + + + + )} + /> + + + )} + + + + + + + + + {t("redirectDestination")} + + + {t("redirectDestinationSectionDescription")} + + + + + + + + + + + + ( + + + {t( + "redirectDestinationHost" + )} + + + + + + {t( + "redirectDestinationHostDescription" + )} + + + + )} + /> + + + - - ( - - - {t("priority")} - - - - field.onChange( - e.target - .valueAsNumber - ) - } - /> - - - {t( - "redirectPriorityDescription" - )} - - - - )} - /> - - - - - - -
+
+
+
-
- - -
+
+ + +
+ +
); }