Skip to content

Commit 4df6310

Browse files
committed
[NEB-176] Nebula: Replace dashboard auth with Nebula auth
1 parent 7a2dc25 commit 4df6310

File tree

156 files changed

+1197
-1038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1197
-1038
lines changed

apps/dashboard/src/@/actions/validLogin.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
} from "@/constants/env";
2626
import { useThirdwebClient } from "@/constants/thirdweb.client";
2727
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
28-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
2928
import { zodResolver } from "@hookform/resolvers/zod";
3029
import { Turnstile } from "@marsidev/react-turnstile";
3130
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -52,7 +51,6 @@ import {
5251
useWalletBalance,
5352
} from "thirdweb/react";
5453
import { z } from "zod";
55-
import { isAccountOnboardingComplete } from "../../../../../../login/onboarding/isOnboardingRequired";
5654

5755
function formatTime(seconds: number) {
5856
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
@@ -78,11 +76,11 @@ const claimFaucetSchema = z.object({
7876
export function FaucetButton({
7977
chain,
8078
amount,
81-
twAccount,
79+
isLoggedIn,
8280
}: {
8381
chain: ChainMetadata;
8482
amount: number;
85-
twAccount: Account | undefined;
83+
isLoggedIn: boolean;
8684
}) {
8785
const pathname = usePathname();
8886
const client = useThirdwebClient();
@@ -186,7 +184,7 @@ export function FaucetButton({
186184
</div>
187185
<SendFundsToFaucetModalButton
188186
chain={definedChain}
189-
isLoggedIn={!!twAccount}
187+
isLoggedIn={isLoggedIn}
190188
client={client}
191189
chainMeta={chain}
192190
onFaucetRefill={() => {
@@ -198,7 +196,7 @@ export function FaucetButton({
198196
}
199197

200198
// Force users to log in to claim the faucet
201-
if (!address || !twAccount) {
199+
if (!address || !isLoggedIn) {
202200
return (
203201
<Button variant="primary" className="w-full" asChild>
204202
<Link
@@ -210,20 +208,6 @@ export function FaucetButton({
210208
);
211209
}
212210

213-
if (!isAccountOnboardingComplete(twAccount)) {
214-
return (
215-
<Button asChild className="w-full">
216-
<Link
217-
href={
218-
pathname ? `/login?next=${encodeURIComponent(pathname)}` : "/login"
219-
}
220-
>
221-
Verify your Email
222-
</Link>
223-
</Button>
224-
);
225-
}
226-
227211
// Can not claim
228212
if (canClaimFaucetQuery.data && canClaimFaucetQuery.data.canClaim === false) {
229213
return (

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/FaucetSection.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
21
import type { ChainMetadata } from "thirdweb/chains";
32
import { getFaucetClaimAmount } from "../../../../../../api/testnet-faucet/claim/claim-amount";
43
import { ChainIcon } from "../../../../components/server/chain-icon";
@@ -8,9 +7,9 @@ import { SectionTitle } from "./SectionTitle";
87

98
export async function FaucetSection(props: {
109
chain: ChainMetadata;
11-
twAccount: Account | undefined;
10+
isLoggedIn: boolean;
1211
}) {
13-
const { chain, twAccount } = props;
12+
const { chain, isLoggedIn } = props;
1413

1514
// Check eligibility.
1615
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
@@ -47,7 +46,7 @@ export async function FaucetSection(props: {
4746
<FaucetButton
4847
chain={chain}
4948
amount={amountToGive}
50-
twAccount={twAccount}
49+
isLoggedIn={isLoggedIn}
5150
/>
5251
</div>
5352
</div>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/layout.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import type { Metadata } from "next";
1919
import Link from "next/link";
2020
import { redirect } from "next/navigation";
2121
import { mapV4ChainToV5Chain } from "../../../../../contexts/map-chains";
22-
import { getRawAccount } from "../../../../account/settings/getAccount";
2322
import {
2423
getAuthToken,
2524
getAuthTokenWalletAddress,
@@ -61,10 +60,9 @@ export default async function ChainPageLayout(props: {
6160
}) {
6261
const params = await props.params;
6362
const { children } = props;
64-
const [chain, authToken, account, accountAddress] = await Promise.all([
63+
const [chain, authToken, accountAddress] = await Promise.all([
6564
getChain(params.chain_id),
6665
getAuthToken(),
67-
getRawAccount(),
6866
getAuthTokenWalletAddress(),
6967
]);
7068

@@ -100,7 +98,6 @@ The following is the user's message:
10098
<>
10199
<NebulaFloatingChatButton
102100
authToken={authToken ?? undefined}
103-
account={account}
104101
label="Ask AI about this chain"
105102
client={client}
106103
nebulaParams={{

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default async function Page(props: {
4242

4343
{/* Faucet / Buy Funds */}
4444
{chain.testnet ? (
45-
<FaucetSection chain={chain} twAccount={account} />
45+
<FaucetSection chain={chain} isLoggedIn={!!account} />
4646
) : chain.services.find((c) => c.service === "pay" && c.enabled) ? (
4747
<BuyFundsSection chain={chain} />
4848
) : null}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"use client";
2-
3-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
42
import { TransactionButton } from "components/buttons/TransactionButton";
53
import { useTrack } from "hooks/analytics/useTrack";
64
import { useAllChainsData } from "hooks/chains/allChains";
@@ -13,14 +11,14 @@ interface CancelTabProps {
1311
id: string;
1412
contract: ThirdwebContract;
1513
isAuction?: boolean;
16-
twAccount: Account | undefined;
14+
isLoggedIn: boolean;
1715
}
1816

1917
export const CancelTab: React.FC<CancelTabProps> = ({
2018
id,
2119
contract,
2220
isAuction,
23-
twAccount,
21+
isLoggedIn,
2422
}) => {
2523
const trackEvent = useTrack();
2624
const { idToChain } = useAllChainsData();
@@ -32,7 +30,7 @@ export const CancelTab: React.FC<CancelTabProps> = ({
3230
return (
3331
<div className="flex flex-col gap-3 pt-3">
3432
<TransactionButton
35-
twAccount={twAccount}
33+
isLoggedIn={isLoggedIn}
3634
txChainID={contract.chain.id}
3735
transactionCount={1}
3836
isPending={cancelQuery.isPending}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-button.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from "@/components/ui/sheet";
1111
import { TabButtons } from "@/components/ui/tabs";
1212
import { ListerOnly } from "@3rdweb-sdk/react/components/roles/lister-only";
13-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
1413
import { isAlchemySupported } from "lib/wallet/nfts/alchemy";
1514
import { isMoralisSupported } from "lib/wallet/nfts/moralis";
1615
import { PlusIcon } from "lucide-react";
@@ -23,7 +22,7 @@ interface CreateListingButtonProps {
2322
contract: ThirdwebContract;
2423
createText?: string;
2524
type?: "direct-listings" | "english-auctions";
26-
twAccount: Account | undefined;
25+
isLoggedIn: boolean;
2726
isInsightSupported: boolean;
2827
}
2928

@@ -33,7 +32,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
3332
createText = "Create",
3433
type,
3534
contract,
36-
twAccount,
35+
isLoggedIn,
3736
isInsightSupported,
3837
...restButtonProps
3938
}) => {
@@ -77,7 +76,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
7776
/>
7877
<div className="mt-5">
7978
<CreateListingsForm
80-
twAccount={twAccount}
79+
isLoggedIn={isLoggedIn}
8180
contract={contract}
8281
type={type}
8382
actionText={createText}
@@ -90,7 +89,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
9089
) : (
9190
<div className="mt-5">
9291
<CreateListingsForm
93-
twAccount={twAccount}
92+
isLoggedIn={isLoggedIn}
9493
contract={contract}
9594
type={type}
9695
actionText={createText}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-form.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Alert, AlertTitle } from "@/components/ui/alert";
22
import { Button } from "@/components/ui/button";
33
import { Card } from "@/components/ui/card";
4-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
54
import { useDashboardOwnedNFTs } from "@3rdweb-sdk/react/hooks/useDashboardOwnedNFTs";
65
import { useWalletNFTs } from "@3rdweb-sdk/react/hooks/useWalletNFTs";
76
import {
@@ -85,7 +84,7 @@ type CreateListingsFormProps = {
8584
setOpen: Dispatch<SetStateAction<boolean>>;
8685
mode: "automatic" | "manual";
8786
type?: "direct-listings" | "english-auctions";
88-
twAccount: Account | undefined;
87+
isLoggedIn: boolean;
8988
isInsightSupported: boolean;
9089
};
9190

@@ -104,7 +103,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
104103
type,
105104
actionText,
106105
setOpen,
107-
twAccount,
106+
isLoggedIn,
108107
mode,
109108
isInsightSupported,
110109
}) => {
@@ -659,7 +658,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
659658
Cancel
660659
</Button>
661660
<TransactionButton
662-
twAccount={twAccount}
661+
isLoggedIn={isLoggedIn}
663662
txChainID={contract.chain.id}
664663
isPending={isFormLoading}
665664
transactionCount={2}

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/listing-drawer.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
33
import { CopyTextButton } from "@/components/ui/CopyTextButton";
44
import { Badge } from "@/components/ui/badge";
55
import { Card } from "@/components/ui/card";
6+
import { CodeClient } from "@/components/ui/code/code.client";
67
import { Sheet, SheetContent } from "@/components/ui/sheet";
78
import { Flex, GridItem, SimpleGrid, usePrevious } from "@chakra-ui/react";
89
import type { ThirdwebContract } from "thirdweb";
@@ -11,9 +12,6 @@ import type {
1112
EnglishAuction,
1213
} from "thirdweb/extensions/marketplace";
1314
import { useActiveAccount } from "thirdweb/react";
14-
15-
import { CodeClient } from "@/components/ui/code/code.client";
16-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
1715
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
1816
import { CancelTab } from "./cancel-tab";
1917
import { LISTING_STATUS } from "./types";
@@ -23,15 +21,15 @@ interface NFTDrawerProps {
2321
isOpen: boolean;
2422
onClose: () => void;
2523
data: DirectListing | EnglishAuction | null;
26-
twAccount: Account | undefined;
24+
isLoggedIn: boolean;
2725
}
2826

2927
export const ListingDrawer: React.FC<NFTDrawerProps> = ({
3028
contract,
3129
isOpen,
3230
onClose,
3331
data,
34-
twAccount,
32+
isLoggedIn,
3533
}) => {
3634
const address = useActiveAccount()?.address;
3735
const prevData = usePrevious(data);
@@ -165,7 +163,7 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
165163
contract={contract}
166164
id={renderData.id.toString()}
167165
isAuction={renderData.type === "english-auction"}
168-
twAccount={twAccount}
166+
isLoggedIn={isLoggedIn}
169167
/>
170168
)}
171169
</SheetContent>

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/marketplace-table.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { WalletAddress } from "@/components/blocks/wallet-address";
22
import { Button } from "@/components/ui/button";
3-
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
43
import {
54
IconButton,
65
Select,
@@ -99,7 +98,7 @@ interface MarketplaceTableProps {
9998
start: number;
10099
}>
101100
>;
102-
twAccount: Account | undefined;
101+
isLoggedIn: boolean;
103102
}
104103

105104
const DEFAULT_QUERY_STATE = { count: 50, start: 0 };
@@ -111,7 +110,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
111110
totalCountQuery,
112111
queryParams,
113112
setQueryParams,
114-
twAccount,
113+
isLoggedIn,
115114
}) => {
116115
const [listingsToShow, setListingsToShow_] = useState<"all" | "valid">("all");
117116

@@ -216,7 +215,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
216215
data={tokenRow}
217216
isOpen={!!tokenRow}
218217
onClose={() => setTokenRow(null)}
219-
twAccount={twAccount}
218+
isLoggedIn={isLoggedIn}
220219
/>
221220
<Table {...getTableProps()}>
222221
<Thead>

0 commit comments

Comments
 (0)