fix: add assets to public folder (#7153)

* fix: add assets to public folder

* Update global-teardown.ts

* update assets

* resize logos
This commit is contained in:
Brendan Wong 2023-08-17 16:15:17 -04:00 committed by GitHub
parent ea5af12b1d
commit cccf6ac680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 13 deletions

@ -25,7 +25,7 @@ export const onRequest: PagesFunction = async ({ params, request }) => {
return new Response('Asset not found.', { status: 404 })
}
const fontData = await getFont()
const fontData = await getFont(origin)
return new ImageResponse(
(

@ -26,7 +26,7 @@ export const onRequest: PagesFunction = async ({ params, request }) => {
return new Response('Collection not found.', { status: 404 })
}
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage)])
const [fontData, palette] = await Promise.all([getFont(origin), getColor(data.ogImage)])
// Split name into words to wrap them since satori does not support inline text wrapping
const words = data.name.split(' ')

@ -28,9 +28,9 @@ export const onRequest: PagesFunction = async ({ params, request }) => {
return new Response('Token not found.', { status: 404 })
}
const [fontData, palette] = await Promise.all([getFont(), getColor(data.ogImage, true)])
const [fontData, palette] = await Promise.all([getFont(origin), getColor(data.ogImage, true)])
const networkLogo = getNetworkLogoUrl(networkName.toUpperCase())
const networkLogo = getNetworkLogoUrl(networkName.toUpperCase(), origin)
// Capitalize name such that each word starts with a capital letter
let words = data.name.split(' ')

@ -1,6 +1,5 @@
const FONT_URL = 'https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZFhjQ.ttf'
export default async function getFont() {
const font = await fetch(FONT_URL)
export default async function getFont(origin: string) {
const url = origin + '/fonts/Inter-normal.var.ttf'
const font = await fetch(url)
return font.arrayBuffer()
}

@ -1,15 +1,15 @@
import { Chain } from '../../src/graphql/data/__generated__/types-and-hooks'
export default function getNetworkLogoUrl(network: string) {
export default function getNetworkLogoUrl(network: string, origin: string) {
switch (network) {
case Chain.Polygon:
return 'https://assets.coingecko.com/coins/images/4713/small/matic-token-icon.png?1624446912'
return origin + '/images/logos/Polygon_Logo.png'
case Chain.Arbitrum:
return 'https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png'
return origin + '/images/logos/Arbitrum_Logo.png'
case Chain.Optimism:
return 'https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/optimism/assets/0x4200000000000000000000000000000000000042/logo.png'
return origin + '/images/logos/Optimism_Logo.png'
case Chain.Celo:
return 'https://assets.coingecko.com/coins/images/11090/small/InjXBNx9_400x400.jpg?1674707499'
return origin + '/images/logos/Celo_Logo.png'
default:
return ''
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB