From 3c208e01112865c165ceab85e62ede53ec97a2c2 Mon Sep 17 00:00:00 2001 From: Feroze Mohideen Date: Fri, 29 Sep 2023 15:34:36 -0400 Subject: [PATCH] only show custom domain in the app header if one exists (#3694) --- .../home/app-dashboard/app-view/AppHeader.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx b/dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx index a8502d73c3..ce5951ec0e 100644 --- a/dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx +++ b/dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx @@ -77,7 +77,20 @@ const AppHeader: React.FC = () => { [] ); - return domains.length === 1 ? domains[0] : ""; + // we only show the custom domain if 1 exists; if no custom domain exists, we show the porter domain, if one exists + const nonPorterDomains = domains.filter((n: string) => !n.endsWith(".onporter.run")); + if (nonPorterDomains.length) { + if (nonPorterDomains.length === 1) { + return nonPorterDomains[0]; + } + } else { + const porterDomains = domains.filter((n: string) => n.endsWith(".onporter.run")); + if (porterDomains.length === 1) { + return porterDomains[0]; + } + } + + return ""; }, [latestProto]); return (