feat: Use new /routing URL for routing forms (#19235)
* feat: Use new /routing URL for routing forms * Fixes * Fix bug * precent crash --------- Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
1 parent
6364e85293
commit
f6f964d495
14 files changed
+376
-129
No files matched your search
@@ -152,9 +152,18 @@ export function ShellMain(props: LayoutProps) {
|
||||
variant="icon"
|
||||
size="sm"
|
||||
color="minimal"
|
||||
onClick={() =>
|
||||
typeof props.backPath === "string" ? router.push(props.backPath as string) : router.back()
|
||||
}
|
||||
onClick={() => {
|
||||
if (typeof props.backPath === "string") {
|
||||
// Prevents weird crash when navigating from /routing to /routing/forms
|
||||
if (props.backPath.startsWith("/routing")) {
|
||||
window.location.href = props.backPath;
|
||||
} else {
|
||||
router.push(props.backPath as string);
|
||||
}
|
||||
} else {
|
||||
router.back();
|
||||
}
|
||||
}}
|
||||
StartIcon="arrow-left"
|
||||
aria-label="Go Back"
|
||||
className="rounded-md ltr:mr-2 rtl:ml-2"
|
||||
|
||||
@@ -90,11 +90,11 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTy
|
||||
},
|
||||
{
|
||||
name: "routing",
|
||||
href: "/apps/routing-forms/forms",
|
||||
href: "/routing",
|
||||
icon: "split",
|
||||
badge: <Badge variant="green">NEW</Badge>,
|
||||
|
||||
isCurrent: ({ pathname }) => pathname?.startsWith("/apps/routing-forms/") ?? false,
|
||||
isCurrent: ({ pathname }) => pathname?.startsWith("/routing") ?? false,
|
||||
moreOnMobile: true,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -57,6 +57,13 @@ export const NavigationItem: React.FC<{
|
||||
<Link
|
||||
data-test-id={item.name}
|
||||
href={item.href}
|
||||
onClick={(e) => {
|
||||
// Prevents weird crash when navigating from /routing to /routing/forms
|
||||
if (item.href.startsWith("/routing")) {
|
||||
e.preventDefault();
|
||||
window.location.href = item.href;
|
||||
}
|
||||
}}
|
||||
aria-label={t(item.name)}
|
||||
target={item.target}
|
||||
className={classNames(
|
||||
|
||||
Reference in new issue
Block a user