diff --git a/base/components/AppLayout/index.tsx b/base/components/AppLayout/index.tsx index 0f350ffba6..6bfa40caa7 100644 --- a/base/components/AppLayout/index.tsx +++ b/base/components/AppLayout/index.tsx @@ -1,5 +1,7 @@ import { Box, CssBaseline, useMediaQuery, useTheme } from "@mui/material"; import { DisclaimerModal } from "components/DisclaimerModal"; +import { PageHead } from "components/PageHead"; +import { BASE_URL, IS_PRODUCTION } from "lib/constants"; import { FC, ReactNode, useState } from "react"; import { MobileHeader } from "../MobileHeader"; import { Sidebar } from "../Sidebar"; @@ -20,32 +22,41 @@ export const Layout: FC> = ({ children }) => { }; return ( - - - - {isMobile && } - + - - {children} + + + + {isMobile && } + + + {children} + - + ); }; diff --git a/base/components/PageHead/index.tsx b/base/components/PageHead/index.tsx new file mode 100644 index 0000000000..9f6e13fb63 --- /dev/null +++ b/base/components/PageHead/index.tsx @@ -0,0 +1,59 @@ +import { getOgImageSrc } from "@klimadao/lib/utils"; +import Head from "next/head"; + +export interface PageHeadProps { + production: boolean; + /** tag */ + title: string; + /** og:title */ + mediaTitle: string; + /** og:description */ + metaDescription: string; + doNotIndex?: boolean; + mediaImageSrc?: string; +} + +export const PageHead = (props: PageHeadProps) => { + const noRobots = props.doNotIndex || !props.production; + const mediaImageSrc = getOgImageSrc(props.mediaImageSrc); + + return ( + <Head> + {noRobots && <meta name="robots" content="noindex" />} + <title>{props.title} + + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/base/lib/config.ts b/base/lib/config.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/base/lib/constants.ts b/base/lib/constants.ts index abc4b936a6..0087dcd8e4 100644 --- a/base/lib/constants.ts +++ b/base/lib/constants.ts @@ -1,3 +1,4 @@ +import { urls } from "@klimadao/lib/constants"; import { Chain } from "wagmi"; import { base, baseSepolia } from "wagmi/chains"; import { LiquidityPool, Token } from "./types"; @@ -13,6 +14,12 @@ export const IS_PREVIEW_BUILD = /** True if local development (not preview deployment) */ export const IS_LOCAL_DEVELOPMENT = process.env.NODE_ENV === "development"; +export const BASE_URL = IS_PRODUCTION + ? urls.base + : process.env.NEXT_PUBLIC_VERCEL_URL + ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` + : "http://localhost:3004"; + export const supportedChains = IS_LOCAL_DEVELOPMENT || IS_PRODUCTION || IS_PREVIEW_BUILD ? [base] diff --git a/base/pages/index.tsx b/base/pages/index.tsx index 9ee8663166..f107422ce9 100644 --- a/base/pages/index.tsx +++ b/base/pages/index.tsx @@ -5,14 +5,12 @@ import { Home } from "components/pages/Home"; import { AppTheme } from "lib/theme"; import { NextPage } from "next"; -const HomePage: NextPage = () => { - return ( - - - - - - ); -}; +const HomePage: NextPage = () => ( + + + + + +); export default HomePage; diff --git a/lib/constants/index.ts b/lib/constants/index.ts index 6b94fea64f..843ad79a7d 100644 --- a/lib/constants/index.ts +++ b/lib/constants/index.ts @@ -174,6 +174,7 @@ export const urls = { resourcesCarbonmark: "https://www.carbonmark.com/resources", carbonmarkEmail: "mailto:support@carbonmark.com", disclaimer: "https://www.klimadao.finance/disclaimer", + base: "https://base.klimadao.finance", }; export const polygonNetworks = {