Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

hide buy button for non privy wallets #2554

Merged
merged 1 commit into from
Nov 24, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
];

const SELECT_LIST = [

Check warning on line 67 in packages/app/components/creator-token/buy-creator-token.web.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/components/creator-token/buy-creator-token.web.tsx#L67

[unused-imports/no-unused-vars] 'SELECT_LIST' is assigned a value but never used. Allowed unused vars must match /^_/u.
{
title: "Buy",
value: "buy",
Expand All @@ -87,7 +87,7 @@
const sellToken = useCreatorTokenSell();
const redirectToCreatorTokensShare = useRedirectToCreatorTokensShare();

const [selectedAction, setSelectedAction] = useState<Query["selectedAction"]>(

Check warning on line 90 in packages/app/components/creator-token/buy-creator-token.web.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/components/creator-token/buy-creator-token.web.tsx#L90

[unused-imports/no-unused-vars] 'setSelectedAction' is assigned a value but never used. Allowed unused vars must match /^_/u.
selectedActionParam ?? "buy"
);

Expand All @@ -98,7 +98,7 @@

const usdcBalance = useWalletUSDCBalance();
const ethBalance = useWalletETHBalance();
const fundWallet = usePrivyFundWallet();
const { fundWallet } = usePrivyFundWallet();
const [showExplanation, setShowExplanation] = useState(false);
const priceToBuyNext = useCreatorTokenPriceToBuyNext(
selectedAction === "buy"
Expand Down
4 changes: 2 additions & 2 deletions packages/app/components/profile/creator-tokens-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export const CreatorTokensPanel = ({

const usdcBalance = useWalletUSDCBalance();
const ethBalance = useWalletETHBalance();
const fundWallet = usePrivyFundWallet();
const { fundWallet, isAvailable } = usePrivyFundWallet();

if (isSelf) {
return (
Expand Down Expand Up @@ -193,7 +193,7 @@ export const CreatorTokensPanel = ({
<Text tw="text-base font-bold text-gray-900 dark:text-white">
{ethBalance.data?.displayBalance}
</Text>
{Platform.OS === "web" ? (
{Platform.OS === "web" && isAvailable ? (
<Button onPress={() => fundWallet("eth")}>Buy ETH</Button>
) : null}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const useCreatorTokenSell = () => {
const { getMaxFeePerGasAndPriorityPrice } = useMaxGasPrices();
const user = useContext(UserContext);
const { loginPromise } = useLogInPromise();
const fundWallet = usePrivyFundWallet();
const { fundWallet } = usePrivyFundWallet();
const state = useSWRMutation(
"sellToken",
async (
Expand Down
2 changes: 1 addition & 1 deletion packages/app/lib/privy/privy-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
};

export const usePrivyFundWallet = () => {
const fundWallet = (currencyCode: "eth" | "usdc") => {};

Check warning on line 9 in packages/app/lib/privy/privy-hooks.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/lib/privy/privy-hooks.ts#L9

[unused-imports/no-unused-vars] 'currencyCode' is defined but never used. Allowed unused args must match /^_/u.

return fundWallet;
return { fundWallet, isAvailable: false };
};
5 changes: 4 additions & 1 deletion packages/app/lib/privy/privy-hooks.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ export const usePrivyFundWallet = () => {
});
};

return fundWallet;
return {
fundWallet,
isAvailable: wallets?.[0]?.walletClientType === "privy",
};
};
Loading