Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions apps/dashboard/src/@/actions/validLogin.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
} from "@/constants/env";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { zodResolver } from "@hookform/resolvers/zod";
import { Turnstile } from "@marsidev/react-turnstile";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
Expand All @@ -52,7 +51,6 @@ import {
useWalletBalance,
} from "thirdweb/react";
import { z } from "zod";
import { isAccountOnboardingComplete } from "../../../../../../login/onboarding/isOnboardingRequired";

function formatTime(seconds: number) {
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
Expand All @@ -78,11 +76,11 @@ const claimFaucetSchema = z.object({
export function FaucetButton({
chain,
amount,
twAccount,
isLoggedIn,
}: {
chain: ChainMetadata;
amount: number;
twAccount: Account | undefined;
isLoggedIn: boolean;
}) {
const pathname = usePathname();
const client = useThirdwebClient();
Expand Down Expand Up @@ -186,7 +184,7 @@ export function FaucetButton({
</div>
<SendFundsToFaucetModalButton
chain={definedChain}
isLoggedIn={!!twAccount}
isLoggedIn={isLoggedIn}
client={client}
chainMeta={chain}
onFaucetRefill={() => {
Expand All @@ -198,7 +196,7 @@ export function FaucetButton({
}

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

if (!isAccountOnboardingComplete(twAccount)) {
return (
<Button asChild className="w-full">
<Link
href={
pathname ? `/login?next=${encodeURIComponent(pathname)}` : "/login"
}
>
Verify your Email
</Link>
</Button>
);
}

// Can not claim
if (canClaimFaucetQuery.data && canClaimFaucetQuery.data.canClaim === false) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import type { ChainMetadata } from "thirdweb/chains";
import { getFaucetClaimAmount } from "../../../../../../api/testnet-faucet/claim/claim-amount";
import { ChainIcon } from "../../../../components/server/chain-icon";
Expand All @@ -8,9 +7,9 @@ import { SectionTitle } from "./SectionTitle";

export async function FaucetSection(props: {
chain: ChainMetadata;
twAccount: Account | undefined;
isLoggedIn: boolean;
}) {
const { chain, twAccount } = props;
const { chain, isLoggedIn } = props;

// Check eligibility.
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
Expand Down Expand Up @@ -47,7 +46,7 @@ export async function FaucetSection(props: {
<FaucetButton
chain={chain}
amount={amountToGive}
twAccount={twAccount}
isLoggedIn={isLoggedIn}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type { Metadata } from "next";
import Link from "next/link";
import { redirect } from "next/navigation";
import { mapV4ChainToV5Chain } from "../../../../../contexts/map-chains";
import { getRawAccount } from "../../../../account/settings/getAccount";
import {
getAuthToken,
getAuthTokenWalletAddress,
Expand Down Expand Up @@ -61,10 +60,9 @@ export default async function ChainPageLayout(props: {
}) {
const params = await props.params;
const { children } = props;
const [chain, authToken, account, accountAddress] = await Promise.all([
const [chain, authToken, accountAddress] = await Promise.all([
getChain(params.chain_id),
getAuthToken(),
getRawAccount(),
getAuthTokenWalletAddress(),
]);

Expand Down Expand Up @@ -100,7 +98,6 @@ The following is the user's message:
<>
<NebulaFloatingChatButton
authToken={authToken ?? undefined}
account={account}
label="Ask AI about this chain"
client={client}
nebulaParams={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default async function Page(props: {

{/* Faucet / Buy Funds */}
{chain.testnet ? (
<FaucetSection chain={chain} twAccount={account} />
<FaucetSection chain={chain} isLoggedIn={!!account} />
) : chain.services.find((c) => c.service === "pay" && c.enabled) ? (
<BuyFundsSection chain={chain} />
) : null}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use client";

import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { TransactionButton } from "components/buttons/TransactionButton";
import { useTrack } from "hooks/analytics/useTrack";
import { useAllChainsData } from "hooks/chains/allChains";
Expand All @@ -13,14 +11,14 @@ interface CancelTabProps {
id: string;
contract: ThirdwebContract;
isAuction?: boolean;
twAccount: Account | undefined;
isLoggedIn: boolean;
}

export const CancelTab: React.FC<CancelTabProps> = ({
id,
contract,
isAuction,
twAccount,
isLoggedIn,
}) => {
const trackEvent = useTrack();
const { idToChain } = useAllChainsData();
Expand All @@ -32,7 +30,7 @@ export const CancelTab: React.FC<CancelTabProps> = ({
return (
<div className="flex flex-col gap-3 pt-3">
<TransactionButton
twAccount={twAccount}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
isPending={cancelQuery.isPending}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "@/components/ui/sheet";
import { TabButtons } from "@/components/ui/tabs";
import { ListerOnly } from "@3rdweb-sdk/react/components/roles/lister-only";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { isAlchemySupported } from "lib/wallet/nfts/alchemy";
import { isMoralisSupported } from "lib/wallet/nfts/moralis";
import { PlusIcon } from "lucide-react";
Expand All @@ -23,7 +22,7 @@ interface CreateListingButtonProps {
contract: ThirdwebContract;
createText?: string;
type?: "direct-listings" | "english-auctions";
twAccount: Account | undefined;
isLoggedIn: boolean;
isInsightSupported: boolean;
}

Expand All @@ -33,7 +32,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
createText = "Create",
type,
contract,
twAccount,
isLoggedIn,
isInsightSupported,
...restButtonProps
}) => {
Expand Down Expand Up @@ -77,7 +76,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
/>
<div className="mt-5">
<CreateListingsForm
twAccount={twAccount}
isLoggedIn={isLoggedIn}
contract={contract}
type={type}
actionText={createText}
Expand All @@ -90,7 +89,7 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
) : (
<div className="mt-5">
<CreateListingsForm
twAccount={twAccount}
isLoggedIn={isLoggedIn}
contract={contract}
type={type}
actionText={createText}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Alert, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { useDashboardOwnedNFTs } from "@3rdweb-sdk/react/hooks/useDashboardOwnedNFTs";
import { useWalletNFTs } from "@3rdweb-sdk/react/hooks/useWalletNFTs";
import {
Expand Down Expand Up @@ -85,7 +84,7 @@ type CreateListingsFormProps = {
setOpen: Dispatch<SetStateAction<boolean>>;
mode: "automatic" | "manual";
type?: "direct-listings" | "english-auctions";
twAccount: Account | undefined;
isLoggedIn: boolean;
isInsightSupported: boolean;
};

Expand All @@ -104,7 +103,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
type,
actionText,
setOpen,
twAccount,
isLoggedIn,
mode,
isInsightSupported,
}) => {
Expand Down Expand Up @@ -659,7 +658,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
Cancel
</Button>
<TransactionButton
twAccount={twAccount}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
isPending={isFormLoading}
transactionCount={2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Badge } from "@/components/ui/badge";
import { Card } from "@/components/ui/card";
import { CodeClient } from "@/components/ui/code/code.client";
import { Sheet, SheetContent } from "@/components/ui/sheet";
import { Flex, GridItem, SimpleGrid, usePrevious } from "@chakra-ui/react";
import { toast } from "sonner";
import type { ThirdwebContract } from "thirdweb";
import type {
DirectListing,
EnglishAuction,
} from "thirdweb/extensions/marketplace";
import { BuyDirectListingButton, useActiveAccount } from "thirdweb/react";

import { CodeClient } from "@/components/ui/code/code.client";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import { toast } from "sonner";
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
import { CancelTab } from "./cancel-tab";
import { LISTING_STATUS } from "./types";
Expand All @@ -24,15 +22,15 @@ interface NFTDrawerProps {
isOpen: boolean;
onClose: () => void;
data: DirectListing | EnglishAuction | null;
twAccount: Account | undefined;
isLoggedIn: boolean;
}

export const ListingDrawer: React.FC<NFTDrawerProps> = ({
contract,
isOpen,
onClose,
data,
twAccount,
isLoggedIn,
}) => {
const address = useActiveAccount()?.address;
const prevData = usePrevious(data);
Expand Down Expand Up @@ -161,7 +159,7 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
contract={contract}
id={renderData.id.toString()}
isAuction={renderData.type === "english-auction"}
twAccount={twAccount}
isLoggedIn={isLoggedIn}
/>
)}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { WalletAddress } from "@/components/blocks/wallet-address";
import { Button } from "@/components/ui/button";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import {
IconButton,
Select,
Expand Down Expand Up @@ -99,7 +98,7 @@ interface MarketplaceTableProps {
start: number;
}>
>;
twAccount: Account | undefined;
isLoggedIn: boolean;
}

const DEFAULT_QUERY_STATE = { count: 50, start: 0 };
Expand All @@ -111,7 +110,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
totalCountQuery,
queryParams,
setQueryParams,
twAccount,
isLoggedIn,
}) => {
const [listingsToShow, setListingsToShow_] = useState<"all" | "valid">("all");

Expand Down Expand Up @@ -216,7 +215,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
data={tokenRow}
isOpen={!!tokenRow}
onClose={() => setTokenRow(null)}
twAccount={twAccount}
isLoggedIn={isLoggedIn}
/>
<Table {...getTableProps()}>
<Thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client";

import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import type { ThirdwebContract } from "thirdweb";
import { ErrorPage, LoadingPage } from "../../_components/page-skeletons";
import { RedirectToContractOverview } from "../../_components/redirect-contract-overview.client";
Expand All @@ -9,7 +8,7 @@ import { ContractDirectListingsPage } from "./ContractDirectListingsPage";

export function ContractDirectListingsPageClient(props: {
contract: ThirdwebContract;
twAccount: Account | undefined;
isLoggedIn: boolean;
}) {
const metadataQuery = useContractPageMetadata(props.contract);

Expand All @@ -28,7 +27,7 @@ export function ContractDirectListingsPageClient(props: {
return (
<ContractDirectListingsPage
contract={props.contract}
twAccount={props.twAccount}
isLoggedIn={props.isLoggedIn}
isInsightSupported={metadataQuery.data.isInsightSupported}
/>
);
Expand Down
Loading
Loading