fix(dApps): Added default dApp icon according to the new spec. Extracting dApp name from its url, if no name is provided through walletconnect API. (#15754)

Closes #15593
This commit is contained in:
Roman Chornii 2024-07-25 15:43:52 +03:00 committed by GitHub
parent 7af8ede0e2
commit 4bbdeba020
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 8 deletions

View File

@ -28,19 +28,19 @@ SplitView {
ListModel {
id: dappsModel
ListElement {
name: "Test dApp 1"
name: ""
url: "https://dapp.test/1"
iconUrl: "https://se-sdk-dapp.vercel.app/assets/eip155:1.png"
}
ListElement {
name: "Test dApp 2"
url: "https://dapp.test/2"
iconUrl: "https://react-app.walletconnect.com/assets/eip155-1.png"
iconUrl: ""
}
ListElement {
name: "Test dApp 3"
name: ""
url: "https://dapp.test/3"
iconUrl: "https://react-app.walletconnect.com/assets/eip155-1.png"
iconUrl: ""
}
ListElement {
name: "Test dApp 4 - very long name !!!!!!!!!!!!!!!!"

View File

@ -6,6 +6,7 @@ import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
MouseArea {
id: root
@ -36,13 +37,16 @@ MouseArea {
visible: !fallbackImage.visible
}
StatusIcon {
StatusSmartIdenticon {
id: fallbackImage
anchors.fill: parent
icon: "dapp"
color: Theme.palette.baseColor1
name: dAppCaption.text ?? "dapp"
asset.charactersLen: 2
asset.color: Theme.palette.primaryColor1
asset.letterIdenticonBgWithAlpha: true
asset.useAcronymForLetterIdenticon: false
visible: iconImage.isLoading || iconImage.isError || !root.iconUrl
}
@ -63,7 +67,9 @@ MouseArea {
Layout.rightMargin: 12
StatusBaseText {
text: root.name
id: dAppCaption
text: root.name ? root.name : SQUtils.StringUtils.extractDomainFromLink(root.url)
Layout.fillWidth: true