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:
parent
ea5af12b1d
commit
cccf6ac680
@ -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 ''
|
||||
}
|
||||
|
BIN
public/fonts/Inter-normal.var.ttf
Normal file
BIN
public/fonts/Inter-normal.var.ttf
Normal file
Binary file not shown.
BIN
public/images/logos/Arbitrum_Logo.png
Normal file
BIN
public/images/logos/Arbitrum_Logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
public/images/logos/Celo_Logo.png
Normal file
BIN
public/images/logos/Celo_Logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
public/images/logos/Optimism_Logo.png
Normal file
BIN
public/images/logos/Optimism_Logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
BIN
public/images/logos/Polygon_Logo.png
Normal file
BIN
public/images/logos/Polygon_Logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue
Block a user