From e68d29760a25efd99786cb51a4b9cb439859592f Mon Sep 17 00:00:00 2001 From: Shishant Biswas Date: Fri, 18 Sep 2026 19:29:31 +0530 Subject: [PATCH 1/3] fix: sidebar link href with --- app/src/ui/Admin.tsx | 5 +++++ app/src/ui/components/wouter/Link.tsx | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/ui/Admin.tsx b/app/src/ui/Admin.tsx index 766b56a8..c62eedce 100644 --- a/app/src/ui/Admin.tsx +++ b/app/src/ui/Admin.tsx @@ -16,6 +16,11 @@ export type BkndAdminConfig = { * @default `/` */ basepath?: string; + /** + * Sub-path for the Admin UI within the base path + * @default `` + */ + admin_basepath?: string; /** * Path to return to when clicking the logo * @default `/` diff --git a/app/src/ui/components/wouter/Link.tsx b/app/src/ui/components/wouter/Link.tsx index 4c5238d6..d48aa8c2 100644 --- a/app/src/ui/components/wouter/Link.tsx +++ b/app/src/ui/components/wouter/Link.tsx @@ -1,5 +1,6 @@ import { type LinkProps, Link as WouterLink, useRouter } from "wouter"; import { useEvent } from "../../hooks/use-event"; +import { useBkndOptions } from "ui/client/BkndProvider"; /* * Transforms `path` into its relative `base` version @@ -70,11 +71,13 @@ export function Link({ return false; } - + const bkndOptions = useBkndOptions(); + const adminBasePath = bkndOptions?.admin_basepath ?? ""; const _href = props.href ?? props.to; + const href = router .hrefs( - _href[0] === "~" ? _href.slice(1) : router.base + _href, + _href[0] === "~" ? adminBasePath + _href.slice(1) : router.base + _href, router, // pass router as a second argument for convinience ) .replace("//", "/"); @@ -82,8 +85,10 @@ export function Link({ const active = href.replace(router.base, "").length <= 1 ? href === absPath : isActive(absPath, href); + // console.log({ adminBasePath, _href, href, bkndOptions }) if (native) { - return ; + // @ts-expect-error update wouter breaks types for anchor tag + return ; } const wouterOnClick = (e: any) => { @@ -99,10 +104,11 @@ export function Link({ }; return ( + // @ts-expect-error className is not typed on WouterLink ); From 919d9f15d1697f4555cdd4b4ce70fbf36bee0efd Mon Sep 17 00:00:00 2001 From: Shishant Biswas Date: Tue, 22 Sep 2026 21:07:37 +0530 Subject: [PATCH 2/3] revert: ts expect error --- app/src/ui/components/wouter/Link.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/ui/components/wouter/Link.tsx b/app/src/ui/components/wouter/Link.tsx index d48aa8c2..051364dc 100644 --- a/app/src/ui/components/wouter/Link.tsx +++ b/app/src/ui/components/wouter/Link.tsx @@ -87,7 +87,6 @@ export function Link({ // console.log({ adminBasePath, _href, href, bkndOptions }) if (native) { - // @ts-expect-error update wouter breaks types for anchor tag return ; } From 62d3a9c4f4eb08c54010e95f362076c2cc3cd5e5 Mon Sep 17 00:00:00 2001 From: Shishant Biswas Date: Tue, 22 Sep 2026 21:47:15 +0530 Subject: [PATCH 3/3] fix: data/schema toggle link in `/data` path to include `adminBasePath` --- app/src/ui/lib/routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/ui/lib/routes.ts b/app/src/ui/lib/routes.ts index 46ed4fbe..a2b5bcc6 100644 --- a/app/src/ui/lib/routes.ts +++ b/app/src/ui/lib/routes.ts @@ -101,7 +101,7 @@ export function useNavigate() { } } - const _url = options?.absolute ? `~/${basepath}${url}`.replace(/\/+/g, "/") : url; + const _url = options?.absolute ? `~/${app.options.basepath}/${app.options.admin_basepath}${url}`.replace(/\/+/g, "/") : url; const state = { ...options?.state, referrer: location,