Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update table header for more clarity #36

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Table/NodeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const NodeDetails: FC<NodeDetailsProps> = ({ nodeData, onClose }) => {
<Typography variant="subtitle1"><strong>Location:</strong> {`${nodeData.location?.city || ''} ${nodeData.location?.country || ''}`}</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1"><strong>Uptime:</strong> {formatUptime(nodeData.uptime)}</Typography>
<Typography variant="subtitle1"><strong>Eligible Week Uptime:</strong> {formatUptime(nodeData.uptime)}</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1"><strong>Supported Storage:</strong> {formatSupportedStorage(nodeData.supportedStorage)}</Typography>
Expand Down Expand Up @@ -83,7 +83,7 @@ const NodeDetails: FC<NodeDetailsProps> = ({ nodeData, onClose }) => {
</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1"><strong>Reward Eligibility:</strong> {nodeData?.eligible?.toLocaleString()}</Typography>
<Typography variant="subtitle1"><strong>Last Round Eligibility Check:</strong> {nodeData?.eligible?.toLocaleString()}</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1"><strong>Eligiblity Issue:</strong> {nodeData.eligibilityCauseStr?.toLocaleString()}</Typography>
Expand Down
44 changes: 25 additions & 19 deletions src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useDataContext } from '@/context/DataContext'
import NodeDetails from './NodeDetails'
import { Button, Tooltip } from '@mui/material'
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'
import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'
import ReportIcon from '@mui/icons-material/Report';
import CustomToolbar from '../Toolbar'

const getAllNetworks = (indexers: NodeData['indexer']): string => {
Expand Down Expand Up @@ -55,7 +55,7 @@ const getEligibleCheckbox = (eligible: boolean): React.ReactElement => {
return eligible ? (
<CheckCircleOutlineIcon style={{ color: 'green' }} />
) : (
<CancelOutlinedIcon style={{ color: 'red' }} />
<ReportIcon style={{ color: 'orange' }} />
)
}

Expand All @@ -81,7 +81,7 @@ export default function Table() {
{
field: 'index',
renderHeader: () => (
<Tooltip title="The first 50 will receive a soulbound NFT">
<Tooltip title="The first 50 after the 4'th epoch ends will receive a soulbound NFT">
<span>Index</span>
</Tooltip>
),
Expand All @@ -95,7 +95,7 @@ export default function Table() {
},
{
field: 'uptime',
headerName: 'Week Uptime',
headerName: 'Eligible Week Uptime',
sortable: true,
flex: 1,
minWidth: 150,
Expand All @@ -119,7 +119,7 @@ export default function Table() {
field: 'location',
headerName: 'Location',
flex: 1,
minWidth: 180,
minWidth: 150,
renderCell: (params: GridRenderCellParams<NodeData>) => (
<span>{`${params.row.location?.city || ''} ${params.row.location?.country || ''}`}</span>
)
Expand All @@ -128,16 +128,17 @@ export default function Table() {
field: 'address',
headerName: 'Address',
flex: 1,
minWidth: 200
minWidth: 150
},
{
field: 'eligible',
headerName: 'Reward Eligibility',
headerName: 'Last Check Eligibility',
flex: 1,
width: 20,
width: 80,
renderHeader: () => (
<Tooltip title="These nodes are eligible to receive rewards in proportion to their uptime.">
<span>Reward Eligibility</span>
<Tooltip title="These nodes were eligible to receive rewards the proportion of their uptime
at the last round checks.">
<span>Last Check Eligibility</span>
</Tooltip>
),
renderCell: (params: GridRenderCellParams<NodeData>) => (
Expand All @@ -150,11 +151,22 @@ export default function Table() {
field: 'eligibilityCauseStr',
headerName: 'Eligibility Issue',
flex: 1,
width: 50,
width: 100,
renderCell: (params: GridRenderCellParams<NodeData>) => (
<span>{params.row.eligibilityCauseStr || 'none'}</span>
)
},
{
field: 'lastCheck',
headerName: 'Last Check',
flex: 1,
minWidth: 140,
renderCell: (params: GridRenderCellParams<NodeData>) => (
<span>{new Date(params?.row?.lastCheck)?.toLocaleString(undefined, {
timeZoneName: 'short'
})}</span>
)
},
{
field: 'network',
headerName: 'Network',
Expand All @@ -167,7 +179,7 @@ export default function Table() {
{
field: 'viewMore',
headerName: '',
width: 150,
width: 120,
renderCell: (params: GridRenderCellParams<NodeData>) => (
<Button onClick={() => setSelectedNode(params.row)}>View More</Button>
),
Expand Down Expand Up @@ -226,12 +238,6 @@ export default function Table() {
headerName: 'Allowed Admins',
flex: 1,
minWidth: 200
},
{
field: 'lastCheck',
headerName: 'Last Check',
flex: 1,
minWidth: 150
}
]

Expand Down Expand Up @@ -307,7 +313,7 @@ export default function Table() {
platform: false,
codeHash: false,
allowedAdmins: false,
lastCheck: false
// lastCheck: false
}
},
pagination: {
Expand Down
Loading