diff --git a/app/api/optimism-retropgf-3/crons/route.ts b/app/api/optimism-retropgf-3/crons/route.ts index 6fa77ab1..07ebcd01 100644 --- a/app/api/optimism-retropgf-3/crons/route.ts +++ b/app/api/optimism-retropgf-3/crons/route.ts @@ -309,9 +309,9 @@ const processAllProjects = async () => { const processCron = async () => { console.log("processCron started"); - createTableIfNotExists().then(() => { + await createTableIfNotExists().then(async () => { console.log("processCron::createTableIfNotExists done"); - processAllProjects().then(() => { + await processAllProjects().then(() => { console.log("processCron::processAllProjects done"); }); }); diff --git a/app/optimism-retropgf-3/page.tsx b/app/optimism-retropgf-3/page.tsx index 6126e00a..2babccbe 100644 --- a/app/optimism-retropgf-3/page.tsx +++ b/app/optimism-retropgf-3/page.tsx @@ -19,7 +19,7 @@ import Icon from "@/components/layout/Icon"; import { useTheme } from "next-themes"; import ShowLoading from "@/components/layout/ShowLoading"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { uniq } from "lodash"; +import { last, uniq } from "lodash"; import moment from "moment"; import Image from "next/image"; import Link from "next/link"; @@ -115,6 +115,19 @@ export default function Page() { const { theme } = useTheme(); + const lastUpdatedString = useMemo(() => { + if (!projectsResponse) return null; + + const oldest = projectsResponse.projects.reduce((prev, curr) => { + return prev.last_updated < curr.last_updated ? prev : curr; + }); + + const lastUpdated = oldest.last_updated; + + return moment(lastUpdated).fromNow(); + }, [projectsResponse]); + + const getProjectsCombinedFundingSourcesByCurrency = useCallback( (fundingSources: ProjectFundingSource[]) => { const combinedFundingSources: { @@ -323,11 +336,10 @@ export default function Page() { rel="noopener noreferrer" target="_blank" href={`https://etherscan.io/address/${info.row.original.applicant.address.address}`} - className={`rounded-full px-1 py-0 border border-forest-900/20 dark:border-forest-500/20 font-mono text-[10px] ${ - info.row.original.applicant.address.resolvedName.name - ? "text-forest-900 dark:text-forest-500" - : "text-forest-900/50 dark:text-forest-500/50" - } hover:bg-forest-900/10 dark:hover:bg-forest-500/10`} + className={`rounded-full px-1 py-0 border border-forest-900/20 dark:border-forest-500/20 font-mono text-[10px] ${info.row.original.applicant.address.resolvedName.name + ? "text-forest-900 dark:text-forest-500" + : "text-forest-900/50 dark:text-forest-500/50" + } hover:bg-forest-900/10 dark:hover:bg-forest-500/10`} > {info.row.original.applicant.address.resolvedName.name ? ( <>{info.row.original.applicant.address.resolvedName.name}> @@ -465,15 +477,14 @@ export default function Page() { className="relative" style={{ height: "2px", - width: `${ - (getProjectsCombinedFundingSourcesByCurrency( + width: `${(getProjectsCombinedFundingSourcesByCurrency( + info.row.original.funding_sources, + )["TOTAL"] / + getProjectsCombinedFundingSourcesByCurrency( info.row.original.funding_sources, - )["TOTAL"] / - getProjectsCombinedFundingSourcesByCurrency( - info.row.original.funding_sources, - )["TOTAL"]) * + )["TOTAL"]) * 100.0 - }%`, + }%`, }} >
@@ -628,13 +636,12 @@ export default function Page() { style={{ height: "2px", - width: `${ - (getProjectsCombinedFundingSourcesByCurrency( - info.row.original.funding_sources, - )["TOTAL"] / - totalFundingAmounts["TOTAL"]) * + width: `${(getProjectsCombinedFundingSourcesByCurrency( + info.row.original.funding_sources, + )["TOTAL"] / + totalFundingAmounts["TOTAL"]) * 100.0 - }%`, + }%`, // right with bases on bottom and right }} > @@ -779,32 +786,32 @@ export default function Page() { // }, }, }, - { - header: "Last Updated", - accessorKey: "last_updated", - // size: 15, - cell: (info) => ( -