Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some bugs #2192

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/Announcement/Popups/SnippetPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
19 changes: 15 additions & 4 deletions src/hooks/social.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,33 @@ 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()

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
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TrueSightV2/components/TruesightFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading