Remove unused code
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {Linking, View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useCreateCheckout} from '#/state/purchases/subscriptions/useCreateCheckout'
|
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
import {atoms as a, tokens, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
@@ -14,7 +13,6 @@ import {GradientFill} from '#/components/GradientFill'
|
|||||||
import {Full as BlueskyPlusLogo} from '#/components/icons/BlueskyPlus'
|
import {Full as BlueskyPlusLogo} from '#/components/icons/BlueskyPlus'
|
||||||
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron'
|
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/components/icons/Chevron'
|
||||||
import {InlineLinkText} from '#/components/Link'
|
import {InlineLinkText} from '#/components/Link'
|
||||||
import {Loader} from '#/components/Loader'
|
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
export function SubscriptionsDialog({
|
export function SubscriptionsDialog({
|
||||||
@@ -36,25 +34,9 @@ function DialogInner() {
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [plan, setPlan] = React.useState<'monthly' | 'annual'>('monthly')
|
const [plan, setPlan] = React.useState<'monthly' | 'annual'>('monthly')
|
||||||
|
|
||||||
const {mutateAsync: createCheckout, isPending} = useCreateCheckout()
|
|
||||||
|
|
||||||
const onPressSubscribe = async () => {
|
const onPressSubscribe = async () => {
|
||||||
try {
|
try {
|
||||||
if (!currentAccount) return
|
if (!currentAccount) return
|
||||||
const data = await createCheckout({
|
|
||||||
did: currentAccount.did,
|
|
||||||
email: currentAccount.email!,
|
|
||||||
price:
|
|
||||||
plan === 'monthly'
|
|
||||||
? 'price_1QLsNLAwTlpRxHkAhuUwbnlL'
|
|
||||||
: 'price_1QLsOjAwTlpRxHkAcrV8DL2P',
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!data?.checkoutUrl) {
|
|
||||||
throw new Error('No checkout URL')
|
|
||||||
}
|
|
||||||
|
|
||||||
Linking.openURL(data.checkoutUrl)
|
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
Toast.show(_(msg`Could not take you to checkout`), 'xmark')
|
Toast.show(_(msg`Could not take you to checkout`), 'xmark')
|
||||||
}
|
}
|
||||||
@@ -181,12 +163,11 @@ function DialogInner() {
|
|||||||
variant="solid"
|
variant="solid"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="large"
|
size="large"
|
||||||
onPress={onPressSubscribe}
|
onPress={onPressSubscribe}>
|
||||||
disabled={isPending}>
|
|
||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Subscribe</Trans>
|
<Trans>Subscribe</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
<ButtonIcon icon={isPending ? Loader : ChevronRightIcon} />
|
<ButtonIcon icon={ChevronRightIcon} />
|
||||||
</Button>
|
</Button>
|
||||||
<Text>
|
<Text>
|
||||||
<InlineLinkText to="#" label="TODO REPLACE">
|
<InlineLinkText to="#" label="TODO REPLACE">
|
||||||
|
|||||||
Reference in New Issue
Block a user