Skip to content

Commit

Permalink
Feat/gov v3 [skip cypress] (#1882)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Grothe <[email protected]>
Co-authored-by: Joaquin Battilana <[email protected]>
Co-authored-by: Mark Hinschberger <[email protected]>
  • Loading branch information
4 people authored Dec 26, 2023
1 parent 741281e commit e297a82
Show file tree
Hide file tree
Showing 76 changed files with 6,366 additions and 39,428 deletions.
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({

const pageExtensions = ['page.tsx'];
if (process.env.NEXT_PUBLIC_ENABLE_GOVERNANCE === 'true') pageExtensions.push('governance.tsx');
pageExtensions.push('governance.tsx');
if (process.env.NEXT_PUBLIC_ENABLE_STAKING === 'true') pageExtensions.push('staking.tsx');

/** @type {import('next').NextConfig} */
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@
"test:coverage": "jest --coverage"
},
"dependencies": {
"@aave/contract-helpers": "1.21.1",
"@aave/math-utils": "1.21.1",
"@bgd-labs/aave-address-book": "^2.10.0",
"@aave/contract-helpers": "1.21.2-2022bac22871a85776f017f1d6214d9ecfcc5abe.0",
"@aave/math-utils": "1.21.2-2022bac22871a85776f017f1d6214d9ecfcc5abe.0",
"@bgd-labs/aave-address-book": "^2.13.1",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
"@emotion/server": "latest",
"@emotion/styled": "11.10.4",
"@gelatonetwork/relay-sdk": "^5.5.5",
"@gnosis.pm/safe-apps-web3-react": "^1.2.0",
"@heroicons/react": "^1.0.6",
"@lingui/react": "^3.14.0",
"@mui/icons-material": "^5.10.14",
"@mui/lab": "5.0.0-alpha.103",
"@mui/material": "^5.10.9",
"@paraswap/sdk": "6.2.4",
"@tanstack/react-query": "^4.28.0",
Expand Down Expand Up @@ -72,6 +74,8 @@
"dayjs": "^1.11.5",
"ethers": "^5.5.4",
"fuse.js": "^6.6.2",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"gray-matter": "^4.0.3",
"immer": "^9.0.15",
"lowdb": "^3.0.0",
Expand Down Expand Up @@ -110,7 +114,7 @@
"@types/react": "latest",
"@types/react-infinite-scroller": "^1.2.3",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"axios": "^0.27.2",
"axios": "^1.6.2",
"babel-loader": "^8.2.5",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-macros": "^3.1.0",
Expand Down
8 changes: 7 additions & 1 deletion pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ function getWeb3Library(provider: any): providers.Web3Provider {
return library;
}

export const queryClient = new QueryClient();
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
});

interface MyAppProps extends AppProps {
emotionCache?: EmotionCache;
Expand Down
30 changes: 26 additions & 4 deletions pages/governance/index.governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import StyledToggleButton from 'src/components/StyledToggleButton';
import StyledToggleButtonGroup from 'src/components/StyledToggleButtonGroup';
import { MainLayout } from 'src/layouts/MainLayout';
import { GovernanceTopPanel } from 'src/modules/governance/GovernanceTopPanel';
import { ProposalsList } from 'src/modules/governance/ProposalsList';
import { ProposalsV3List } from 'src/modules/governance/ProposalsV3List';
import { UserGovernanceInfo } from 'src/modules/governance/UserGovernanceInfo';
import { Ipfs, IpfsType } from 'src/static-build/ipfs';
import { CustomProposalType, Proposal } from 'src/static-build/proposal';
Expand All @@ -20,7 +20,22 @@ const GovDelegationModal = dynamic(() =>
)
);

const GovRepresentativesModal = dynamic(() =>
import('../../src/components/transactions/GovRepresentatives/GovRepresentativesModal').then(
(module) => module.GovRepresentativesModal
)
);

export const getStaticProps = async () => {
// const queryClient = new QueryClient();
// await queryClient.prefetchQuery({ queryKey: ['proposals'], queryFn: () => getProposals });

// return {
// props: {
// dehydratedState: dehydrate(queryClient),
// },
// };

const IpfsFetcher = new Ipfs();
const ProposalFetcher = new Proposal();

Expand All @@ -39,7 +54,11 @@ export const getStaticProps = async () => {
};
});

return { props: { proposals: proposals.slice().reverse() } };
return {
props: {
proposals: proposals.slice().reverse(),
},
};
};

enum Tabs {
Expand All @@ -61,6 +80,8 @@ export default function Governance(props: GovernancePageProps) {
const [mode, setMode] = useState(Tabs.PROPOSALS);
const trackEvent = useRootStore((store) => store.trackEvent);

console.log(props);

useEffect(() => {
trackEvent('Page Viewed', {
'Page Name': 'Governance',
Expand Down Expand Up @@ -95,14 +116,14 @@ export default function Governance(props: GovernancePageProps) {
</StyledToggleButtonGroup>
{isMobile ? (
mode === Tabs.PROPOSALS ? (
<ProposalsList {...props} />
<ProposalsV3List />
) : (
<UserGovernanceInfo />
)
) : (
<Grid container spacing={4}>
<Grid item md={8}>
<ProposalsList {...props} />
<ProposalsV3List />
</Grid>
<Grid item md={4}>
<UserGovernanceInfo />
Expand All @@ -119,6 +140,7 @@ Governance.getLayout = function getLayout(page: React.ReactElement) {
<MainLayout>
{page}
<GovDelegationModal />
<GovRepresentativesModal />
</MainLayout>
);
};
4 changes: 2 additions & 2 deletions pages/governance/ipfs-preview.governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function IpfsPreview() {
const router = useRouter();
const ipfsHash = router.query.ipfsHash as string;
const [ipfs, setIpfs] = useState<IpfsType>();

console.log(ipfs);
async function fetchIpfs() {
const proposalMetadata = await getProposalMetadata(ipfsHash, governanceConfig.ipfsGateway);
const newIpfs = {
Expand All @@ -31,7 +31,7 @@ export default function IpfsPreview() {
if (!ipfsHash) return;
fetchIpfs();
}, [ipfsHash]);
return <ProposalPage ipfs={ipfs} proposal={undefined} />;
return <ProposalPage />;
}

IpfsPreview.getLayout = function getLayout(page: React.ReactElement) {
Expand Down
Loading

2 comments on commit e297a82

@github-actions
Copy link

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

@github-actions
Copy link

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.