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

Commit

Permalink
Fix/creator token buy modal issues (#2495)
Browse files Browse the repository at this point in the history
* fix: some UI issues with creator token buy modal

* remove unuseful code

* add a default creator token pic

* fix
  • Loading branch information
alantoa committed Nov 1, 2023
1 parent f71740e commit 49b79e8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 27 deletions.
60 changes: 34 additions & 26 deletions packages/app/components/creator-token/buy-creator-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ type Query = {

const { useParam } = createParam<Query>();
// Disable ETH payment on dev for now because it doesn't support the dev environment yet.
const PAYMENT_METHODS = __DEV__
? [
{
title: "USDC",
value: "USDC",
},
]
: [
{
title: "ETH",
value: "ETH",
},
{
title: "USDC",
value: "USDC",
},
];
const BUY_PAYMENTS = [
{
title: "ETH",
value: "ETH",
},
{
title: "USDC",
value: "USDC",
},
];
const SELL_PAYMENTS = [
{
title: "USDC",
value: "USDC",
},
];

const SELECT_LIST = [
{
title: "Buy",
Expand Down Expand Up @@ -168,6 +168,7 @@ export const BuyCreatorToken = () => {
"https://app.uniswap.org/swap?outputCurrency=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&chain=base"
)
}
size="regular"
>
Buy USDC on Uniswap
</Button>
Expand All @@ -180,6 +181,7 @@ export const BuyCreatorToken = () => {
return (
<Button
onPress={() => Linking.openURL("https://bridge.base.org/deposit")}
size="regular"
>
Bridge ETH to Base
</Button>
Expand Down Expand Up @@ -262,15 +264,21 @@ export const BuyCreatorToken = () => {
<Avatar size={100} url={profileData?.data?.profile.img_url} />
<View tw="flex-1" style={{ rowGap: 16 }}>
<View tw="w-full flex-row items-center justify-between">
<Toggle
options={
selectedAction === "buy"
? PAYMENT_METHODS
: PAYMENT_METHODS.filter((m) => m.value === "USDC")
}
value={paymentMethod}
onChange={(value: any) => setPaymentMethod(value)}
/>
{selectedAction === "buy" ? (
<Toggle
options={BUY_PAYMENTS}
value={paymentMethod}
onChange={(value: any) => setPaymentMethod(value)}
key="BUY_PAYMENTS"
/>
) : (
<Toggle
options={SELL_PAYMENTS}
value={paymentMethod}
onChange={(value: any) => setPaymentMethod(value)}
key="SELL_PAYMENTS"
/>
)}
<Pressable
onPress={() => {
setShowExplanation(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export const SelfServeExplainer = () => {
const isDark = useIsDarkMode();
const { user } = useUser();
const { top } = useSafeAreaInsets();
const userProfilePic = user?.data.profile.img_url;
const userProfilePic =
user?.data.profile.img_url ||
"https://media.showtime.xyz/assets/default-creator-token-pic.png";

const [profilePic, setProfilePic] = useState<string | undefined | File>(
userProfilePic
Expand Down
1 change: 1 addition & 0 deletions packages/app/hooks/use-wallet-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useWallet } from "./use-wallet/use-wallet";
export const useWalletETHBalance = () => {
const wallet = useWallet();
const res = useSWR("ethBalance" + wallet.address, async () => {
if (__DEV__) return { balance: 0, displayBalance: "0" };
if (wallet.address) {
const res = (await publicClient.getBalance({
address: wallet.address,
Expand Down
3 changes: 3 additions & 0 deletions packages/design-system/toggle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Animated, {
useAnimatedStyle,
withTiming,
useSharedValue,
FadeIn,
Layout,
} from "react-native-reanimated";

import { useIsDarkMode } from "@showtime-xyz/universal.hooks";
Expand Down Expand Up @@ -71,6 +73,7 @@ export const Toggle = ({
backgroundColor: isDark ? colors.white : colors.gray[900],
},
]}
entering={FadeIn}
/>
) : null}
{options.map((item, index) => (
Expand Down

0 comments on commit 49b79e8

Please sign in to comment.