From 25304a567a13d44219b0fff6debe15402eb575f3 Mon Sep 17 00:00:00 2001 From: neokry Date: Mon, 8 Jan 2024 14:16:15 -0800 Subject: [PATCH] FIx image stacker issue --- apps/web/src/pages/api/renderer/stack-images.ts | 14 +++++--------- .../src/pages/dao/[network]/[token]/[tokenId].tsx | 14 ++++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/web/src/pages/api/renderer/stack-images.ts b/apps/web/src/pages/api/renderer/stack-images.ts index 00730f046..7c317cb14 100644 --- a/apps/web/src/pages/api/renderer/stack-images.ts +++ b/apps/web/src/pages/api/renderer/stack-images.ts @@ -21,16 +21,12 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { images.map((imageUrl) => getImageData(imageUrl)) ) - const isSvg = images[0].includes('.svg') - - // Resize all SVGs to a default size - if (isSvg) { - imageData = await Promise.all( - imageData.map(async (x) => - sharp(x).resize(SVG_DEFAULT_SIZE, SVG_DEFAULT_SIZE, { fit: 'inside' }).toBuffer() - ) + // Resize all images to a default size + imageData = await Promise.all( + imageData.map(async (x) => + sharp(x).resize(SVG_DEFAULT_SIZE, SVG_DEFAULT_SIZE, { fit: 'inside' }).toBuffer() ) - } + ) const compositeParams = imageData.slice(1).map((x) => ({ input: x, diff --git a/apps/web/src/pages/dao/[network]/[token]/[tokenId].tsx b/apps/web/src/pages/dao/[network]/[token]/[tokenId].tsx index 8701f0697..fe341770e 100644 --- a/apps/web/src/pages/dao/[network]/[token]/[tokenId].tsx +++ b/apps/web/src/pages/dao/[network]/[token]/[tokenId].tsx @@ -8,7 +8,7 @@ import { Meta } from 'src/components/Meta' import AnimatedModal from 'src/components/Modal/AnimatedModal' import { SuccessModalContent } from 'src/components/Modal/SuccessModalContent' import { CACHE_TIMES } from 'src/constants/cacheTimes' -import { PUBLIC_DEFAULT_CHAINS } from 'src/constants/defaultChains' +import { PUBLIC_ALL_CHAINS, PUBLIC_DEFAULT_CHAINS } from 'src/constants/defaultChains' import { CAST_ENABLED } from 'src/constants/farcasterEnabled' import { SUCCESS_MESSAGES } from 'src/constants/messages' import { SDK } from 'src/data/subgraph/client' @@ -27,14 +27,13 @@ import { DaoTopSection } from 'src/modules/dao/components/DaoTopSection' import FeedTab from 'src/modules/dao/components/Feed/Feed' import { NextPageWithLayout } from 'src/pages/_app' import { DaoOgMetadata } from 'src/pages/api/og/dao' -import { AddressType, Chain } from 'src/typings' +import { AddressType, CHAIN_ID, Chain } from 'src/typings' import { isPossibleMarkdown } from 'src/utils/helpers' export type TokenWithDao = NonNullable interface TokenPageProps { url: string - chain: Chain collection: AddressType token: TokenWithDao name: string @@ -42,23 +41,26 @@ interface TokenPageProps { tokenId: string addresses: DaoContractAddresses ogImageURL: string + chainId: CHAIN_ID } const TokenPage: NextPageWithLayout = ({ url, - chain, collection, token, description, name, addresses, ogImageURL, + chainId, }) => { const { query, replace, pathname } = useRouter() const { address } = useAccount() + const chain = PUBLIC_ALL_CHAINS.find((x) => x.id === chainId) as Chain + const { hasThreshold } = useVotes({ - chainId: chain.id, + chainId: chainId, signerAddress: address, collectionAddress: collection, governorAddress: addresses?.governor, @@ -240,7 +242,6 @@ export const getServerSideProps: GetServerSideProps = async ({ const props: TokenPageProps = { url: resolvedUrl, - chain, collection, name, token, @@ -248,6 +249,7 @@ export const getServerSideProps: GetServerSideProps = async ({ tokenId, addresses, ogImageURL, + chainId: chain.id, } return {