-
Notifications
You must be signed in to change notification settings - Fork 30
feature: EthHashInfo add customAvatar fallback #123
Conversation
ESLint Summary View Full Report
[warning] @typescript-eslint/no-unused-vars
Report generated by eslint-plus-action |
Travis automatic deployment: |
1 similar comment
Travis automatic deployment: |
src/ethereum/EthHashInfo/index.tsx
Outdated
): void => { | ||
if (customAvatarFallback && !fallbackToIdenticon) { | ||
error.currentTarget.onerror = null; | ||
error.currentTarget.src = customAvatarFallback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could avoid manipulating DOM directly?
setFallbackSrc(customAvatarFallback);
...
<StyledImg
src={fallbackSrc || customAvatar}
...
/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, I copied it directly from SRC.
what do you suggest? ref
perhpahs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a state variable, see the code snippet in my previous comment.
@@ -54,6 +54,7 @@ type Props = { | |||
textSize?: ThemeTextSize; | |||
showAvatar?: boolean; | |||
customAvatar?: string; | |||
customAvatarFallback?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this image always going to be the <>
icon? If so, we could just store the SVG in the repo. Or at least use it as the default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 different repositories.
<>
is needed at this moment in SRC, but as this lib is also helpful for SApp I would not use it as a default one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Please update the snapshots.
… into EthHashInfo-image-fallback
Travis automatic deployment: |
We need to handle the case for when
customAvatar
is broken.customAvatarFallaback
that receives an URL to callback in case the main image is brokencustomAvatarFallaback
was provided it fallback to Identicon.These changes are needed for https://app.zenhub.com/workspaces/safe-multisig---web-5ce554debb310a35b2f8b6f8/issues/gnosis/safe-react/2133