Skip to content

Commit

Permalink
Merge pull request #47 from filecoin-saturn/aa/dashboard-updates
Browse files Browse the repository at this point in the history
feat: modify payout eligiblity nomenclature
  • Loading branch information
AmeanAsad authored Jun 30, 2023
2 parents f20ecfe + aeb9543 commit 4f6569f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/pages/dashboard/components/NodesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CopyIcon, ProjectRoadmapIcon, ListUnorderedIcon } from "@primer/octicon
import copy from "copy-text-to-clipboard";
import classNames from "classnames";
import GridButton from "../../../components/StatsGrid/GridButton";
import { PAYOUT_STATUS_MAPPING } from "..";

// Chart config must take into account that earnings are calculated once per day
export default function NodesTable(props: any) {
Expand Down Expand Up @@ -80,10 +81,12 @@ export default function NodesTable(props: any) {
},
{
field: "payoutStatus",
headerName: "Payout Status",
headerName: "Payout Eligibility",
width: 110,
cellRenderer: (params: any) => {
return params.data.payoutStatus;
const payoutStatus = params.data.payoutStatus;

return PAYOUT_STATUS_MAPPING[payoutStatus];
},
tooltipValueGetter: (params: any) => {
return [renderStatusTooltip(params.data.payoutStatus)];
Expand Down
20 changes: 17 additions & 3 deletions src/pages/dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ interface OverviewProps {
children?: ReactNode;
}

const UPTIME_REQ_DOCS = "https://docs.saturn.tech/nodes-uptime-requirement";
export const PAYOUT_STATUS_MAPPING: Record<string, string> = {
valid: "Eligible",
pending: "In Progress",
};

function createChartProps(period: TimePeriod) {
let dateRange;
let step: DurationUnitType; // group by this time unit
Expand Down Expand Up @@ -148,14 +154,22 @@ function Overview(props: OverviewProps) {

const nodePayoutSection = nodeStats && (
<>
<div>Payout Status</div>
<div>{nodeStats.payoutStatus}</div>
<div>
<a href={UPTIME_REQ_DOCS} target="_blank" rel="noopener noreferrer">
Payout Eligibility
</a>
</div>
<div>{PAYOUT_STATUS_MAPPING[nodeStats.payoutStatus]}</div>
</>
);

const uptimeCompletionSection = !(nodeStats?.uptimeCompletion === undefined) && (
<>
<div> Uptime Requirement </div>
<div>
<a href={UPTIME_REQ_DOCS} target="_blank" rel="noopener noreferrer">
Uptime Requirement
</a>
</div>
{ProgressBar(nodeStats.uptimeCompletion * 100)}
</>
);
Expand Down

0 comments on commit 4f6569f

Please sign in to comment.