Skip to content

Commit 180fb3f

Browse files
committed
temp2
1 parent 321a6ec commit 180fb3f

File tree

10 files changed

+270
-197
lines changed

10 files changed

+270
-197
lines changed

apps/dashboard/.storybook/preview.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,30 @@ const fontSans = interFont({
1717
variable: "--font-sans",
1818
});
1919

20+
const customViewports = {
21+
xs: {
22+
// Regular sized phones (iphone 15 / 15 pro)
23+
name: "iPhone",
24+
styles: {
25+
width: "390px",
26+
height: "844px",
27+
},
28+
},
29+
sm: {
30+
// Larger phones (iphone 15 plus / 15 pro max)
31+
name: "iPhone Plus",
32+
styles: {
33+
width: "430px",
34+
height: "932px",
35+
},
36+
},
37+
};
38+
2039
const preview: Preview = {
2140
parameters: {
41+
viewport: {
42+
viewports: customViewports,
43+
},
2244
controls: {
2345
matchers: {
2446
color: /(background|color)$/i,
@@ -58,13 +80,13 @@ function StoryLayout(props: {
5880

5981
return (
6082
<QueryClientProvider client={queryClient}>
61-
<div className="flex min-h-screen min-w-0 flex-col bg-background text-foreground">
83+
<div className="flex min-h-dvh min-w-0 flex-col bg-background text-foreground">
6284
<div className="flex justify-end gap-2 border-b p-4">
6385
<Button
6486
onClick={() => setTheme("dark")}
6587
size="sm"
6688
variant={theme === "dark" ? "default" : "outline"}
67-
className="h-auto w-auto rounded-full p-2"
89+
className="h-auto w-auto shrink-0 rounded-full p-2"
6890
>
6991
<MoonIcon className="size-4" />
7092
</Button>
@@ -73,7 +95,7 @@ function StoryLayout(props: {
7395
onClick={() => setTheme("light")}
7496
size="sm"
7597
variant={theme === "light" ? "default" : "outline"}
76-
className="h-auto w-auto rounded-full p-2"
98+
className="h-auto w-auto shrink-0 rounded-full p-2"
7799
>
78100
<SunIcon className="size-4" />
79101
</Button>

apps/dashboard/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ export type Account = {
5454
// TODO - add image URL
5555
};
5656

57-
export interface UpdateAccountInput {
58-
name?: string;
59-
email?: string;
60-
linkWallet?: boolean;
61-
subscribeToUpdates?: boolean;
62-
onboardSkipped?: boolean;
63-
}
64-
6557
interface UpdateAccountNotificationsInput {
6658
billing: "email" | "none";
6759
updates: "email" | "none";
@@ -379,7 +371,15 @@ export function useUserOpUsagePeriod(args: {
379371
});
380372
}
381373

382-
export async function updateAccountClient(input: UpdateAccountInput) {
374+
export type UpdateAccountParams = {
375+
name?: string;
376+
email?: string;
377+
linkWallet?: boolean;
378+
subscribeToUpdates?: boolean;
379+
onboardSkipped?: boolean;
380+
};
381+
382+
export async function updateAccountClient(input: UpdateAccountParams) {
383383
type Result = {
384384
data: object;
385385
error?: { message: string };
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import {
3-
BadgeContainer,
4-
mobileViewport,
5-
storybookLog,
6-
} from "../../../../stories/utils";
7-
import { EmailExists } from "./EmailExists";
2+
import { storybookLog } from "../../../../stories/utils";
3+
import { OnboardingLayout } from "../onboarding-layout";
4+
import { LinkWalletPrompt } from "./LinkWalletPrompt";
85

96
const meta = {
10-
title: "Onboarding/screens/EmailExists",
7+
title: "Onboarding/AccountOnboarding/LinkWalletPrompt",
118
component: Story,
129
parameters: {
1310
nextjs: {
@@ -19,33 +16,24 @@ const meta = {
1916
export default meta;
2017
type Story = StoryObj<typeof meta>;
2118

22-
export const Desktop: Story = {
23-
args: {},
19+
export const SendSuccess: Story = {
20+
args: {
21+
type: "success",
22+
},
2423
};
2524

26-
export const Mobile: Story = {
27-
args: {},
28-
parameters: {
29-
viewport: mobileViewport("iphone14"),
25+
export const SendError: Story = {
26+
args: {
27+
type: "error",
3028
},
3129
};
3230

33-
function Story() {
34-
return (
35-
<div className="container flex max-w-[800px] flex-col gap-20 py-10">
36-
<Variant label="Success" type="success" />
37-
<Variant label="Error Generic" type="error" />
38-
</div>
39-
);
40-
}
41-
42-
function Variant(props: {
43-
label: string;
31+
function Story(props: {
4432
type: "success" | "error";
4533
}) {
4634
return (
47-
<BadgeContainer label={props.label}>
48-
<EmailExists
35+
<OnboardingLayout currentStep={1}>
36+
<LinkWalletPrompt
4937
onLinkWalletRequestSent={() => {
5038
storybookLog("onLinkWalletRequestSent");
5139
}}
@@ -65,6 +53,6 @@ function Variant(props: {
6553
}}
6654
accountAddress="0x1234567890123456789012345678901234567890"
6755
/>
68-
</BadgeContainer>
56+
</OnboardingLayout>
6957
);
7058
}

apps/dashboard/src/app/login/onboarding/LinkWalletPrompt/EmailExists.tsx renamed to apps/dashboard/src/app/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.tsx

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import { Spinner } from "@/components/ui/Spinner/Spinner";
44
import { Button } from "@/components/ui/button";
55
import { TrackedLinkTW } from "@/components/ui/tracked-link";
66
import { useMutation } from "@tanstack/react-query";
7-
import { ArrowLeftIcon } from "lucide-react";
7+
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
88
import { toast } from "sonner";
99
import { shortenString } from "utils/usedapp-external";
1010
import type { TrackingParams } from "../../../../hooks/analytics/useTrack";
11-
import { TitleAndDescription } from "../Title";
1211

13-
export function EmailExists(props: {
12+
export function LinkWalletPrompt(props: {
1413
email: string;
1514
accountAddress: string;
1615
onBack: () => void;
@@ -57,45 +56,52 @@ export function EmailExists(props: {
5756
}
5857

5958
return (
60-
<div>
61-
<TitleAndDescription
62-
heading="Email already in use"
63-
description={
64-
<>
65-
{`We've`} noticed that an account associated with{" "}
59+
<div className="rounded-lg border bg-card">
60+
<h3 className="border-b px-4 py-6 font-semibold text-xl tracking-tight lg:p-6">
61+
Link your wallet
62+
</h3>
63+
64+
<div className="p-4 lg:p-6">
65+
<div className="mb-6 space-y-2 text-muted-foreground">
66+
<p>
67+
An account with{" "}
6668
<span className="text-foreground">{props.email}</span> already
67-
exists.
68-
<br /> Would you like to link your wallet{" "}
69-
<span className="font-mono text-foreground text-sm">
70-
{shortenString(props.accountAddress)}
71-
</span>{" "}
72-
to the existing account?
73-
<div className="h-2" />
69+
exists, created with another wallet
70+
</p>
71+
72+
<p>
73+
You can link your wallet with this account to access it. <br />{" "}
74+
Multiple wallets can be linked to the same account.{" "}
7475
<TrackedLinkTW
7576
href="https://portal.thirdweb.com/account/billing/account-info"
7677
category="account"
7778
label="learn-wallet-linking"
7879
target="_blank"
79-
className="underline hover:text-foreground"
80+
className="underline decoration-muted-foreground/50 decoration-dotted underline-offset-[5px] hover:text-foreground hover:decoration-foreground hover:decoration-solid"
8081
>
8182
Learn more about wallet linking
8283
</TrackedLinkTW>
83-
.
84-
</>
85-
}
86-
/>
84+
</p>
85+
</div>
8786

88-
<div className="h-8" />
87+
<p className="text-foreground">
88+
Would you like to link your wallet{" "}
89+
<span className="font-mono text-sm tracking-tight">
90+
({shortenString(props.accountAddress)})
91+
</span>{" "}
92+
with this account?
93+
</p>
94+
</div>
8995

90-
<div className="flex flex-row gap-3">
96+
<div className="flex flex-col-reverse gap-4 border-t px-4 py-6 md:flex-row lg:justify-between lg:p-6">
9197
<Button
9298
variant="outline"
9399
className="gap-2 bg-card"
94100
onClick={props.onBack}
95101
disabled={requestLinkWallet.isPending}
96102
>
97103
<ArrowLeftIcon className="size-4" />
98-
Use another email
104+
Change Email
99105
</Button>
100106

101107
<Button
@@ -104,8 +110,12 @@ export function EmailExists(props: {
104110
disabled={requestLinkWallet.isPending}
105111
className="gap-2"
106112
>
107-
{requestLinkWallet.isPending && <Spinner className="size-4" />}
108-
{requestLinkWallet.isPending ? "Linking" : "Yes, link them"}
113+
Link wallet and continue
114+
{requestLinkWallet.isPending ? (
115+
<Spinner className="size-4" />
116+
) : (
117+
<ArrowRightIcon className="size-4" />
118+
)}
109119
</Button>
110120
</div>
111121
</div>
Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import type { UpdateAccountInput } from "@3rdweb-sdk/react/hooks/useApi";
1+
import type { UpdateAccountParams } from "@3rdweb-sdk/react/hooks/useApi";
22
import type { Meta, StoryObj } from "@storybook/react";
3-
import {
4-
BadgeContainer,
5-
mobileViewport,
6-
storybookLog,
7-
} from "../../../../stories/utils";
3+
import { storybookLog } from "../../../../stories/utils";
4+
import { OnboardingLayout } from "../onboarding-layout";
85
import { LoginOrSignup } from "./LoginOrSignup";
96

107
const meta = {
11-
title: "Onboarding/screens/LoginOrSignup",
8+
title: "Onboarding/AccountOnboarding/LoginOrSignup",
129
component: Story,
1310
parameters: {
1411
nextjs: {
@@ -20,50 +17,44 @@ const meta = {
2017
export default meta;
2118
type Story = StoryObj<typeof meta>;
2219

23-
export const Desktop: Story = {
24-
args: {},
20+
export const Success: Story = {
21+
args: {
22+
type: "success",
23+
},
2524
};
2625

27-
export const Mobile: Story = {
28-
args: {},
29-
parameters: {
30-
viewport: mobileViewport("iphone14"),
26+
export const EmailExists: Story = {
27+
args: {
28+
type: "email-exists",
29+
},
30+
};
31+
32+
export const ConfiramtionError: Story = {
33+
args: {
34+
type: "error",
3135
},
3236
};
3337

34-
function loginOrSignupStug(
35-
type: "success" | "error-generic" | "error-email-exists",
36-
) {
37-
return async (data: UpdateAccountInput) => {
38+
function loginOrSignupStug(type: "success" | "error" | "email-exists") {
39+
return async (data: UpdateAccountParams) => {
3840
storybookLog("loginOrSignup", data);
3941
await new Promise((resolve) => setTimeout(resolve, 1000));
4042

41-
if (type === "error-generic") {
43+
if (type === "error") {
4244
throw new Error("Error Example");
4345
}
4446

45-
if (type === "error-email-exists") {
47+
if (type === "email-exists") {
4648
throw new Error("email address already exists");
4749
}
4850
};
4951
}
5052

51-
function Story() {
52-
return (
53-
<div className="container flex max-w-[800px] flex-col gap-20 py-10">
54-
<Variant label="Success" type="success" />
55-
<Variant label="Email Exists" type="error-email-exists" />
56-
<Variant label="Error Generic" type="error-generic" />
57-
</div>
58-
);
59-
}
60-
61-
function Variant(props: {
62-
label: string;
63-
type: "success" | "error-generic" | "error-email-exists";
53+
function Story(props: {
54+
type: "success" | "error" | "email-exists";
6455
}) {
6556
return (
66-
<BadgeContainer label={props.label}>
57+
<OnboardingLayout currentStep={1}>
6758
<LoginOrSignup
6859
onRequestSent={(params) => {
6960
storybookLog("onRequestSent", params);
@@ -73,6 +64,6 @@ function Variant(props: {
7364
storybookLog("trackEvent", params);
7465
}}
7566
/>
76-
</BadgeContainer>
67+
</OnboardingLayout>
7768
);
7869
}

0 commit comments

Comments
 (0)