-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display all tabs on public profile (#2141)
- Loading branch information
Showing
12 changed files
with
205 additions
and
75 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
85 changes: 85 additions & 0 deletions
85
web-marketplace/src/pages/Dashboard/MyCreditBatches/MyCreditBatches.Table.tsx
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,85 @@ | ||
import { Link } from 'react-router-dom'; | ||
import { useTheme } from '@mui/material'; | ||
import { Box } from '@mui/system'; | ||
|
||
import OutlinedButton from 'web-components/lib/components/buttons/OutlinedButton'; | ||
import PlusIcon from 'web-components/lib/components/icons/PlusIcon'; | ||
import { TablePaginationParams } from 'web-components/lib/components/table/ActionsTable'; | ||
import { Subtitle } from 'web-components/lib/components/typography'; | ||
|
||
import { BatchInfoWithSupply } from 'types/ledger/ecocredit'; | ||
import { UseStateSetter } from 'types/react/use-state'; | ||
|
||
import WithLoader from 'components/atoms/WithLoader'; | ||
import { CreditBatches } from 'components/organisms'; | ||
|
||
type Props = { | ||
hasNoBatches?: boolean; | ||
batchesWithSupply?: BatchInfoWithSupply[]; | ||
paginationParams: TablePaginationParams; | ||
setPaginationParams: UseStateSetter<TablePaginationParams>; | ||
useCreate?: boolean; | ||
}; | ||
|
||
export const MyCreditBatchesTable = ({ | ||
hasNoBatches, | ||
batchesWithSupply, | ||
paginationParams, | ||
setPaginationParams, | ||
useCreate, | ||
}: Props) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<WithLoader | ||
isLoading={batchesWithSupply === undefined} | ||
sx={{ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
flexDirection: 'col', | ||
alignItems: 'center', | ||
}} | ||
> | ||
<> | ||
<Box | ||
sx={{ | ||
display: hasNoBatches ? 'none' : 'flex', | ||
flexDirection: ['column', 'row'], | ||
justifyContent: 'space-between', | ||
alignItems: ['flex-start', 'center'], | ||
backgroundColor: 'primary.main', | ||
px: 6.25, | ||
py: 6.25, | ||
border: theme => `1px solid ${theme.palette.info.light}`, | ||
borderRadius: '8px 8px 0 0', | ||
}} | ||
> | ||
<Subtitle | ||
sx={{ | ||
color: 'primary.contrastText', | ||
}} | ||
size="xl" | ||
> | ||
Successfully issued credit batches | ||
</Subtitle> | ||
{useCreate && ( | ||
<OutlinedButton | ||
startIcon={<PlusIcon color={theme.palette.secondary.main} />} | ||
component={Link} | ||
to="/ecocredits/create-batch" | ||
> | ||
create credit batch | ||
</OutlinedButton> | ||
)} | ||
</Box> | ||
<CreditBatches | ||
creditBatches={batchesWithSupply} | ||
onTableChange={setPaginationParams} | ||
initialPaginationParams={paginationParams} | ||
isIgnoreOffset | ||
sx={{ root: { borderTop: 0 } }} | ||
/> | ||
</> | ||
</WithLoader> | ||
); | ||
}; |
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
1 change: 1 addition & 0 deletions
1
web-marketplace/src/pages/EcocreditsByAccount/CreditBatchesTab/CreditBatchesTab.constants.ts
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 @@ | ||
export const PROFILE_NO_CREDIT_BATCHES_MESSAGE = 'No credit batches to display'; |
27 changes: 27 additions & 0 deletions
27
web-marketplace/src/pages/EcocreditsByAccount/CreditBatchesTab/CreditBatchesTab.tsx
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,27 @@ | ||
import { Box } from '@mui/system'; | ||
|
||
import { MyCreditBatchesTable } from 'pages/Dashboard/MyCreditBatches/MyCreditBatches.Table'; | ||
import { useFetchPaginatedBatches } from 'hooks/batches/useFetchPaginatedBatches'; | ||
|
||
import { useProfileData } from '../hooks/useProfileData'; | ||
|
||
export const CreditBatchesTab = () => { | ||
const { address } = useProfileData(); | ||
const { batchesWithSupply, setPaginationParams, paginationParams } = | ||
useFetchPaginatedBatches({ | ||
address, | ||
}); | ||
|
||
const hasNoBatches = batchesWithSupply && batchesWithSupply?.length === 0; | ||
|
||
return ( | ||
<Box sx={{ width: '100%' }}> | ||
<MyCreditBatchesTable | ||
hasNoBatches={hasNoBatches} | ||
paginationParams={paginationParams} | ||
setPaginationParams={setPaginationParams} | ||
batchesWithSupply={batchesWithSupply} | ||
/> | ||
</Box> | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
web-marketplace/src/pages/EcocreditsByAccount/CreditClassTab/CreditClassTab.tsx
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,9 @@ | ||
import { Grid } from '@mui/material'; | ||
|
||
export const CreditClassTab = () => { | ||
return ( | ||
<Grid container spacing={8}> | ||
<Grid item xs={12} md={6} lg={4}></Grid> | ||
</Grid> | ||
); | ||
}; |
Oops, something went wrong.