Skip to content

Commit ab9897d

Browse files
committed
Replace login links with button router push
1 parent 68ad62f commit ab9897d

File tree

3 files changed

+46
-26
lines changed

3 files changed

+46
-26
lines changed

apps/dashboard/src/@3rdweb-sdk/react/components/connect-wallet/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Spinner } from "@/components/ui/Spinner/Spinner";
44
import { Button } from "@/components/ui/button";
55
import { useThirdwebClient } from "@/constants/thirdweb.client";
6+
import { useDashboardRouter } from "@/lib/DashboardRouter";
67
import { useStore } from "@/lib/reactive";
78
import { cn } from "@/lib/utils";
89
import { getSDKTheme } from "app/components/sdk-component-theme";
@@ -43,6 +44,7 @@ export const CustomConnectWallet = (props: {
4344
const thirdwebClient = useThirdwebClient();
4445
const loginRequired =
4546
props.loginRequired === undefined ? true : props.loginRequired;
47+
const router = useDashboardRouter();
4648

4749
const { theme } = useTheme();
4850
const t = theme === "light" ? "light" : "dark";
@@ -142,16 +144,16 @@ export const CustomConnectWallet = (props: {
142144
return (
143145
<>
144146
<Button
145-
asChild
146147
variant="default"
147148
className={props.signInLinkButtonClassName}
148149
size="lg"
150+
onClick={() => {
151+
router.push(
152+
`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`,
153+
);
154+
}}
149155
>
150-
<Link
151-
href={`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`}
152-
>
153-
Sign In
154-
</Link>
156+
Sign In
155157
</Button>
156158
</>
157159
);

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/embed/embed-setup.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Button } from "@/components/ui/button";
44
import { CodeClient } from "@/components/ui/code/code.client";
5+
import { useDashboardRouter } from "@/lib/DashboardRouter";
56
import { useApiKeys, useCreateApiKey } from "@3rdweb-sdk/react/hooks/useApi";
67
import { Flex, FormControl, Input, Select } from "@chakra-ui/react";
78
import { LazyCreateAPIKeyDialog } from "components/settings/ApiKeys/Create/LazyCreateAPIKeyDialog";
@@ -294,6 +295,7 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
294295
const [showCreateAPIKeyModal, setShowCreateAPIKeyModal] = useState(false);
295296
const activeAccount = useActiveAccount();
296297
const pathname = usePathname();
298+
const router = useDashboardRouter();
297299

298300
return (
299301
<Flex gap={8} direction="column">
@@ -377,14 +379,17 @@ export const EmbedSetup: React.FC<EmbedSetupProps> = ({
377379
<FormControl>
378380
<FormLabel>Client ID</FormLabel>
379381
{!activeAccount ? (
380-
<Button asChild className="w-full">
381-
<Link
382-
href={`/login${
383-
pathname ? `?next=${encodeURIComponent(pathname)}` : ""
384-
}`}
385-
>
386-
Sign in to create a client ID
387-
</Link>
382+
<Button
383+
className="w-full"
384+
onClick={() => {
385+
router.push(
386+
`/login${
387+
pathname ? `?next=${encodeURIComponent(pathname)}` : ""
388+
}`,
389+
);
390+
}}
391+
>
392+
Sign in to create a client ID
388393
</Button>
389394
) : validApiKey ? (
390395
<Input

apps/dashboard/src/app/team/components/TeamHeader/TeamHeaderLoggedOut.tsx

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import { Button } from "@/components/ui/button";
4+
import { useDashboardRouter } from "@/lib/DashboardRouter";
45
import { cn } from "@/lib/utils";
56
import Link from "next/link";
67
import { usePathname } from "next/navigation";
@@ -13,6 +14,7 @@ export function TeamHeaderLoggedOutDesktopUI(props: {
1314
className?: string;
1415
}) {
1516
const pathname = usePathname();
17+
const router = useDashboardRouter();
1618
return (
1719
<header
1820
className={cn(
@@ -31,12 +33,17 @@ export function TeamHeaderLoggedOutDesktopUI(props: {
3133
<div className="flex items-center gap-6">
3234
<SecondaryNavLinks />
3335

34-
<Button size="sm" variant="primary" className="rounded-lg" asChild>
35-
<Link
36-
href={`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`}
37-
>
38-
Sign in
39-
</Link>
36+
<Button
37+
size="sm"
38+
variant="primary"
39+
className="rounded-lg"
40+
onClick={() => {
41+
router.push(
42+
`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`,
43+
);
44+
}}
45+
>
46+
Sign in
4047
</Button>
4148
</div>
4249
</header>
@@ -47,6 +54,7 @@ export function TeamHeaderLoggedOutMobileUI(props: {
4754
className?: string;
4855
}) {
4956
const pathname = usePathname();
57+
const router = useDashboardRouter();
5058

5159
return (
5260
<header
@@ -60,12 +68,17 @@ export function TeamHeaderLoggedOutMobileUI(props: {
6068
</Link>
6169

6270
<div className="flex items-center gap-3">
63-
<Button size="sm" variant="primary" className="rounded-lg" asChild>
64-
<Link
65-
href={`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`}
66-
>
67-
Sign in
68-
</Link>
71+
<Button
72+
size="sm"
73+
variant="primary"
74+
className="rounded-lg"
75+
onClick={() => {
76+
router.push(
77+
`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`,
78+
);
79+
}}
80+
>
81+
Sign in
6982
</Button>
7083
<MobileBurgerMenuButton type="loggedOut" />
7184
</div>

0 commit comments

Comments
 (0)