Skip to content

Commit

Permalink
Merge pull request #44 from AAISS/fix/my-account-page-issues
Browse files Browse the repository at this point in the history
fix: my account page issues
  • Loading branch information
KimiaMontazeri authored Nov 29, 2023
2 parents af49600 + fa5bda3 commit 5b2df2e
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions frontend/src/pages/my-account/MyAccount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ import useMyAccount from './useMyAccount.js';
const TAB_ITEMS = ['Workshops', 'Presentations', 'Cart'];

const MyAccount = () => {
const { talks, workshops, handleBuyCart, buyButtonLoading, cart, removeFromCartHandler, toastData, openToast, setOpenToast } = useMyAccount();
const {
talks,
workshops,
handleBuyCart,
buyButtonLoading,
cart,
removeFromCartHandler,
toastData,
openToast,
setOpenToast,
} = useMyAccount();
const [tabValue, setTabValue] = useState(TAB_ITEMS[0]);

const handleChangeTab = (event, newValue) => {
Expand Down Expand Up @@ -64,14 +74,14 @@ const MyAccount = () => {
return items.map((item, index) => (
<ItemCard
key={index}
isWorkshop={type === 'Workshops'}
isWorkshop={item.type === 'workshop'}
purchaseState={type === 'Cart' ? 1 : 2}
title={item.name}
description={item.desc}
level={item.level}
startDate={item.start_date}
endDate={item.end_date}
presenterName={item.presenters?.join(", ") ?? item.teachers?.join(", ")}
presenterName={item.presenters?.join(', ') ?? item.teachers?.join(', ')}
cost={item.cost}
hasProject={item.has_project}
prerequisites={item.prerequisites}
Expand Down Expand Up @@ -121,9 +131,15 @@ const MyAccount = () => {
<Divider sx={{ my: 2 }} />
<Stack alignItems="center" gap={1}>
<Typography>Total: {calculateTotalCost()} T</Typography>
<Button onClick={handleBuyCart} variant="contained" sx={{ px: 4 }} disabled={buyButtonLoading || calculateTotalCost() === 0}>
{!buyButtonLoading && "Buy"}
{buyButtonLoading && <CircularProgress/>}
<Button
onClick={handleBuyCart}
variant="contained"
sx={{ px: 4 }}
// disabled={buyButtonLoading || calculateTotalCost() === 0}
disabled
>
{!buyButtonLoading && 'Buy'}
{buyButtonLoading && <CircularProgress />}
</Button>
</Stack>
</>
Expand Down

0 comments on commit 5b2df2e

Please sign in to comment.