Skip to content

Commit

Permalink
Merge pull request #72 from Lilypad-Tech/revert-71-revert-70-ben/feat…
Browse files Browse the repository at this point in the history
…-use-devnet-api

Revert "Revert "Ben/feat use devnet api""
  • Loading branch information
developersteve authored Jul 25, 2024
2 parents 7246221 + 15ffd0a commit 3574157
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions apps/info-dashboard/src/app/leaderboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,18 @@ export default function Leaderboard() {
</span>
<span className="text-uui-text-primary-900 uui-display-sm font-semibold">
{/* Todo add api cumalative Lilybit_rewards earned */}
n.a.
{ Math.trunc(leaderboardData ? leaderboardData.reduce((total, node) => +node.Points + total, 0) : 0)}
</span>
</div>
<div className="flex-col flex space-y-uui-xs">
{/* Todo add api week total Lilybit_rewards earned */}
{/* <div className="flex-col flex space-y-uui-xs">
<span className="uui-text-sm font-medium text-uui-text-tertiary-600">
{m.leaderboard_incentive_program_week_title()}
</span>
<span className="text-uui-text-primary-900 uui-display-sm font-semibold">
{/* Todo add api total Lilybit_rewards earned */}
n.a.
</span>
</div>
</div> */}
</div>
</CardWithBorder>
<CardWithBorder
Expand Down
9 changes: 4 additions & 5 deletions apps/info-dashboard/src/lib/fetchers/leaderboard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ascending, sort } from "d3";
import { DateTime } from "luxon";
import { getTimeDiff } from "../time/time";
export type LeaderboardReturnType = {
Points: string;
Rank: string;
Expand All @@ -17,8 +16,7 @@ import {
import { NodesEndpointReturnType } from "./nodes";

export async function fetchLeaderboard() {
//const api_host = process.env.NEXT_PUBLIC_API_HOST;
const API_HOST = "https://api-testnet.lilypad.tech/";
const API_HOST = process.env.NEXT_PUBLIC_API_HOST;
const leaderboard_url = `${API_HOST}metrics-dashboard/leaderboard`;
const raw = await fetch(leaderboard_url);
return (await raw.json()) as LeaderboardReturnType;
Expand Down Expand Up @@ -68,7 +66,7 @@ export function toTableData({
} as const);
return result;
})(),
"Reward Points": "n.a.",
"Reward Points": Math.round(+Points * 100) / 100,

Status: (() => {
const online = nodesData.find(
Expand All @@ -91,7 +89,8 @@ export function toTableData({
const start = DateTime.fromMillis(startMillis);
const now = DateTime.now();
const diff = now.diff(start, "hours");
return diff.hours.toFixed(0) + " hours";
const hours = diff.hours.toFixed(0);
return hours + (hours === "1" ? " hour" : " hours");
})(connectedSince)
: "n.a.",

Expand Down
3 changes: 1 addition & 2 deletions apps/info-dashboard/src/lib/fetchers/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export type MetricsEndpointReturnType = {
};

export async function fetchMetrics() {
//const api_host = process.env.NEXT_PUBLIC_API_HOST;
const API_HOST = "https://api-testnet.lilypad.tech/";
const API_HOST = process.env.NEXT_PUBLIC_API_HOST;
const METRICS_URL = `${API_HOST}metrics-dashboard/metrics`;
const raw = await fetch(METRICS_URL);
const res = (await raw.json()) as MetricsEndpointReturnType;
Expand Down
3 changes: 1 addition & 2 deletions apps/info-dashboard/src/lib/fetchers/node-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { Balances, PowSubmissions } from "./node-chain-data";
import { DateTime } from "luxon";

export async function fetchNodeStatus() {
//const api_host = process.env.NEXT_PUBLIC_API_HOST;
const API_HOST = "https://api-testnet.lilypad.tech/";
const API_HOST = process.env.NEXT_PUBLIC_API_HOST;
const leaderboard_url = `${API_HOST}metrics-dashboard/leaderboard`;
const raw = await fetch(leaderboard_url);
return (await raw.json()) as NodeStatusReturnType;
Expand Down
3 changes: 1 addition & 2 deletions apps/info-dashboard/src/lib/fetchers/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export type NodesEndpointReturnElement = {
export type NodesEndpointReturnType = NodesEndpointReturnElement[];

export async function fetchNodes() {
//const api_host = process.env.NEXT_PUBLIC_API_HOST;
const API_HOST = "https://api-testnet.lilypad.tech/";
const API_HOST = process.env.NEXT_PUBLIC_API_HOST;
const URL = `${API_HOST}metrics-dashboard/nodes`;
const raw = await fetch(URL);
const res = (await raw.json()) as NodesEndpointReturnType;
Expand Down
4 changes: 4 additions & 0 deletions apps/website-cms/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DATABASE_URI=mongodb://mongo:27017/website-cms
PAYLOAD_SECRET=c256bbf0402b9caebdd34339
NODE_ENV=development
PAYLOAD_SECRET=TESTING
1 change: 1 addition & 0 deletions apps/website-cms/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pnpm-store

0 comments on commit 3574157

Please sign in to comment.