2
0

feat: ️ Add docs and connect Stripe

This commit is contained in:
Baptiste Arnaud
2022-02-14 16:41:39 +01:00
parent aeb3e4caa7
commit 56bd5fafc3
50 changed files with 6332 additions and 685 deletions

View File

@ -31,10 +31,12 @@ type UpgradeModalProps = {
export const UpgradeModal = ({ type, onClose, isOpen }: UpgradeModalProps) => {
const { user } = useUser()
const [payLoading, setPayLoading] = useState(false)
const [userLanguage, setUserLanguage] = useState<string>('en')
const [currency, setCurrency] = useState<'usd' | 'eur'>('usd')
useEffect(() => {
setUserLanguage(navigator.language.toLowerCase())
setCurrency(
navigator.languages.find((l) => l.includes('fr')) ? 'eur' : 'usd'
)
}, [])
let limitLabel
@ -55,7 +57,7 @@ export const UpgradeModal = ({ type, onClose, isOpen }: UpgradeModalProps) => {
const handlePayClick = async () => {
if (!user) return
setPayLoading(true)
await pay(user)
await pay(user, currency)
}
return (
@ -73,7 +75,7 @@ export const UpgradeModal = ({ type, onClose, isOpen }: UpgradeModalProps) => {
)}
<PricingCard
data={{
price: userLanguage.includes('fr') ? '25€' : '$30',
price: currency === 'eur' ? '25€' : '$30',
name: 'Pro plan',
features: [
'Branding removed',