refactor(web): remove typescript

This commit is contained in:
Ali BARIN
2024-02-27 15:23:23 +00:00
parent 636870a075
commit b3ae2d2748
337 changed files with 2067 additions and 4997 deletions

View File

@@ -14,30 +14,27 @@ import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Paper from '@mui/material/Paper';
import LockIcon from '@mui/icons-material/Lock';
import usePaymentPlans from 'hooks/usePaymentPlans.ee';
import useCurrentUser from 'hooks/useCurrentUser';
import usePaddle from 'hooks/usePaddle.ee';
export default function UpgradeFreeTrial() {
const { plans, loading } = usePaymentPlans();
const currentUser = useCurrentUser();
const { loaded: paddleLoaded } = usePaddle();
const [selectedIndex, setSelectedIndex] = React.useState(0);
const selectedPlan = plans?.[selectedIndex];
const updateSelection = (index: number) => setSelectedIndex(index);
const updateSelection = (index) => setSelectedIndex(index);
const handleCheckout = React.useCallback(() => {
window.Paddle.Checkout?.open({
product: selectedPlan.productId,
email: currentUser.email,
passthrough: JSON.stringify({ id: currentUser.id, email: currentUser.email })
})
passthrough: JSON.stringify({
id: currentUser.id,
email: currentUser.email,
}),
});
}, [selectedPlan, currentUser]);
if (loading || !plans.length) return null;
return (
<React.Fragment>
<Card sx={{ mb: 3, p: 2 }}>
@@ -91,15 +88,20 @@ export default function UpgradeFreeTrial() {
onClick={() => updateSelection(index)}
sx={{
'&:hover': { cursor: 'pointer' },
backgroundColor: selectedIndex === index ? '#f1f3fa' : 'white',
border: selectedIndex === index ? '2px solid #0059f7' : 'none',
backgroundColor:
selectedIndex === index ? '#f1f3fa' : 'white',
border:
selectedIndex === index
? '2px solid #0059f7'
: 'none',
}}
>
<TableCell component="th" scope="row" sx={{ py: 2 }}>
<Typography
variant="subtitle2"
sx={{
fontWeight: selectedIndex === index ? 'bold' : 'normal',
fontWeight:
selectedIndex === index ? 'bold' : 'normal',
}}
>
{plan.limit}
@@ -109,7 +111,8 @@ export default function UpgradeFreeTrial() {
<Typography
variant="subtitle2"
sx={{
fontWeight: selectedIndex === index ? 'bold' : 'normal',
fontWeight:
selectedIndex === index ? 'bold' : 'normal',
}}
>
{plan.price} / month