Skip to content
Open
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
4 changes: 3 additions & 1 deletion packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
>
<SelectToken
type="buy"
theme={props.theme}
connectOptions={props.connectOptions}

Check warning on line 217 in packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx#L216-L217

Added lines #L216 - L217 were not covered by tests
currency={props.currency}
selections={{
buyChainId: props.selectedToken?.chainId,
Expand Down Expand Up @@ -645,7 +647,7 @@
gap="xs"
color="secondaryText"
>
<WalletDotIcon size={iconSize.xs} color="secondaryText" />
<WalletDotIcon size={iconSize.xs} />

Check warning on line 650 in packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx#L650

Added line #L650 was not covered by tests
<Text size="sm" color="primaryText">
{ensNameQuery.data || shortenAddress(props.address)}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { useConnectedWallets } from "../../../../core/hooks/wallets/useConnectedWallets.js";
import type { SupportedTokens } from "../../../../core/utils/defaultTokens.js";
import type { ConnectLocale } from "../../ConnectWallet/locale/types.js";
import { WalletSwitcherConnectionScreen } from "../../ConnectWallet/screens/WalletSwitcherConnectionScreen.js";
import { WalletConnectionScreen } from "../../ConnectWallet/screens/WalletSwitcherConnectionScreen.js";
import { Container, ModalHeader } from "../../components/basic.js";
import { Spacer } from "../../components/Spacer.js";
import type { PayEmbedConnectOptions } from "../../PayEmbed.js";
Expand Down Expand Up @@ -239,7 +239,9 @@
: connectOptions?.chains;

return (
<WalletSwitcherConnectionScreen
<WalletConnectionScreen
shouldSetActive={false}
size="compact"

Check warning on line 244 in packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx#L242-L244

Added lines #L242 - L244 were not covered by tests
accountAbstraction={connectOptions?.accountAbstraction}
appMetadata={connectOptions?.appMetadata}
chain={destinationChain || connectOptions?.chain}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,134 @@
import { ChevronDownIcon } from "@radix-ui/react-icons";
import type { BridgeChain } from "../../../../../bridge/types/Chain.js";
import type { ThirdwebClient } from "../../../../../client/client.js";
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
import {
fontSize,
iconSize,
radius,
spacing,
} from "../../../../core/design-system/index.js";
import { Container } from "../../components/basic.js";
import { Button } from "../../components/buttons.js";
import { Img } from "../../components/Img.js";
import { Spacer } from "../../components/Spacer.js";
import type { SelectedTab } from "./types.js";
import { cleanedChainName } from "./utils.js";

export function SelectChainButton(props: {
selectedChain: BridgeChain;
export function MobileTabSelector(props: {
selectedTab: SelectedTab;
onSelect: (tab: "your-tokens" | "all-tokens" | "chain-selector") => void;
client: ThirdwebClient;
onClick: () => void;
}) {
if (props.selectedTab.type === "your-tokens") {
return <Tabs selectedTab={props.selectedTab} onSelect={props.onSelect} />;
}

Check warning on line 24 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L22-L24

Added lines #L22 - L24 were not covered by tests

if (props.selectedTab.type === "chain") {
return (
<div>
<Tabs selectedTab={props.selectedTab} onSelect={props.onSelect} />
<Spacer y="sm" />
<Container px="md">
<Button
variant="outline"
bg="tertiaryBg"
fullWidth
style={{
justifyContent: "flex-start",
fontWeight: 500,
fontSize: fontSize.md,
padding: `${spacing.sm} ${spacing.sm}`,
borderRadius: radius.lg,
minHeight: "48px",
}}
gap="sm"
onClick={() => props.onSelect("chain-selector")}

Check warning on line 45 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L26-L45

Added lines #L26 - L45 were not covered by tests
>
<Img
src={props.selectedTab.chain.icon}
client={props.client}
width={iconSize.md}
height={iconSize.md}
/>
<span> {cleanedChainName(props.selectedTab.chain.name)} </span>
<ChevronDownIcon
width={iconSize.sm}
height={iconSize.sm}
style={{ marginLeft: "auto" }}
/>
</Button>
</Container>
</div>

Check warning on line 61 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L47-L61

Added lines #L47 - L61 were not covered by tests
);
}

Check warning on line 63 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L63

Added line #L63 was not covered by tests

return null;
}

Check warning on line 66 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L65-L66

Added lines #L65 - L66 were not covered by tests

function Tabs(props: {

Check warning on line 68 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L68

Added line #L68 was not covered by tests
selectedTab: SelectedTab;
onSelect: (tab: "your-tokens" | "all-tokens") => void;
}) {
const theme = useCustomTheme();

Check warning on line 72 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L71-L72

Added lines #L71 - L72 were not covered by tests
return (
<Button
variant="outline"
bg="tertiaryBg"
fullWidth
<Container
flex="row"
gap="xs"
px="md"
style={{ borderBottom: `1px solid ${theme.colors.borderColor}` }}

Check warning on line 78 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L74-L78

Added lines #L74 - L78 were not covered by tests
>
<TabButton
isSelected={props.selectedTab.type === "your-tokens"}
onSelect={() => props.onSelect("your-tokens")}
label="Your Tokens"
/>
<TabButton
isSelected={props.selectedTab.type === "chain"}
onSelect={() => props.onSelect("all-tokens")}
label="All Tokens"
/>
</Container>

Check warning on line 90 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L80-L90

Added lines #L80 - L90 were not covered by tests
);
}

Check warning on line 92 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L92

Added line #L92 was not covered by tests

function TabButton(props: {

Check warning on line 94 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L94

Added line #L94 was not covered by tests
isSelected: boolean;
onSelect: () => void;
label: string;
}) {
const theme = useCustomTheme();
return (
<div

Check warning on line 101 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L98-L101

Added lines #L98 - L101 were not covered by tests
style={{
justifyContent: "flex-start",
fontWeight: 500,
fontSize: fontSize.md,
padding: `${spacing.sm} ${spacing.sm}`,
borderRadius: radius.lg,
minHeight: "48px",
paddingBottom: "4px",
position: "relative",

Check warning on line 104 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L103-L104

Added lines #L103 - L104 were not covered by tests
}}
gap="sm"
onClick={props.onClick}
>
<Img
src={props.selectedChain.icon}
client={props.client}
width={iconSize.lg}
height={iconSize.lg}
/>
<span> {cleanedChainName(props.selectedChain.name)} </span>
<Button
variant="ghost-solid"
onClick={props.onSelect}
style={{
fontSize: fontSize.sm,
padding: `10px ${spacing.xs}`,
color: props.isSelected
? theme.colors.primaryText
: theme.colors.secondaryText,
}}

Check warning on line 116 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L107-L116

Added lines #L107 - L116 were not covered by tests
>
{props.label}
</Button>

Check warning on line 119 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L118-L119

Added lines #L118 - L119 were not covered by tests

<ChevronDownIcon
width={iconSize.sm}
height={iconSize.sm}
style={{ marginLeft: "auto" }}
/>
</Button>
{props.isSelected && (
<div
style={{
position: "absolute",
left: 0,
right: 0,
bottom: "-1.5px",
borderBottom: `2px solid ${theme.colors.primaryText}`,
}}
></div>

Check warning on line 130 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L121-L130

Added lines #L121 - L130 were not covered by tests
)}
</div>

Check warning on line 132 in packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SelectChainButton.tsx#L132

Added line #L132 was not covered by tests
);
}
Loading
Loading