diff --git a/app/(layout)/trackers/octant/page.tsx b/app/(layout)/trackers/octant/page.tsx index 0a8e34c0..e7ddeca5 100644 --- a/app/(layout)/trackers/octant/page.tsx +++ b/app/(layout)/trackers/octant/page.tsx @@ -150,24 +150,51 @@ export default function Page() { let curr: string | null = null; let next: string | null = null; - const epochKeys = Object.keys(epochsInfo).sort((a, b) => parseInt(b) - parseInt(a)); + const epochKeys = Object.keys(epochsInfo).sort( + (a, b) => parseInt(a) - parseInt(b), + ); for (let i = 0; i < epochKeys.length; i++) { let epoch = epochKeys[i]; - let epochAllocationStart = - new Date(epochsInfo[epoch].allocationStart).getTime() / 1000; - let epochAllocationEnd = - new Date(epochsInfo[epoch].allocationEnd).getTime() / 1000; - - - if (now >= epochAllocationStart && now <= epochAllocationEnd) { - curr = epoch; - continue; - } - - if (now < epochAllocationStart) { - next = epoch; - continue; + // let epochAllocationStart = + // new Date(epochsInfo[epoch].allocationStart).getTime() / 1000; + // let epochAllocationEnd = + // new Date(epochsInfo[epoch].allocationEnd).getTime() / 1000; + + // the incoming data is in UTC, so we need to adjust the time to the local timezone + let epochAllocationStart = moment + .utc(epochsInfo[epoch].allocationStart) + .local() + .unix(); + let epochAllocationEnd = moment + .utc(epochsInfo[epoch].allocationEnd) + .local() + .unix(); + + if (now <= epochAllocationEnd) { + if (now >= epochAllocationStart && now <= epochAllocationEnd) { + // console.log( + // "curr", + // epoch, + // "is now", + // epochAllocationStart, + // now, + // epochAllocationEnd, + // ); + curr = epoch; + continue; + } else { + // console.log( + // "next", + // epoch, + // "is now", + // epochAllocationStart, + // now, + // epochAllocationEnd, + // ); + next = epoch; + continue; + } } if (curr && next) break; @@ -177,16 +204,20 @@ export default function Page() { if (next) { setNextEpoch(epochsInfo[next]); - countdownEnd = new Date(epochsInfo[next].allocationStart).getTime() / 1000; + countdownEnd = + new Date(epochsInfo[next].allocationStart).getTime() / 1000; } if (curr) { setCurrentEpoch(epochsInfo[curr]); + setCommunityEpoch(parseInt(curr)); + setFundingEpoch(parseInt(curr)); countdownEnd = new Date(epochsInfo[curr].allocationEnd).getTime() / 1000; } - setCountdownTime(countdownEnd - now); + // console.log("curr", curr, "next", next, "countdownEnd", countdownEnd); + setCountdownTime(countdownEnd - now); }, [summaryData]); useEffect(() => { @@ -260,9 +291,9 @@ export default function Page() { const lastFundingEpoch = useMemo(() => { return summaryData?.epochs ? Object.values(summaryData.epochs) - .sort((a, b) => b.epoch - a.epoch) - .filter((epoch) => epoch.has_allocation_started)[0] - .epoch.toString() + .sort((a, b) => b.epoch - a.epoch) + .filter((epoch) => epoch.has_allocation_started)[0] + .epoch.toString() : "1"; }, [summaryData]); @@ -313,11 +344,11 @@ export default function Page() { userData.allocation_amounts[Epochs[communityEpoch].epoch] || 0, allocated_to_project_count: userData.allocated_to_project_counts[ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] || 0, allocated_to_project_keys: userData.allocated_to_project_keys[ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] || [], activeSinceEpoch: Math.min( ...userLockedEpochs.map((epoch) => parseInt(epoch)), @@ -356,8 +387,8 @@ export default function Page() { - -
+ +
-
-
+
+
-
+
-
-
+
+
-
+
Octant App
-
-
+
+
-
+
Docs
@@ -580,22 +611,22 @@ export default function Page() {
-
+
+
} >
-
-
+
+
Background Information @@ -616,22 +647,22 @@ export default function Page() {
-
-
+
+
+
} > -
-
-
-
+
+
+
+
User Wallets with GLM locked
@@ -644,7 +675,7 @@ export default function Page() { Epoch.
-
+
-
+
{ summaryData?.locked_changes.now .num_users_locked_glm @@ -726,19 +757,20 @@ export default function Page() {
Total Wallets
-
+
= 0 - ? "" - : "rotate-180" - }`} + ? "" + : "rotate-180" + }`} > {summaryData && - summaryData.locked_changes.changes - .num_users_locked_glm_change >= 0 ? ( + summaryData.locked_changes.changes + .num_users_locked_glm_change >= 0 ? ( {summaryData && ( -
+
{summaryData.locked_changes.changes .num_users_locked_glm_change > 0 && "+"} {summaryData.locked_changes.changes @@ -809,32 +841,32 @@ export default function Page() {
-
-
+
+
+
} > -
-
-
+
+
+
Total Funding Paid Out to Projects
-
+
Funding that has been paid out over all Epochs to date, from donations and matching from the Golem Foundation.
-
-
+
+
-
+
1145{" "} ETH @@ -872,7 +904,7 @@ export default function Page() {
Total Funded
-
+
-
+
6.67{" "} ETH
-
+
Mdn. Project Funding
@@ -949,26 +981,26 @@ export default function Page() {
-
- +
+
Community
-
+
This is all about the owners of GLM and who have locked their funds in Octant. Either donating/allocating or not.
{UserTypes.All.label} ( @@ -998,7 +1030,7 @@ export default function Page() { handleCommunityUserSelection("Donating"); }} style={{}} - className={`lg:!py-[10px] lg:!px-[15px] text-[16px] leading-[150%]`} + className={`text-[16px] leading-[150%] lg:!px-[15px] lg:!py-[10px]`} > {UserTypes.Donating.label} ( @@ -1006,7 +1038,7 @@ export default function Page() { communityData.filter( (user) => user.allocation_amounts[Epochs[communityEpoch].epoch] !== - undefined && + undefined && user.allocation_amounts[Epochs[communityEpoch].epoch] > 0, ).length} ) @@ -1016,51 +1048,52 @@ export default function Page() { -
+
- +
-
+
-
+
{Epochs[communityEpoch].label}
- +
-
+
-
+
{ @@ -1121,7 +1154,7 @@ export default function Page() {
-
-
-
+
+
+
{ - if ( - user.budget_amounts[ - Epochs[communityEpoch].epoch - ] === undefined - ) { - return acc; - } - let allocation = - user.allocation_amounts[ - Epochs[communityEpoch].epoch - ] || 0; - let budget = - user.budget_amounts[ - Epochs[communityEpoch].epoch - ] || 0; - return acc + (budget - allocation); - }, 0) + if ( + user.budget_amounts[ + Epochs[communityEpoch].epoch + ] === undefined + ) { + return acc; + } + let allocation = + user.allocation_amounts[ + Epochs[communityEpoch].epoch + ] || 0; + let budget = + user.budget_amounts[ + Epochs[communityEpoch].epoch + ] || 0; + return acc + (budget - allocation); + }, 0) : 0, className: "kept-by-wallets", }, @@ -1315,20 +1348,20 @@ export default function Page() { label: "allocated to projects", value: communityDataSortedAndFiltered ? communityDataSortedAndFiltered.reduce((acc, user) => { - if ( - user.allocation_amounts[ - Epochs[communityEpoch].epoch - ] === undefined - ) { - return acc; - } - return ( - acc + - user.allocation_amounts[ - Epochs[communityEpoch].epoch - ] - ); - }, 0) + if ( + user.allocation_amounts[ + Epochs[communityEpoch].epoch + ] === undefined + ) { + return acc; + } + return ( + acc + + user.allocation_amounts[ + Epochs[communityEpoch].epoch + ] + ); + }, 0) : 0, className: "allocated-to-projects", }, @@ -1338,8 +1371,8 @@ export default function Page() {
-
-
+
+
- user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ] && - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ].length === 1, - ).length + (user) => + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ] && + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ].length === 1, + ).length : 0, className: "one-project", }, @@ -1362,17 +1395,17 @@ export default function Page() { label: "2-5", value: communityDataSortedAndFiltered ? communityDataSortedAndFiltered.filter( - (user) => - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ] && - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ].length > 1 && - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ].length <= 5, - ).length + (user) => + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ] && + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ].length > 1 && + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ].length <= 5, + ).length : 0, className: "two-to-five-projects", }, @@ -1380,14 +1413,14 @@ export default function Page() { label: ">5", value: communityDataSortedAndFiltered ? communityDataSortedAndFiltered.filter( - (user) => - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ] && - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ].length > 5, - ).length + (user) => + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ] && + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ].length > 5, + ).length : 0, className: "more-than-five-projects", }, @@ -1395,14 +1428,14 @@ export default function Page() { label: "0 Projects", value: communityDataSortedAndFiltered ? communityDataSortedAndFiltered.filter( - (user) => - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ] && - user.allocated_to_project_keys[ - Epochs[communityEpoch].epoch - ].length === 0, - ).length + (user) => + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ] && + user.allocated_to_project_keys[ + Epochs[communityEpoch].epoch + ].length === 0, + ).length : 0, className: "no-projects", }, @@ -1415,16 +1448,16 @@ export default function Page() { {/* */} - -
+ +
{ @@ -1486,7 +1519,7 @@ export default function Page() {
-
+
{/* */} {communityDataSortedAndFiltered && communityDataSortedAndFiltered.length > 0 && @@ -1530,7 +1563,7 @@ export default function Page() { .slice( communityTablePage * communityTablePageSize, communityTablePage * communityTablePageSize + - communityTablePageSize, + communityTablePageSize, ) .map((userData, index) => { const userLockedEpochs = Object.keys(userData.lockeds).filter( @@ -1548,15 +1581,15 @@ export default function Page() { 0, allocation_amount: userData.allocation_amounts[ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] || 0, allocated_to_project_count: userData.allocated_to_project_counts[ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] || 0, allocated_to_project_keys: userData.allocated_to_project_keys[ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] || [], activeSinceEpoch: Math.min( ...userLockedEpochs.map((epoch) => parseInt(epoch)), @@ -1566,7 +1599,7 @@ export default function Page() {
{ if (communityRowsOpen.includes(user.user)) { setCommunityRowsOpen( @@ -1581,7 +1614,7 @@ export default function Page() { }} >
-
+
{/* @@ -1601,32 +1634,33 @@ export default function Page() { />
-
+
{ - // e.preventDefault(); // Prevent default double-click behavior - // const selection = window.getSelection(); - // const range = document.createRange(); - // range.selectNodeContents(e.currentTarget); - // selection?.removeAllRanges(); - // selection?.addRange(range); - // }} + // onDoubleClick={(e) => { + // e.preventDefault(); // Prevent default double-click behavior + // const selection = window.getSelection(); + // const range = document.createRange(); + // range.selectNodeContents(e.currentTarget); + // selection?.removeAllRanges(); + // selection?.addRange(range); + // }} >
{user.user.slice(-6)}
-
+
{ e.stopPropagation(); handleCopyAddress(user.user); @@ -1722,7 +1756,7 @@ export default function Page() { minimumFractionDigits: 2, maximumFractionDigits: 2, })} */} - + GLM
@@ -1731,8 +1765,9 @@ export default function Page() { )}
{user.budget_amount > 0 ? (
@@ -1742,7 +1777,7 @@ export default function Page() { maximumFractionDigits: user.budget_amount < 0.01 ? 5 : 2, })}{" "} - + ETH
@@ -1751,8 +1786,9 @@ export default function Page() { )}
{user.allocation_amount > 0 ? (
@@ -1762,7 +1798,7 @@ export default function Page() { maximumFractionDigits: user.allocation_amount < 0.01 ? 5 : 2, })}{" "} - + ETH
@@ -1773,12 +1809,13 @@ export default function Page() {
-
+
Active Since:{" "} @@ -1786,7 +1823,7 @@ export default function Page() { Epoch {user.activeSinceEpoch}
-
+
Donated{" "} @@ -1800,7 +1837,7 @@ export default function Page() { ETH
-
+
{( @@ -1820,16 +1857,17 @@ export default function Page() { %
-
+
@@ -1875,17 +1914,17 @@ export default function Page() { (project_key, index) => (
{communityEpoch === 0 ? ( -
+
{projectMetadataData && projectMetadataData[ - project_key + project_key ] && Object.entries( projectMetadataData[ - project_key + project_key ], ) .sort( @@ -1909,19 +1948,20 @@ export default function Page() { ))}
) : ( -
+
{projectMetadataData && projectMetadataData[project_key][ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] && ( { */}
- + {/* pagination */} -
+
{communityDataSortedAndFiltered.length > communityTablePageSize && ( <> -
+
setCommunityTablePage(0)} > - +
- +
-
+
Page
{communityTablePage + 1}
of
{Math.ceil( communityDataSortedAndFiltered.length / - communityTablePageSize, + communityTablePageSize, )}
@@ -1997,15 +2037,15 @@ export default function Page() { className="hover:cursor-pointer" onClick={() => communityTablePage < - Math.floor( - communityDataSortedAndFiltered.length / + Math.floor( + communityDataSortedAndFiltered.length / communityTablePageSize, - ) + ) ? setCommunityTablePage(communityTablePage + 1) : null } > - +
- +
-
+
Showing
{communityTablePage * communityTablePageSize + 1} @@ -2045,79 +2085,80 @@ export default function Page() {
-
- +
+
Project Funding
-
+
These are all the projects that can participate in the current round of Octant. There are a maximum of 30 projects voted in for this Epoch.
- + {/*
Next Epoch starts in
{moment("2024-10-13T16:00:00Z").diff(moment(), "days")} days
*/} {EpochStatus} -
+
{/* {countdownTimeFormatted} */}
-
+
- +
-
+
-
+
{Epochs[fundingEpoch].label}
- +
-
+
{ @@ -2179,7 +2220,7 @@ export default function Page() {
e != "all") - .map((e) => parseInt(e)) - .sort((a, b) => b - a)[0] + .filter((e) => e != "all") + .map((e) => parseInt(e)) + .sort((a, b) => b - a)[0] : 0; const lastEpochProjectMetadata = latestProjectMetadatas[ project_key @@ -2278,33 +2319,33 @@ export default function Page() { project_key: project_key, owner_project: projectMetadataData && - projectMetadataData[fundingRow.project_key] && - projectMetadataData[fundingRow.project_key][ + projectMetadataData[fundingRow.project_key] && + projectMetadataData[fundingRow.project_key][ Epochs[fundingEpoch].epoch - ] + ] ? projectMetadataData[fundingRow.project_key][ - Epochs[fundingEpoch].epoch - ].name + Epochs[fundingEpoch].epoch + ].name : "", project_metadata: projectMetadataData && - projectMetadataData[fundingRow.project_key] && - projectMetadataData[fundingRow.project_key][ + projectMetadataData[fundingRow.project_key] && + projectMetadataData[fundingRow.project_key][ Epochs[fundingEpoch].epoch - ] + ] ? projectMetadataData[fundingRow.project_key][ - Epochs[fundingEpoch].epoch - ] + Epochs[fundingEpoch].epoch + ] : lastEpochProjectMetadata, //@ts-ignore address: projectMetadataData && - projectMetadataData[fundingRow.project_key][ + projectMetadataData[fundingRow.project_key][ Epochs[fundingEpoch].epoch - ] + ] ? projectMetadataData[fundingRow.project_key][ - Epochs[fundingEpoch].epoch - ].address + Epochs[fundingEpoch].epoch + ].address : lastEpochProjectMetadata.address || "", donors: fundingRow.donor_counts[Epochs[fundingEpoch].epoch] || 0, @@ -2316,9 +2357,9 @@ export default function Page() { total: fundingRow.total[Epochs[fundingEpoch].epoch] || 0 + - fundingRow.matched_rewards[ - Epochs[fundingEpoch].epoch - ] || + fundingRow.matched_rewards[ + Epochs[fundingEpoch].epoch + ] || 0, all_time_total: 0, last_funding_epoch: lastEpoch.toString(), @@ -2332,11 +2373,11 @@ export default function Page() { // lastFundingEpoch={Epochs[Epochs.length - 1].epoch} project_key={fundingRow.project_key} lastFundingEpoch={lastFundingEpoch} - // projectIndex={index} - // setCurrentEpoch={setCurrentEpoch} - // ProjectsMetadata={ProjectsMetadata} - // master={master} - // allTimeTotalsByProjectKey={allTimeTotalsByProjectKey} + // projectIndex={index} + // setCurrentEpoch={setCurrentEpoch} + // ProjectsMetadata={ProjectsMetadata} + // master={master} + // allTimeTotalsByProjectKey={allTimeTotalsByProjectKey} /> ); })} @@ -2345,15 +2386,15 @@ export default function Page() {
-
- +
+
Octant Explained @@ -2409,12 +2450,12 @@ const OctantCircleChart = ({ label: "kept by wallets", value: communityData ? communityData.reduce( - (acc, user) => - acc + - user.budget_amounts[epoch] - - user.allocation_amounts[epoch], - 0, - ) + (acc, user) => + acc + + user.budget_amounts[epoch] - + user.allocation_amounts[epoch], + 0, + ) : 0, className: "kept-by-wallets", }, @@ -2422,9 +2463,9 @@ const OctantCircleChart = ({ label: "allocated to projects", value: communityData ? communityData.reduce( - (acc, user) => acc + user.allocation_amounts[epoch], - 0, - ) + (acc, user) => acc + user.allocation_amounts[epoch], + 0, + ) : 0, className: "allocated-to-projects", }, @@ -2457,10 +2498,10 @@ const ExpandingButtonMenu = ({ const isMobile = useMediaQuery("(max-width: 640px)"); return (
{ track(`hovered ${button.label} button`, { location: isMobile ? `mobile Octant page` : `desktop Octant page`, @@ -2469,30 +2510,32 @@ const ExpandingButtonMenu = ({ }} >
-
+
{button.label}
-
+
{items.map((item: { label: string; icon: string; href: string }) => ( -
- +
+
{item.label}
@@ -2527,7 +2570,7 @@ const ExpandingButtonMenu = ({ }; const SearchIcon = () => ( -
+
= ({
= ({ onKeyDown={handleKeyDown} >
{ setIsOpen(!isOpen); }} >
-
+
-
+
{ - // e.preventDefault(); // Prevent default double-click behavior - // const selection = window.getSelection(); - // const range = document.createRange(); - // range.selectNodeContents(e.currentTarget); - // selection?.removeAllRanges(); - // selection?.addRange(range); - // }} + // onDoubleClick={(e) => { + // e.preventDefault(); // Prevent default double-click behavior + // const selection = window.getSelection(); + // const range = document.createRange(); + // range.selectNodeContents(e.currentTarget); + // selection?.removeAllRanges(); + // selection?.addRange(range); + // }} >
{user.user.slice(-6)}
-
+
{ e.stopPropagation(); handleCopyAddress(user.user); @@ -2961,15 +3004,16 @@ const CommunityTableRow = ({ minimumFractionDigits: 2, maximumFractionDigits: 2, })} */} - GLM + GLM
) : (
-
)}
{user.budget_amount > 0 ? (
@@ -2977,15 +3021,16 @@ const CommunityTableRow = ({ minimumFractionDigits: user.budget_amount < 0.01 ? 4 : 2, maximumFractionDigits: user.budget_amount < 0.01 ? 5 : 2, })}{" "} - ETH + ETH
) : (
-
)}
{user.allocation_amount > 0 ? (
@@ -2993,7 +3038,7 @@ const CommunityTableRow = ({ minimumFractionDigits: user.allocation_amount < 0.01 ? 4 : 2, maximumFractionDigits: user.allocation_amount < 0.01 ? 5 : 2, })}{" "} - ETH + ETH
) : (
-
@@ -3002,12 +3047,13 @@ const CommunityTableRow = ({
-
+
Active Since:{" "} @@ -3015,7 +3061,7 @@ const CommunityTableRow = ({ Epoch {user.activeSinceEpoch}
-
+
Donated{" "} @@ -3026,7 +3072,7 @@ const CommunityTableRow = ({ ETH
-
+
{( @@ -3044,14 +3090,15 @@ const CommunityTableRow = ({ %
-
+
@@ -3095,10 +3143,10 @@ const CommunityTableRow = ({ (project_key, index) => (
{communityEpoch === 0 ? ( -
+
{projectMetadataData && projectMetadataData[project_key] && Object.values(projectMetadataData[project_key]) @@ -3115,16 +3163,17 @@ const CommunityTableRow = ({ ))}
) : ( -
+
{projectMetadataData && projectMetadataData[project_key][ - Epochs[communityEpoch].epoch + Epochs[communityEpoch].epoch ] && ( { { +TableRowProps) => { return ( -
+
{row.project_metadata && ( -
- -
+
+
{row.owner_project}
)}
-
+
{row.project_metadata?.name ? ( row.project_metadata.name ) : ( -
+
Not Available
)} @@ -3234,7 +3282,7 @@ const OctantTableRow = ({ > )} @@ -3249,7 +3297,7 @@ const OctantTableRow = ({ > )} @@ -3263,7 +3311,7 @@ const OctantTableRow = ({ > )} @@ -3271,8 +3319,9 @@ const OctantTableRow = ({
@@ -3301,9 +3350,9 @@ const OctantTableRow = ({
-
+
-
-
-
+
+
+
{row.donors}
-
+
{row.donors < 50 && ( )} {row.donors >= 50 && row.donors < 100 && ( )} {row.donors >= 100 && ( )}
@@ -3416,31 +3465,33 @@ const OctantTableRow = ({ {/* )} */}
-
+
{/* {["REWARD_ALLOCATION", "FINALIZED"].includes(currentEpoch.state) && currentEpochProject && ( */}
-
+
{row.allocation.toFixed(2)}{" "} - ETH + ETH
-
+
{row.matched.toFixed(2)}{" "} - ETH + ETH
{row.total.toFixed(2)}{" "} - ETH + ETH
{/*
@@ -3480,30 +3531,30 @@ const CountdownTimer = ({ time }: { time: number }) => { return (
{days > 0 && ( -
-
{days}
+
+
{days}
days
)} -
+
-
{hours}
+
{hours}
hrs
-
:
+
:
 
-
{minutes}
+
{minutes}
min
-
:
+
:
 
-
{seconds}
+
{seconds}
sec
diff --git a/next.config.js b/next.config.js index 444f2811..983ff37f 100644 --- a/next.config.js +++ b/next.config.js @@ -78,6 +78,11 @@ const nextConfig = { destination: "https://labels.growthepie.xyz/", permanent: true, }, + { + source: "/optimism-retropgf-3", + destination: "/trackers/optimism-retropgf-3", + permanent: true, + }, { source: "/trackers/octant-v2", destination: "/trackers/octant",