Skip to content

Commit

Permalink
only show custom domain in the app header if one exists (#3694)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Sep 29, 2023
1 parent fefb747 commit 3c208e0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dashboard/src/main/home/app-dashboard/app-view/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 3c208e0

Please sign in to comment.