feat(wallet): Handled failed to load collectible image state (#14229)

This commit is contained in:
Cuteivist 2024-03-30 06:00:00 +01:00 committed by GitHub
parent b191caaec6
commit 6dec612f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View File

@ -10413,6 +10413,7 @@
<file>assets/img/icons/caution.svg</file>
<file>assets/img/icons/crown-off.svg</file>
<file>assets/img/icons/xtwitter.svg</file>
<file>assets/img/icons/frowny.svg</file>
<file>assets/img/icons/tiny/folder.svg</file>
<file>assets/img/icons/tiny/profile.svg</file>
</qresource>

View File

@ -0,0 +1,6 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15 8.5C15 9.32843 14.3284 10 13.5 10C12.6716 10 12 9.32843 12 8.5C12 7.67157 12.6716 7 13.5 7C14.3284 7 15 7.67157 15 8.5Z" fill="black"/>
<path d="M6.5 10C7.32843 10 8 9.32843 8 8.5C8 7.67157 7.32843 7 6.5 7C5.67157 7 5 7.67157 5 8.5C5 9.32843 5.67157 10 6.5 10Z" fill="black"/>
<path d="M6.46422 15.2144C6.75712 15.5073 7.22903 15.5008 7.56858 15.2636C8.25747 14.7823 9.09565 14.5 9.99976 14.5C10.9039 14.5 11.742 14.7823 12.4309 15.2636C12.7705 15.5008 13.2424 15.5073 13.5353 15.2144C13.8282 14.9215 13.8308 14.4421 13.5024 14.1896C12.5326 13.4435 11.318 13 9.99976 13C8.68155 13 7.46695 13.4435 6.49708 14.1896C6.16876 14.4421 6.17133 14.9215 6.46422 15.2144Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM10 18.5C14.6944 18.5 18.5 14.6944 18.5 10C18.5 5.30558 14.6944 1.5 10 1.5C5.30558 1.5 1.5 5.30558 1.5 10C1.5 14.6944 5.30558 18.5 10 18.5Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -48,7 +48,7 @@ Item {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
collectibleName: collectible.name
collectibleName: !!collectible.name ? collectible.name : qsTr("Unknown")
collectibleId: "#" + collectible.tokenId
collectionTag.tagPrimaryLabel.text: !!communityDetails ? communityDetails.name : collectible.collectionName
isCollection: !!collectible.collectionName
@ -107,16 +107,44 @@ Item {
StatusRoundedMedia {
id: collectibleimage
readonly property bool isEmpty: !mediaUrl.toString() && !fallbackImageUrl.toString()
visible: !privilegedCollectibleImage.visible
width: 248
height: width
radius: Style.current.radius
color: collectible.backgroundColor
color: isError || isEmpty ? Theme.palette.baseColor5 : collectible.backgroundColor
border.color: Theme.palette.directColor8
border.width: 1
mediaUrl: collectible.mediaUrl ?? ""
mediaType: collectible.mediaType ?? ""
fallbackImageUrl: collectible.imageUrl
Column {
anchors.centerIn: parent
visible: collectibleimage.isError || collectibleimage.isEmpty
spacing: 10
StatusIcon {
anchors.horizontalCenter: parent.horizontalCenter
icon: "frowny"
opacity: 0.1
color: Theme.palette.directColor1
}
StatusBaseText {
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Qt.AlignHCenter
color: Theme.palette.directColor6
text: {
if (collectibleimage.isError && collectibleimage.componentMediaType === StatusRoundedMedia.MediaType.Unkown) {
return qsTr("Unsupported\nfile format")
}
if (!collectible.description && !collectible.name) {
return qsTr("Info can't\nbe fetched")
}
return qsTr("Failed\nto load")
}
}
}
}
Column {