From 031e8ef9596725498f5003fdb61e87cde6651a31 Mon Sep 17 00:00:00 2001 From: Anil Kumar Rai Date: Thu, 17 Nov 2022 20:09:40 +0530 Subject: [PATCH] added gov portal role list modal --- src/components/Governance/AddressInfoCard.tsx | 21 +++- src/components/Governance/RoleListModal.tsx | 109 ++++++++++++++++++ src/components/Governance/index.tsx | 21 +++- 3 files changed, 142 insertions(+), 9 deletions(-) create mode 100644 src/components/Governance/RoleListModal.tsx diff --git a/src/components/Governance/AddressInfoCard.tsx b/src/components/Governance/AddressInfoCard.tsx index 3e4c8e446..0ab74b1c8 100644 --- a/src/components/Governance/AddressInfoCard.tsx +++ b/src/components/Governance/AddressInfoCard.tsx @@ -1,4 +1,4 @@ -import { Grid, Link, makeStyles, Typography } from '@material-ui/core'; +import { Box, Grid, Link, makeStyles, Typography } from '@material-ui/core'; import ArrowUpward from '@material-ui/icons/ArrowUpward'; import { observer } from 'mobx-react-lite'; import React from 'react'; @@ -6,7 +6,8 @@ import React from 'react'; export interface AddressInfoCardProps { title: string; address?: string; - linkAddress: string; + linkAddress?: string; + onClick?: () => void; } const useStyles = makeStyles(() => ({ @@ -14,6 +15,7 @@ const useStyles = makeStyles(() => ({ display: 'inline-block', transform: 'rotate(45deg)', color: 'white', + cursor: 'pointer', }, address: { maxWidth: '100px', @@ -23,7 +25,7 @@ const useStyles = makeStyles(() => ({ const AddressInfoCard: React.FC = observer((props: AddressInfoCardProps) => { const classes = useStyles(); - const { title, address, linkAddress } = props; + const { title, address, linkAddress, onClick } = props; return (
@@ -35,9 +37,16 @@ const AddressInfoCard: React.FC = observer((props: Address {address} - - - + {linkAddress && ( + + + + )} + {!linkAddress && onClick && ( + + + + )}
diff --git a/src/components/Governance/RoleListModal.tsx b/src/components/Governance/RoleListModal.tsx new file mode 100644 index 000000000..3ddfc4285 --- /dev/null +++ b/src/components/Governance/RoleListModal.tsx @@ -0,0 +1,109 @@ +import { + Box, + Dialog, + DialogContent, + DialogTitle, + IconButton, + makeStyles, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + Theme, + Typography, +} from '@material-ui/core'; +import CloseIcon from '@material-ui/icons/Close'; +import { StoreContext } from 'mobx/stores/store-context'; +import { useContext, useEffect } from 'react'; + +const useStyles = makeStyles((theme: Theme) => ({ + root: { + color: 'rgba(255,255,255,0.6)', + paddingTop: 0, + paddingBottom: 30, + }, + title: { + padding: 20, + }, + titleText: { + display: 'flex', + alignItems: 'center', + '& img': { + marginRight: 10, + }, + }, + closeButton: { + position: 'absolute', + right: theme.spacing(1), + top: theme.spacing(1), + }, +})); + +const rows: { role: string; link: string }[] = []; + +interface RoleListTypes { + open: boolean; + onModalClose: () => void; +} + +const GovernanceRoleList = ({ open, onModalClose }: RoleListTypes) => { + const classes = useStyles(); + + const { sdk } = useContext(StoreContext); + + useEffect(() => { + async function lol() { + const res = await sdk.governance.timelockController; + console.log(res.callStatic); + } + lol(); + }, []); + + return ( + + + + + Council Roles + + + + + + + + + + + + Role + Etherscan Link + + + + {rows.map((row) => ( + + + {row.role} + + {row.link} + + ))} + +
+
+
+
+ ); +}; + +export default GovernanceRoleList; diff --git a/src/components/Governance/index.tsx b/src/components/Governance/index.tsx index 7d10b3912..a582d8028 100644 --- a/src/components/Governance/index.tsx +++ b/src/components/Governance/index.tsx @@ -8,11 +8,13 @@ import PageHeader from '../../components-v2/common/PageHeader'; import AddressInfoCard from './AddressInfoCard'; import EventsTable from './EventsTable'; import GovernanceFilterDialog from './GovernanceFilterDialog'; +import GovernanceRoleList from './RoleListModal'; const GovernancePortal = observer(() => { const store = useContext(StoreContext); const { governancePortal } = store; const [showGovernanceFilters, setShowGovernanceFilters] = useState(false); + const [showGovernanceRoleList, setShowGovernanceRoleList] = useState(false); const [filters, setFilters] = useState([]); useEffect(() => { governancePortal.loadData(); @@ -26,14 +28,19 @@ const GovernancePortal = observer(() => { const toggleShowDialog = () => { setShowGovernanceFilters(!showGovernanceFilters); }; + + const clickHandler = () => { + setShowGovernanceRoleList(true); + }; + return ( - + - + { /> - + + + + + @@ -57,6 +68,10 @@ const GovernancePortal = observer(() => { + setShowGovernanceRoleList(!showGovernanceRoleList)} + />