fix: Make routing-form a preinstalled app (#9836)
Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
@@ -539,9 +539,7 @@ const navigation: NavigationItemType[] = [
|
||||
isCurrent: ({ router, item }) => {
|
||||
const path = router.asPath.split("?")[0];
|
||||
// During Server rendering path is /v2/apps but on client it becomes /apps(weird..)
|
||||
return (
|
||||
(path.startsWith(item.href) || path.startsWith("/v2" + item.href)) && !path.includes("routing-forms/")
|
||||
);
|
||||
return path.startsWith(item.href) || path.startsWith("/v2" + item.href);
|
||||
},
|
||||
child: [
|
||||
{
|
||||
@@ -551,9 +549,7 @@ const navigation: NavigationItemType[] = [
|
||||
const path = router.asPath.split("?")[0];
|
||||
// During Server rendering path is /v2/apps but on client it becomes /apps(weird..)
|
||||
return (
|
||||
(path.startsWith(item.href) || path.startsWith("/v2" + item.href)) &&
|
||||
!path.includes("routing-forms/") &&
|
||||
!path.includes("/installed")
|
||||
(path.startsWith(item.href) || path.startsWith("/v2" + item.href)) && !path.includes("/installed")
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -574,10 +570,10 @@ const navigation: NavigationItemType[] = [
|
||||
},
|
||||
{
|
||||
name: "Routing Forms",
|
||||
href: "/apps/routing-forms/forms",
|
||||
href: "/routing-forms/forms",
|
||||
icon: FileText,
|
||||
isCurrent: ({ router }) => {
|
||||
return router.asPath.startsWith("/apps/routing-forms/");
|
||||
return router.asPath.startsWith("/routing-forms/");
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -626,17 +622,9 @@ const Navigation = () => {
|
||||
};
|
||||
|
||||
function useShouldDisplayNavigationItem(item: NavigationItemType) {
|
||||
const { status } = useSession();
|
||||
const { data: routingForms } = trpc.viewer.appById.useQuery(
|
||||
{ appId: "routing-forms" },
|
||||
{
|
||||
enabled: status === "authenticated" && requiredCredentialNavigationItems.includes(item.name),
|
||||
trpc: {},
|
||||
}
|
||||
);
|
||||
const flags = useFlagMap();
|
||||
if (isKeyInObject(item.name, flags)) return flags[item.name];
|
||||
return !requiredCredentialNavigationItems.includes(item.name) || routingForms?.isInstalled;
|
||||
return true;
|
||||
}
|
||||
|
||||
const defaultIsCurrent: NavigationItemType["isCurrent"] = ({ isChild, item, router }) => {
|
||||
|
||||
Reference in New Issue
Block a user