|
|
|
|
|
|
|
|
import { Alert, Grid, Snackbar, Typography } from '@mui/material'; |
|
|
|
|
|
|
|
|
import { Alert, Snackbar, Typography } from '@mui/material'; |
|
|
import { Box } from '@mui/system'; |
|
|
import { Box } from '@mui/system'; |
|
|
import { useSession } from 'next-auth/react'; |
|
|
import { useSession } from 'next-auth/react'; |
|
|
import { useState } from 'react'; |
|
|
import { useState } from 'react'; |
|
|
|
|
|
|
|
|
import { useUserUpdate } from '../../store/user-context'; |
|
|
import { useUserUpdate } from '../../store/user-context'; |
|
|
import OrderCard from '../cards/order-card/OrderCard'; |
|
|
import OrderCard from '../cards/order-card/OrderCard'; |
|
|
import ShippingDetailsForm from '../forms/shipping-details/ShippingDetailsForm'; |
|
|
import ShippingDetailsForm from '../forms/shipping-details/ShippingDetailsForm'; |
|
|
|
|
|
import StepTitle from '../layout/steps-title/StepTitle'; |
|
|
|
|
|
|
|
|
const ProfileContent = ({ orders }) => { |
|
|
const ProfileContent = ({ orders }) => { |
|
|
const { data: session } = useSession(); |
|
|
const { data: session } = useSession(); |
|
|
|
|
|
|
|
|
)); |
|
|
)); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<Grid container spacing={2} sx={{ py: 10, height: '100%', width: '100%' }}> |
|
|
|
|
|
|
|
|
<Box sx={{ py: 10, height: '100%', width: '100%' }}> |
|
|
|
|
|
<StepTitle title="Items in Your Cart" /> |
|
|
<Snackbar |
|
|
<Snackbar |
|
|
anchorOrigin={{ vertical: 'top', horizontal: 'center' }} |
|
|
anchorOrigin={{ vertical: 'top', horizontal: 'center' }} |
|
|
open={open} |
|
|
open={open} |
|
|
|
|
|
|
|
|
User profile updated! |
|
|
User profile updated! |
|
|
</Alert> |
|
|
</Alert> |
|
|
</Snackbar> |
|
|
</Snackbar> |
|
|
<Grid item xs={12}> |
|
|
|
|
|
<Typography |
|
|
|
|
|
variant="h3" |
|
|
|
|
|
sx={{ pl: 12, mt: 12, height: '100%', color: 'primary.main' }} |
|
|
|
|
|
> |
|
|
|
|
|
Welcome to your user account |
|
|
|
|
|
</Typography> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={12} md={8} sx={{ mt: 4, mb: { xs: -2, md: 0 } }}> |
|
|
|
|
|
<Typography sx={{ pl: 12, fontSize: 20 }}> |
|
|
|
|
|
Save details for later |
|
|
|
|
|
</Typography> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={4} sx={{ mt: 4, display: { xs: 'none', md: 'block' } }}> |
|
|
|
|
|
<Typography sx={{ fontSize: 20, ml: 8 }}>Previous Orders</Typography> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid |
|
|
|
|
|
item |
|
|
|
|
|
xs={12} |
|
|
|
|
|
md={8} |
|
|
|
|
|
sx={{ ml: { sm: 12, xs: 6 }, mr: { md: -12 }, pr: { sm: 12, xs: 6 } }} |
|
|
|
|
|
> |
|
|
|
|
|
<ShippingDetailsForm |
|
|
|
|
|
submitHandler={updateUserHandler} |
|
|
|
|
|
enableBtn={enableBtn} |
|
|
|
|
|
></ShippingDetailsForm> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid |
|
|
|
|
|
item |
|
|
|
|
|
xs={12} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Box |
|
|
sx={{ |
|
|
sx={{ |
|
|
mt: 4, |
|
|
|
|
|
display: { xs: 'block', md: 'none' }, |
|
|
|
|
|
textAlign: 'center', |
|
|
|
|
|
|
|
|
display: 'flex', |
|
|
|
|
|
flexDirection: { xs: 'column', md: 'row' }, |
|
|
|
|
|
mr: { xs: 2, md: 12 }, |
|
|
|
|
|
ml: { xs: 2, md: 12 }, |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<Typography sx={{ fontSize: 20, ml: 0 }}>Previous Orders</Typography> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
<Grid item xs={12} md={4}> |
|
|
|
|
|
<Box |
|
|
<Box |
|
|
sx={{ |
|
|
sx={{ |
|
|
width: { sm: '60%', xs: '55%' }, |
|
|
|
|
|
|
|
|
width: { xs: '100%', md: '100%' }, |
|
|
|
|
|
mt: 2, |
|
|
|
|
|
mr: { md: 2 }, |
|
|
|
|
|
mb: { xs: 6 }, |
|
|
|
|
|
}} |
|
|
|
|
|
> |
|
|
|
|
|
<Typography sx={{ fontSize: 20, mb: 3 }}> |
|
|
|
|
|
Save details for later |
|
|
|
|
|
</Typography> |
|
|
|
|
|
<ShippingDetailsForm |
|
|
|
|
|
submitHandler={updateUserHandler} |
|
|
|
|
|
enableBtn={enableBtn} |
|
|
|
|
|
></ShippingDetailsForm> |
|
|
|
|
|
</Box> |
|
|
|
|
|
|
|
|
|
|
|
<Box |
|
|
|
|
|
sx={{ |
|
|
mt: 2, |
|
|
mt: 2, |
|
|
ml: { xs: 12, md: 4 }, |
|
|
|
|
|
|
|
|
maxWidth: { sm: '100%', lg: '10%' }, |
|
|
|
|
|
minWidth: { md: '40%' }, |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
|
|
|
<Typography sx={{ fontSize: 20, mb: 3 }}>Previous Orders</Typography> |
|
|
{mapOrdersToDom()} |
|
|
{mapOrdersToDom()} |
|
|
</Box> |
|
|
</Box> |
|
|
</Grid> |
|
|
|
|
|
</Grid> |
|
|
|
|
|
|
|
|
</Box> |
|
|
|
|
|
</Box> |
|
|
); |
|
|
); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|