@@ -169,19 +187,21 @@ function MobileSidebarTriggerInner(props: { links: ShadcnSidebarLink[] }) {
);
}
-function useActiveShadcnSidebarLink(links: ShadcnSidebarLink[]) {
- const pathname = useFullPath();
-
+function useActiveShadcnSidebarLink(params: {
+ links: ShadcnSidebarLink[];
+ fullPath: string;
+}) {
+ const { links, fullPath } = params;
const activeLink = useMemo(() => {
const isActive = (link: ShadcnSidebarLink): boolean => {
if ("href" in link) {
// Handle exact match
if (link.exactMatch) {
- return link.href === pathname;
+ return link.href === fullPath;
}
// Handle prefix match (ensure we don't match partial paths)
- return pathname.startsWith(link.href);
+ return fullPath.startsWith(link.href);
}
if ("links" in link) {
@@ -192,23 +212,25 @@ function useActiveShadcnSidebarLink(links: ShadcnSidebarLink[]) {
};
return links.find(isActive);
- }, [links, pathname]);
+ }, [links, fullPath]);
return activeLink;
}
-function useIsSubnavActive(links: ShadcnSidebarLink[]) {
- const pathname = useFullPath();
-
+function useIsSubnavActive(params: {
+ links: ShadcnSidebarLink[];
+ fullPath: string;
+}) {
+ const { links, fullPath } = params;
const isSubnavActive = useMemo(() => {
const isActive = (link: ShadcnSidebarLink): boolean => {
if ("href" in link) {
// Handle exact match
if (link.exactMatch) {
- return link.href === pathname;
+ return link.href === fullPath;
}
- return pathname.startsWith(link.href);
+ return fullPath.startsWith(link.href);
}
if ("links" in link) {
@@ -219,7 +241,7 @@ function useIsSubnavActive(links: ShadcnSidebarLink[]) {
};
return links.some(isActive);
- }, [links, pathname]);
+ }, [links, fullPath]);
return isSubnavActive;
}
@@ -227,24 +249,17 @@ function useIsSubnavActive(links: ShadcnSidebarLink[]) {
function RenderSidebarGroup(props: {
sidebarLinks: ShadcnSidebarLink[];
groupName: string;
-}) {
- return (
-
-
-
- );
-}
-
-function RenderSidebarGroupInner(props: {
- sidebarLinks: ShadcnSidebarLink[];
- groupName: string;
+ fullPath: string;
}) {
return (
{props.groupName}
-
+
@@ -254,20 +269,13 @@ function RenderSidebarGroupInner(props: {
function RenderSidebarSubmenu(props: {
links: ShadcnSidebarLink[];
subMenu: Omit;
+ fullPath: string;
}) {
- return (
-
-
-
- );
-}
-
-function RenderSidebarSubmenuInner(props: {
- links: ShadcnSidebarLink[];
- subMenu: Omit;
-}) {
+ const isSubnavActive = useIsSubnavActive({
+ links: props.links,
+ fullPath: props.fullPath,
+ });
const sidebar = useSidebar();
- const isSubnavActive = useIsSubnavActive(props.links);
const [_open, setOpen] = useState(undefined);
const open = _open === undefined ? isSubnavActive : _open;
@@ -319,6 +327,7 @@ function RenderSidebarSubmenuInner(props: {
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent hover:text-foreground px-2 py-1.5 rounded-lg w-full"
exactMatch={link.exactMatch}
href={link.href}
+ fullPath={props.fullPath}
onClick={() => {
sidebar.setOpenMobile(false);
}}
@@ -335,6 +344,7 @@ function RenderSidebarSubmenuInner(props: {
);
@@ -346,6 +356,7 @@ function RenderSidebarSubmenuInner(props: {
key={`group_${link.group}_${index}`}
groupName={link.group}
sidebarLinks={link.links}
+ fullPath={props.fullPath}
/>
);
}
@@ -361,7 +372,10 @@ function RenderSidebarSubmenuInner(props: {
);
}
-function RenderSidebarMenu(props: { links: ShadcnSidebarLink[] }) {
+function RenderSidebarMenu(props: {
+ links: ShadcnSidebarLink[];
+ fullPath: string;
+}) {
const sidebar = useSidebar();
// Add null check for links
@@ -382,6 +396,7 @@ function RenderSidebarMenu(props: { links: ShadcnSidebarLink[] }) {
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent"
exactMatch={link.exactMatch}
href={link.href}
+ fullPath={props.fullPath}
onClick={() => {
sidebar.setOpenMobile(false);
}}
@@ -412,6 +427,7 @@ function RenderSidebarMenu(props: { links: ShadcnSidebarLink[] }) {
key={`submenu_${link.subMenu.label}_${idx}`}
links={link.links}
subMenu={link.subMenu}
+ fullPath={props.fullPath}
/>
);
}
@@ -423,6 +439,7 @@ function RenderSidebarMenu(props: { links: ShadcnSidebarLink[] }) {
groupName={link.group}
sidebarLinks={link.links}
key={`group_${link.group}_${idx}`}
+ fullPath={props.fullPath}
/>
);
}
diff --git a/apps/playground-web/src/components/styled-connect-embed.tsx b/apps/playground-web/src/components/styled-connect-embed.tsx
index 986e9bcbc49..ffe3a52b6d5 100644
--- a/apps/playground-web/src/components/styled-connect-embed.tsx
+++ b/apps/playground-web/src/components/styled-connect-embed.tsx
@@ -49,6 +49,7 @@ export function StyledConnectEmbed(
abstract,
]}
client={THIRDWEB_CLIENT}
+ className="!max-w-full"
theme={theme === "light" ? "light" : "dark"}
wallets={WALLETS}
{...props}
diff --git a/apps/playground-web/src/components/ui/NavLink.tsx b/apps/playground-web/src/components/ui/NavLink.tsx
index 24959e44ea8..450a5d08a52 100644
--- a/apps/playground-web/src/components/ui/NavLink.tsx
+++ b/apps/playground-web/src/components/ui/NavLink.tsx
@@ -1,11 +1,9 @@
"use client";
import Link from "next/link";
-import { Suspense } from "react";
import { cn } from "@/lib/utils";
-import { useFullPath } from "../../hooks/full-path";
-export type NavButtonProps = {
+export type NavLinkProps = {
className?: string;
activeClassName?: string;
href: string;
@@ -13,20 +11,14 @@ export type NavButtonProps = {
onClick?: () => void;
};
-export function NavLink(props: React.PropsWithChildren) {
- return (
-
-
-
- );
-}
-
-function NavLinkInner(props: React.PropsWithChildren) {
- const pathname = useFullPath();
-
+export function NavLink(
+ props: React.PropsWithChildren & {
+ fullPath: string;
+ },
+) {
const isActive = props.exactMatch
- ? pathname === props.href
- : pathname.startsWith(props.href);
+ ? props.fullPath === props.href
+ : props.fullPath.startsWith(props.href);
return (