Skip to content

Commit

Permalink
feat: update site title according to chain (#2095)
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Nov 22, 2024
1 parent d107948 commit 2f58c3b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
6 changes: 4 additions & 2 deletions packages/arb-token-bridge-ui/src/generateOpenGraphImages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ async function getOrbitChainImage(orbitChain: Chain) {
justifyContent: 'center',
alignItems: 'center',
position: 'relative',
textAlign: 'center'
textAlign: 'center',
paddingLeft: '40px',
paddingRight: '40px'
}}
>
<ArbitrumLogo
Expand All @@ -267,7 +269,7 @@ async function getOrbitChainImage(orbitChain: Chain) {
/>
<span
style={{
fontSize: '140px',
fontSize: '112px',
fontWeight: '500',
color: 'white',
letterSpacing: '4px',
Expand Down
27 changes: 16 additions & 11 deletions packages/arb-token-bridge-ui/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import relativeTime from 'dayjs/plugin/relativeTime'
import advancedFormat from 'dayjs/plugin/advancedFormat'
import timeZone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
import type { Chain } from 'wagmi'

import 'tippy.js/dist/tippy.css'
import 'tippy.js/themes/light.css'
Expand All @@ -24,8 +25,6 @@ import {
import { isUserRejectedError } from '../util/isUserRejectedError'
import { isNetwork } from '../util/networks'

const siteTitle = 'Bridge to Arbitrum'

dayjs.extend(utc)
dayjs.extend(relativeTime)
dayjs.extend(timeZone)
Expand Down Expand Up @@ -81,20 +80,19 @@ if (
}

function DynamicMetaData({
sourceChainSlug,
destinationChainSlug
sourceChainInfo,
destinationChainInfo
}: {
sourceChainSlug: ChainKeyQueryParam
destinationChainSlug: ChainKeyQueryParam
sourceChainInfo: Chain
destinationChainInfo: Chain
}) {
const sourceChainInfo = getChainForChainKeyQueryParam(sourceChainSlug)
const destinationChainInfo =
getChainForChainKeyQueryParam(destinationChainSlug)
const { isOrbitChain: isSourceOrbitChain } = isNetwork(sourceChainInfo.id)
const { isOrbitChain: isDestinationOrbitChain } = isNetwork(
destinationChainInfo.id
)

const siteTitle = `Bridge to ${destinationChainInfo.name}`

const siteDescription = `Bridge from ${sourceChainInfo.name} to ${destinationChainInfo.name} using the Arbitrum Bridge. Built to scale Ethereum, Arbitrum brings you 10x lower costs while inheriting Ethereum’s security model. Arbitrum is a Layer 2 Optimistic Rollup.`
const siteDomain = 'https://bridge.arbitrum.io'

Expand Down Expand Up @@ -151,14 +149,21 @@ export default function App({ Component, pageProps, router }: AppProps) {
const destinationChainSlug = (router.query.destinationChain?.toString() ??
'arbitrum-one') as ChainKeyQueryParam

const sourceChainInfo = getChainForChainKeyQueryParam(sourceChainSlug)
const destinationChainInfo =
getChainForChainKeyQueryParam(destinationChainSlug)

const siteTitle = `Bridge to ${destinationChainInfo.name}`

return (
<>
<Head>
<DynamicMetaData
sourceChainSlug={sourceChainSlug}
destinationChainSlug={destinationChainSlug}
sourceChainInfo={sourceChainInfo}
destinationChainInfo={destinationChainInfo}
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
{/* title must be here because it doesn't render if it's in DynamicMetaData */}
<title>{siteTitle}</title>
</Head>
<Layout>
Expand Down

0 comments on commit 2f58c3b

Please sign in to comment.