-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from AAISS/fix/small-defects
feat: loading spinners on my-account and payment-callback pages
- Loading branch information
Showing
4 changed files
with
115 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 101 additions & 78 deletions
179
frontend/src/pages/payment-callback/PaymentCallbackPage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,108 @@ | ||
import { Button } from '@mui/material'; | ||
import {Button, CircularProgress} from '@mui/material'; | ||
import SvgIcon from '@mui/material/SvgIcon'; | ||
import usePaymentCallbackPage from './usePaymentCallbackPage'; | ||
|
||
export default function PaymentCallbackPage() { | ||
const { paymentStatus, paymentResultsData } = usePaymentCallbackPage(); | ||
const {paymentStatus, isLoading, paymentResultsData} = usePaymentCallbackPage(); | ||
|
||
const iconStyles = { | ||
width: '150px', | ||
height: '150px', | ||
marginBottom: 'auto', | ||
marginTop: 'auto', | ||
}; | ||
const iconStyles = { | ||
width: '150px', | ||
height: '150px', | ||
marginBottom: 'auto', | ||
marginTop: 'auto', | ||
}; | ||
|
||
return ( | ||
<section | ||
style={{ | ||
display: 'flex', | ||
flexWrap: 'nowrap', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
minHeight: '60vh', | ||
}} | ||
> | ||
{!paymentStatus && ( | ||
<SvgIcon style={iconStyles}> | ||
<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="12" cy="12" fill="#fd5154" r="10" /> | ||
<path | ||
clipRule="evenodd" | ||
d="m8.44461 9.17169c-.19588-.19464-.19689-.51122-.00224-.7071.19464-.19588.51122-.19689.7071-.00225l2.85073 2.83266 2.8502-2.83217c.1959-.19464.5125-.19363.7071.00225.1947.19588.1937.51246-.0022.7071l-2.8457 2.82772 2.8457 2.8277c.1959.1947.1969.5112.0023.7071-.1947.1959-.5113.1969-.7071.0023l-2.8503-2.8323-2.85077 2.8328c-.19589.1946-.51247.1936-.70711-.0023s-.19363-.5125.00225-.7071l2.84623-2.8282z" | ||
fill="#fff" | ||
fillRule="evenodd" | ||
/> | ||
</svg> | ||
</SvgIcon> | ||
)} | ||
{paymentStatus && ( | ||
<SvgIcon style={iconStyles}> | ||
<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="12" cy="12" fill="#21c179" r="10" /> | ||
<path | ||
clipRule="evenodd" | ||
d="m16.6766 8.58327c.1936.19698.1908.51355-.0062.70708l-5.7054 5.60545c-.1914.1881-.4972.1915-.6927.0078l-2.67382-2.5115c-.20128-.189-.21118-.5055-.02212-.7067.18906-.2013.50548-.2112.70676-.0222l2.32368 2.1827 5.3628-5.26888c.1969-.19353.5135-.19073.707.00625z" | ||
fill="#fff" | ||
fillRule="evenodd" | ||
/> | ||
</svg> | ||
</SvgIcon> | ||
)} | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
width: '70vw', | ||
maxWidth: '700px', | ||
borderTop: '2px solid grey', | ||
borderLeft: '2px solid grey', | ||
backgroundColor: 'rgba(126,126,126,0.2)', | ||
padding: '10px', | ||
borderRadius: '10px', | ||
}} | ||
> | ||
{paymentResultsData && | ||
Object.keys(paymentResultsData).map((key, index) => ( | ||
<div | ||
key={index} | ||
style={{ | ||
display: 'flex', | ||
flexWrap: 'nowrap', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<h3>{key}</h3> | ||
<p>{paymentResultsData[key]}</p> | ||
</div> | ||
))} | ||
</div> | ||
<Button variant="contained" sx={{ mt: 5 }} href="/"> | ||
Back to Home Page | ||
</Button> | ||
</section> | ||
); | ||
return ( | ||
<> | ||
{isLoading && | ||
<section style={{ | ||
minHeight: '60vh', | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center" | ||
}}> | ||
<div style={{ | ||
flex: '1', | ||
textAlign: "center", | ||
}}> | ||
<CircularProgress/> | ||
</div> | ||
</section>} | ||
{!isLoading && | ||
<section | ||
style={{ | ||
display: 'flex', | ||
flexWrap: 'nowrap', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
minHeight: '60vh', | ||
}} | ||
> | ||
{!paymentStatus && ( | ||
<SvgIcon style={iconStyles}> | ||
<svg fill="none" height="24" viewBox="0 0 24 24" width="24" | ||
xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="12" cy="12" fill="#fd5154" r="10"/> | ||
<path | ||
clipRule="evenodd" | ||
d="m8.44461 9.17169c-.19588-.19464-.19689-.51122-.00224-.7071.19464-.19588.51122-.19689.7071-.00225l2.85073 2.83266 2.8502-2.83217c.1959-.19464.5125-.19363.7071.00225.1947.19588.1937.51246-.0022.7071l-2.8457 2.82772 2.8457 2.8277c.1959.1947.1969.5112.0023.7071-.1947.1959-.5113.1969-.7071.0023l-2.8503-2.8323-2.85077 2.8328c-.19589.1946-.51247.1936-.70711-.0023s-.19363-.5125.00225-.7071l2.84623-2.8282z" | ||
fill="#fff" | ||
fillRule="evenodd" | ||
/> | ||
</svg> | ||
</SvgIcon> | ||
)} | ||
{paymentStatus && ( | ||
<SvgIcon style={iconStyles}> | ||
<svg fill="none" height="24" viewBox="0 0 24 24" width="24" | ||
xmlns="http://www.w3.org/2000/svg"> | ||
<circle cx="12" cy="12" fill="#21c179" r="10"/> | ||
<path | ||
clipRule="evenodd" | ||
d="m16.6766 8.58327c.1936.19698.1908.51355-.0062.70708l-5.7054 5.60545c-.1914.1881-.4972.1915-.6927.0078l-2.67382-2.5115c-.20128-.189-.21118-.5055-.02212-.7067.18906-.2013.50548-.2112.70676-.0222l2.32368 2.1827 5.3628-5.26888c.1969-.19353.5135-.19073.707.00625z" | ||
fill="#fff" | ||
fillRule="evenodd" | ||
/> | ||
</svg> | ||
</SvgIcon> | ||
)} | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
width: '70vw', | ||
maxWidth: '700px', | ||
borderTop: '2px solid grey', | ||
borderLeft: '2px solid grey', | ||
backgroundColor: 'rgba(126,126,126,0.2)', | ||
padding: '10px', | ||
borderRadius: '10px', | ||
}} | ||
> | ||
{paymentResultsData && | ||
Object.keys(paymentResultsData).map((key, index) => ( | ||
<div | ||
key={index} | ||
style={{ | ||
display: 'flex', | ||
flexWrap: 'nowrap', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}} | ||
> | ||
<h3>{key}</h3> | ||
<p style={{ | ||
padding: '0px 0px 5px 20px', | ||
}}>{paymentResultsData[key]}</p> | ||
</div> | ||
))} | ||
</div> | ||
<Button variant="contained" sx={{mt: 5}} href="/"> | ||
Back to Home Page | ||
</Button> | ||
</section> | ||
} | ||
</> | ||
) | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters