-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* purchase history table * small adjustments * handle no data --------- Co-authored-by: Sergej <[email protected]>
- Loading branch information
Showing
23 changed files
with
461 additions
and
84 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
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Button } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
interface LinkProps { | ||
href: string; | ||
target?: string; | ||
children: React.ReactNode; | ||
} | ||
|
||
export const Link = ({ href, target = '_blank', children }: LinkProps) => { | ||
const onClick = () => { | ||
if (!href) return; | ||
window.open(href, target); | ||
}; | ||
|
||
return <Button onClick={onClick}>{children}</Button>; | ||
}; |
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
10 changes: 10 additions & 0 deletions
10
src/components/Modals/Regions/PurchaseHistory/index.module.scss
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 0.75rem; | ||
width: 55rem; | ||
} | ||
|
||
.tableContainer { | ||
overflow-y: auto; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { Warning } from '@mui/icons-material'; | ||
import { | ||
Box, | ||
CircularProgress, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
Stack, | ||
Typography, | ||
useTheme, | ||
} from '@mui/material'; | ||
import React from 'react'; | ||
|
||
import { usePurchaseHistory } from '@/hooks'; | ||
|
||
import { ActionButton } from '@/components/Elements'; | ||
import { PurchaseHistoryTable } from '@/components/Tables'; | ||
|
||
import { useNetwork } from '@/contexts/network'; | ||
import { useSaleInfo } from '@/contexts/sales'; | ||
|
||
import styles from './index.module.scss'; | ||
|
||
interface PurchaseHistoryModalProps { | ||
open: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
export const PurchaseHistoryModal = ({ | ||
open, | ||
onClose, | ||
}: PurchaseHistoryModalProps) => { | ||
const theme = useTheme(); | ||
const { network } = useNetwork(); | ||
const { | ||
saleInfo: { regionBegin }, | ||
} = useSaleInfo(); | ||
const { loading, data, isError } = usePurchaseHistory( | ||
network, | ||
regionBegin, | ||
0, | ||
20 | ||
); | ||
|
||
return ( | ||
<Dialog open={open} onClose={onClose} maxWidth='md'> | ||
<DialogContent className={styles.container}> | ||
<Box> | ||
<Typography | ||
variant='subtitle1' | ||
sx={{ color: theme.palette.common.black }} | ||
> | ||
Purchase History | ||
</Typography> | ||
<Typography | ||
variant='subtitle2' | ||
sx={{ color: theme.palette.text.primary }} | ||
> | ||
Get an insight into all purchases and renewals made during the | ||
current bulk period. | ||
</Typography> | ||
</Box> | ||
<Box> | ||
{loading || isError ? ( | ||
<Stack | ||
alignItems='center' | ||
minHeight='10rem' | ||
justifyContent='center' | ||
> | ||
{loading ? ( | ||
<CircularProgress /> | ||
) : ( | ||
<Stack alignItems='center' direction='row' gap='1rem'> | ||
<Warning color='error' /> | ||
<Typography>Failed to fetch purchase history</Typography> | ||
</Stack> | ||
)} | ||
</Stack> | ||
) : ( | ||
<Box className={styles.tableContainer}> | ||
<PurchaseHistoryTable data={data} /> | ||
</Box> | ||
)} | ||
</Box> | ||
</DialogContent> | ||
<DialogActions> | ||
<Box> | ||
<ActionButton label='Close' onClick={onClose} disabled={loading} /> | ||
</Box> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; |
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
2 changes: 1 addition & 1 deletion
2
src/components/Panels/SaleInfoPanel/DetailCard/index.module.scss
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
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,5 +1,4 @@ | ||
export * from './CoreExpiryCard'; | ||
export * from './LeaseStateCard'; | ||
export * from './ParachainTable'; | ||
export * from './ParaDisplay'; | ||
export * from './ParaStateCard'; |
File renamed without changes.
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
Oops, something went wrong.