diff --git a/.env.example b/.env.example index 87420df0a5..8460191616 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,6 @@ URL=http://localhost:3000 TENDERLY_KEY= TENDERLY_ACCOUNT= TENDERLY_PROJECT= -ENABLE_TESTNET=true \ No newline at end of file +ENABLE_TESTNET=true +ENABLE_GOVERNANCE=true +ENABLE_STAKING=true \ No newline at end of file diff --git a/.github/workflows/build-test-deploy.yml b/.github/workflows/build-test-deploy.yml index fb860d986f..c8941e5f4d 100644 --- a/.github/workflows/build-test-deploy.yml +++ b/.github/workflows/build-test-deploy.yml @@ -36,7 +36,9 @@ jobs: if: steps.restore.outcome != 'success' run: yarn build:static env: - ENABLE_TESTNET: true + ENABLE_TESTNET: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'false' || 'true' }} + ENABLE_GOVERNANCE: true + ENABLE_STAKING: true - name: store artifact uses: actions/upload-artifact@v2 diff --git a/.github/workflows/nextjs_bundle_analysis.yml b/.github/workflows/nextjs_bundle_analysis.yml index ea99f043eb..5e28c9b7d7 100644 --- a/.github/workflows/nextjs_bundle_analysis.yml +++ b/.github/workflows/nextjs_bundle_analysis.yml @@ -48,6 +48,9 @@ jobs: - name: Build next.js app # change this if your site requires a custom build command run: ./node_modules/.bin/next build + env: + ENABLE_GOVERNANCE: true + ENABLE_STAKING: true # Here's the first place where next-bundle-analysis' own script is used # This step pulls the raw bundle stats for the current bundle diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b2d6041a24..a3494ad1ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,6 +30,9 @@ yarn build:static ```sh # you can default enable testnets by setting the following environment variable ENABLE_TESTNET=true +# you can disable staking & governance by altering +ENABLE_GOVERNANCE=true +ENABLE_STAKING=true ``` ## Test @@ -58,7 +61,6 @@ yarn test:amm|main|polygon|avalanche To add a new token to the app, all you have to do is adding a svg token icon inside `public/icons/tokens` please make sure the svg name equals the `lowercase` onchain `symbol`. If you want a custom name to appear alongside the icon you can alter `src/ui-config/reservePatches.ts` accordingly. - ## Translations Aave uses [Crowdin](https://crowdin.com/project/aave-interface) for translation management. @@ -83,4 +85,4 @@ To download strings crowdin download -``` \ No newline at end of file +``` diff --git a/custom.d.ts b/custom.d.ts index 31bfeb5fa5..26ea2c7669 100644 --- a/custom.d.ts +++ b/custom.d.ts @@ -5,5 +5,7 @@ namespace NodeJS { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface ProcessEnv { CACHE_PATH: string; + ENABLE_GOVERNANCE: string; + ENABLE_STAKING: string; } } diff --git a/cypress/support/steps/configuration.steps.ts b/cypress/support/steps/configuration.steps.ts index 9cef568e04..7cab93f1d4 100644 --- a/cypress/support/steps/configuration.steps.ts +++ b/cypress/support/steps/configuration.steps.ts @@ -43,6 +43,8 @@ export const configEnvWithTenderly = ({ win.localStorage.setItem('WEB3_CONNECT_CACHED_PROVIDER', '"injected"'); win.localStorage.setItem('selectedAccount', DEFAULT_TEST_ACCOUNT.address.toLowerCase()); win.localStorage.setItem('selectedMarket', market); + // required when testing governance/staking as otherwise the fork will check for kovan fork + win.localStorage.setItem('testnetsEnabled', 'false'); }, }); }); diff --git a/next.config.js b/next.config.js index 8f1c9df5ba..da41ccc586 100644 --- a/next.config.js +++ b/next.config.js @@ -3,6 +3,10 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', }); +const pageExtensions = ['page.tsx']; +if (process.env.ENABLE_GOVERNANCE === 'true') pageExtensions.push('governance.tsx'); +if (process.env.ENABLE_STAKING === 'true') pageExtensions.push('staking.tsx'); + /** @type {import('next').NextConfig} */ module.exports = withBundleAnalyzer({ webpack(config) { @@ -12,10 +16,10 @@ module.exports = withBundleAnalyzer({ use: ['@svgr/webpack'], }); config.experiments = { topLevelAwait: true }; - return config; }, reactStrictMode: true, // assetPrefix: "./", trailingSlash: true, + pageExtensions, }); diff --git a/pages/_app.tsx b/pages/_app.page.tsx similarity index 100% rename from pages/_app.tsx rename to pages/_app.page.tsx diff --git a/pages/_document.tsx b/pages/_document.page.tsx similarity index 100% rename from pages/_document.tsx rename to pages/_document.page.tsx diff --git a/pages/faucet.tsx b/pages/faucet.page.tsx similarity index 100% rename from pages/faucet.tsx rename to pages/faucet.page.tsx diff --git a/pages/governance/index.tsx b/pages/governance/index.governance.tsx similarity index 100% rename from pages/governance/index.tsx rename to pages/governance/index.governance.tsx diff --git a/pages/governance/proposal/[proposalId].tsx b/pages/governance/proposal/[proposalId].governance.tsx similarity index 98% rename from pages/governance/proposal/[proposalId].tsx rename to pages/governance/proposal/[proposalId].governance.tsx index 0f49c59c5b..9fd96a8814 100644 --- a/pages/governance/proposal/[proposalId].tsx +++ b/pages/governance/proposal/[proposalId].governance.tsx @@ -34,7 +34,6 @@ import { GovVoteModal } from 'src/components/transactions/GovVote/GovVoteModal'; // import { Vote } from 'src/static-build/vote'; export async function getStaticPaths() { - if (!governanceConfig) return { paths: [] }; const ProposalFetcher = new Proposal(); const paths = [...Array(ProposalFetcher.count()).keys()].map((id) => ({ params: { proposalId: id.toString() }, @@ -102,7 +101,6 @@ export default function ProposalPage({ proposal: initialProposal, ipfs }: Propos useEffect(() => { setUrl(window.location.href); }, []); - if (!governanceConfig) return
Governance not enabled
; const { yaeVotes, @@ -150,7 +148,7 @@ export default function ProposalPage({ proposal: initialProposal, ipfs }: Propos