From 0a3ad21509012fefe106a27340f372b8a6e1497a Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 24 Aug 2023 19:58:40 +0700 Subject: [PATCH 1/2] update css support svg --- .../Announcement/Popups/SnippetPopup.tsx | 2 ++ src/hooks/social.ts | 19 +++++++++++++++---- src/utils/index.ts | 9 --------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/Announcement/Popups/SnippetPopup.tsx b/src/components/Announcement/Popups/SnippetPopup.tsx index d6d8bc34c0..3a83802a87 100644 --- a/src/components/Announcement/Popups/SnippetPopup.tsx +++ b/src/components/Announcement/Popups/SnippetPopup.tsx @@ -83,6 +83,8 @@ const SeeMore = styled.div` color: ${({ theme }) => theme.subText}; font-size: 14px; font-weight: 500; + text-align: right; + white-space: nowrap; ` function SnippetPopupItem({ diff --git a/src/hooks/social.ts b/src/hooks/social.ts index 64b0bc2f5b..d2f641be85 100644 --- a/src/hooks/social.ts +++ b/src/hooks/social.ts @@ -5,14 +5,18 @@ import { v4 as uuid } from 'uuid' import { BUCKET_NAME } from 'constants/env' +const ALLOW_EXTENSIONS = ['jpg', 'jpeg', 'png', 'svg', 'webp', 'gif'] + export const useUploadImageToCloud = () => { const [uploadImage] = useUploadImageMutation() return useCallback( - async (blob: Blob) => { + async (file: Blob | File) => { try { - const fileName = `${uuid()}.png` - const file = new File([blob], fileName, { type: 'image/png' }) + const ext = (file as File).name.split('.').pop() ?? '' + if (!ALLOW_EXTENSIONS.includes(ext)) throw new Error('File is not support') + + const fileName = `${uuid() + Date.now()}.${ext}` const res = await uploadImage({ fileName, }).unwrap() @@ -20,7 +24,14 @@ export const useUploadImageToCloud = () => { const url = res?.data?.signedURL if (!url) throw new Error('Upload error') - await axios({ url, method: 'PUT', data: file }) + await axios({ + url, + method: 'PUT', + data: file, + headers: { + 'Content-Type': file.type, + }, + }) return `https://storage.googleapis.com/${BUCKET_NAME}/${fileName}` } catch (error) { return diff --git a/src/utils/index.ts b/src/utils/index.ts index 712f6c979b..8622594eb2 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -372,15 +372,6 @@ export const get24hValue = (valueNow: string, value24HoursAgo: string | undefine } export const getTokenLogoURL = (inputAddress: string, chainId: ChainId): string => { - // hardcode for testing in goerli - if (chainId === ChainId.GĂ–RLI) { - switch (inputAddress.toLowerCase()) { - case '0x1bbeeedcf32dc2c1ebc2f138e3fc7f3decd44d6a': - return 'https://s2.coinmarketcap.com/static/img/coins/64x64/4943.png' - case '0x2bf64acf7ead856209749d0d125e9ade2d908e7f': - return 'https://seeklogo.com/images/T/tether-usdt-logo-FA55C7F397-seeklogo.com.png' - } - } let address = inputAddress if (address === ZERO_ADDRESS) { address = WETH[chainId].address From 948b30ac450bbb4ac3efcd2cf1f44485961501e2 Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 24 Aug 2023 20:06:38 +0700 Subject: [PATCH 2/2] fix truesight footer position --- src/pages/TrueSightV2/components/TruesightFooter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/TrueSightV2/components/TruesightFooter.tsx b/src/pages/TrueSightV2/components/TruesightFooter.tsx index 8557d9b152..363ece40f3 100644 --- a/src/pages/TrueSightV2/components/TruesightFooter.tsx +++ b/src/pages/TrueSightV2/components/TruesightFooter.tsx @@ -22,7 +22,7 @@ const slideInFromBottom = keyframes` const Wrapper = styled(Row)` background-color: ${({ theme }) => theme.background}; height: 44px; - position: sticky; + position: fixed; bottom: 0; left: 0; right: 0;