Skip to content

Commit

Permalink
feat: release updates (#33)
Browse files Browse the repository at this point in the history
* fix: remove coming soon things

* fix: rpc switch initial

* fix: update packages
  • Loading branch information
Argeare5 authored Dec 26, 2023
1 parent 9c36b46 commit 242a285
Show file tree
Hide file tree
Showing 23 changed files with 413 additions and 1,633 deletions.
4 changes: 1 addition & 3 deletions app/delegate/page.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Metadata } from 'next';
import React from 'react';

import { DelegatePage } from '../../src/delegate/components/DelegatePage';
import { ComingSoonPage } from '../../src/ui/pages/ComingSoonPage';
import { metaTexts } from '../../src/ui/utils/metaTexts';

export const metadata: Metadata = {
Expand All @@ -16,6 +15,5 @@ export const metadata: Metadata = {
};

export default function Page() {
// return <DelegatePage />;
return <ComingSoonPage />;
return <DelegatePage />;
}
161 changes: 84 additions & 77 deletions app/page.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import {
getGovCoreConfigs,
} from '@bgd-labs/aave-governance-ui-helpers';
import { Metadata } from 'next';
import React from 'react';

import { ProposalPageSSR } from '../src/proposals/components/proposalList/ProposalPageSSR';
import { ComingSoonPage } from '../src/ui/pages/ComingSoonPage';
import { metaTexts } from '../src/ui/utils/metaTexts';
import { appConfig } from '../src/utils/appConfig';
import { githubStartUrl, listViewPath } from '../src/utils/cacheGithubLinks';
Expand Down Expand Up @@ -37,80 +35,89 @@ export default async function Page({
}: {
searchParams: { [key: string]: string | string[] | undefined };
}) {
// const activePage = !!searchParams['activePage']
// ? Number(searchParams['activePage']) - 1
// : 0;
//
// const res = await fetch(`${githubStartUrl}/${listViewPath}`);
// const data = res.ok
// ? ((await res.json()) as PageServerSideData)
// : ({ totalProposalCount: -1, proposals: [] } as PageServerSideData);
// const cachedIds = data.proposals.map((data) => data.id);
// const totalIds =
// data.totalProposalCount >= 0
// ? Array.from(Array(data.totalProposalCount).keys()).sort((a, b) => b - a)
// : [];
// const startIndex = activePage * 10; // PAGE_SIZE
// let endIndex = startIndex + 10; // PAGE_SIZE
//
// if (endIndex > totalIds.length) {
// endIndex = totalIds.length;
// }
// const idsByPage = totalIds.slice(startIndex, endIndex);
//
// const activeIds: number[] = [];
// for (let i = 0; i < idsByPage.length; i++) {
// let found = false;
// for (let j = 0; j < cachedIds.length; j++) {
// if (idsByPage[i] === cachedIds[j]) {
// found = true;
// break;
// }
// }
//
// if (!found) {
// activeIds.push(idsByPage[i]);
// }
// }
//
// const cachedIdsByPage: number[] = [];
// for (let i = 0; i < idsByPage.length; i++) {
// let found = false;
// for (let j = 0; j < activeIds.length; j++) {
// if (idsByPage[i] === activeIds[j]) {
// found = true;
// break;
// }
// }
//
// if (!found) {
// cachedIdsByPage.push(idsByPage[i]);
// }
// }
//
// const { configs, contractsConstants } = await getGovCoreConfigs({
// client: initialClients[appConfig.govCoreChainId],
// govCoreContractAddress: appConfig.govCoreConfig.contractAddress,
// govCoreDataHelperContractAddress:
// appConfig.govCoreConfig.dataHelperContractAddress,
// });
//
// const cachedProposalsData = cachedIdsByPage.map((id) => {
// const proposal = data.proposals.filter((proposal) => proposal.id === id)[0];
//
// return {
// id: proposal.id,
// proposal: {
// data: {
// id: proposal.id,
// finishedTimestamp: proposal.finishedTimestamp,
// title: proposal.title,
// ipfsHash: proposal.ipfsHash,
// },
// state: proposal.state,
// },
// } as CachedProposalDataItemWithId;
// });
const activePage = !!searchParams['activePage']
? Number(searchParams['activePage']) - 1
: 0;

return <ComingSoonPage />;
const res = await fetch(`${githubStartUrl}/${listViewPath}`);
const data = res.ok
? ((await res.json()) as PageServerSideData)
: ({ totalProposalCount: -1, proposals: [] } as PageServerSideData);
const cachedIds = data.proposals.map((data) => data.id);
const totalIds =
data.totalProposalCount >= 0
? Array.from(Array(data.totalProposalCount).keys()).sort((a, b) => b - a)
: [];
const startIndex = activePage * 10; // PAGE_SIZE
let endIndex = startIndex + 10; // PAGE_SIZE

if (endIndex > totalIds.length) {
endIndex = totalIds.length;
}
const idsByPage = totalIds.slice(startIndex, endIndex);

const activeIds: number[] = [];
for (let i = 0; i < idsByPage.length; i++) {
let found = false;
for (let j = 0; j < cachedIds.length; j++) {
if (idsByPage[i] === cachedIds[j]) {
found = true;
break;
}
}

if (!found) {
activeIds.push(idsByPage[i]);
}
}

const cachedIdsByPage: number[] = [];
for (let i = 0; i < idsByPage.length; i++) {
let found = false;
for (let j = 0; j < activeIds.length; j++) {
if (idsByPage[i] === activeIds[j]) {
found = true;
break;
}
}

if (!found) {
cachedIdsByPage.push(idsByPage[i]);
}
}

const { configs, contractsConstants } = await getGovCoreConfigs({
client: initialClients[appConfig.govCoreChainId],
govCoreContractAddress: appConfig.govCoreConfig.contractAddress,
govCoreDataHelperContractAddress:
appConfig.govCoreConfig.dataHelperContractAddress,
});

const cachedProposalsData = cachedIdsByPage.map((id) => {
const proposal = data.proposals.filter((proposal) => proposal.id === id)[0];

return {
id: proposal.id,
proposal: {
data: {
id: proposal.id,
finishedTimestamp: proposal.finishedTimestamp,
title: proposal.title,
ipfsHash: proposal.ipfsHash,
},
state: proposal.state,
},
} as CachedProposalDataItemWithId;
});

return (
<ProposalPageSSR
cachedProposals={data.proposals}
cachedTotalProposalCount={data.totalProposalCount}
govCoreConfigs={configs}
contractsConstants={contractsConstants}
cachedProposalsData={cachedProposalsData}
cachedActiveIds={activeIds}
/>
);
}
19 changes: 0 additions & 19 deletions app/proposal-create-overview-v2/page.page.tsx

This file was deleted.

Loading

1 comment on commit 242a285

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.