Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[base] fix favicon and document title #2409

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 36 additions & 25 deletions base/components/AppLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -20,32 +22,41 @@ export const Layout: FC<Readonly<LayoutProps>> = ({ children }) => {
};

return (
<Box sx={{ display: "flex" }}>
<DisclaimerModal />
<CssBaseline />
{isMobile && <MobileHeader onMenuClick={handleDrawerToggle} />}
<Sidebar
mobileOpen={mobileOpen}
handleDrawerToggle={handleDrawerToggle}
<>
<PageHead
production={IS_PRODUCTION}
title="KlimaDAO on Base | Official App"
mediaTitle="KlimaDAO on Base | Official App"
metaDescription="KlimaDAO on Base web app to retire carbon and autocompound AERO rewards."
Comment on lines +28 to +30
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@0xtapi let me know if you have any better suggestions for meta content here?

mediaImageSrc={`${BASE_URL}/og-media.png`}
/>
<Box
component="main"
sx={{
flexGrow: 1,
width: { xs: "100%", sm: `calc(100% - ${DRAWER_WIDTH}px)` },
minHeight: "100vh",
overflow: "auto",
display: "flex",
flexDirection: "column",
position: "relative",
pt: { xs: 8, sm: 5 }, // Adjusted padding top for mobile header
px: { xs: 2, sm: 6 },
pb: 8,
background: theme.palette.background.paper,
}}
>
{children}
<Box sx={{ display: "flex" }}>
<DisclaimerModal />
<CssBaseline />
{isMobile && <MobileHeader onMenuClick={handleDrawerToggle} />}
<Sidebar
mobileOpen={mobileOpen}
handleDrawerToggle={handleDrawerToggle}
/>
<Box
component="main"
sx={{
flexGrow: 1,
width: { xs: "100%", sm: `calc(100% - ${DRAWER_WIDTH}px)` },
minHeight: "100vh",
overflow: "auto",
display: "flex",
flexDirection: "column",
position: "relative",
pt: { xs: 8, sm: 5 }, // Adjusted padding top for mobile header
px: { xs: 2, sm: 6 },
pb: 8,
background: theme.palette.background.paper,
}}
>
{children}
</Box>
</Box>
</Box>
</>
);
};
59 changes: 59 additions & 0 deletions base/components/PageHead/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { getOgImageSrc } from "@klimadao/lib/utils";
import Head from "next/head";

export interface PageHeadProps {
production: boolean;
/** <title> 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}</title>
<meta name="description" content={props.metaDescription} />
<meta property="og:description" content={props.metaDescription} />
<meta property="og:title" content={props.mediaTitle} />
<meta property="og:image" content={mediaImageSrc} />

<meta property="og:type" content="website" />
<meta property="og:locale" content="en" />

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={props.mediaTitle} />
<meta name="twitter:description" content={props.metaDescription} />
<meta name="twitter:image" content={mediaImageSrc} />

<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00cc33" />
<meta name="theme-color" content="#ffffff" />
</Head>
);
};
Empty file removed base/lib/config.ts
Empty file.
7 changes: 7 additions & 0 deletions base/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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]
Expand Down
16 changes: 7 additions & 9 deletions base/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import { Home } from "components/pages/Home";
import { AppTheme } from "lib/theme";
import { NextPage } from "next";

const HomePage: NextPage = () => {
return (
<ThemeProvider theme={AppTheme}>
<Layout>
<Home />
</Layout>
</ThemeProvider>
);
};
const HomePage: NextPage = () => (
<ThemeProvider theme={AppTheme}>
<Layout>
<Home />
</Layout>
</ThemeProvider>
);

export default HomePage;
1 change: 1 addition & 0 deletions lib/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export const urls = {
resourcesCarbonmark: "https://www.carbonmark.com/resources",
carbonmarkEmail: "mailto:[email protected]",
disclaimer: "https://www.klimadao.finance/disclaimer",
base: "https://base.klimadao.finance",
};

export const polygonNetworks = {
Expand Down
Loading