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 { ListModel {
id: dappsModel id: dappsModel
ListElement { ListElement {
name: "Test dApp 1" name: ""
url: "https://dapp.test/1" url: "https://dapp.test/1"
iconUrl: "https://se-sdk-dapp.vercel.app/assets/eip155:1.png" iconUrl: "https://se-sdk-dapp.vercel.app/assets/eip155:1.png"
} }
ListElement { ListElement {
name: "Test dApp 2" name: "Test dApp 2"
url: "https://dapp.test/2" url: "https://dapp.test/2"
iconUrl: "https://react-app.walletconnect.com/assets/eip155-1.png" iconUrl: ""
} }
ListElement { ListElement {
name: "Test dApp 3" name: ""
url: "https://dapp.test/3" url: "https://dapp.test/3"
iconUrl: "https://react-app.walletconnect.com/assets/eip155-1.png" iconUrl: ""
} }
ListElement { ListElement {
name: "Test dApp 4 - very long name !!!!!!!!!!!!!!!!" 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.Core.Theme 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
MouseArea { MouseArea {
id: root id: root
@ -36,13 +37,16 @@ MouseArea {
visible: !fallbackImage.visible visible: !fallbackImage.visible
} }
StatusIcon { StatusSmartIdenticon {
id: fallbackImage id: fallbackImage
anchors.fill: parent anchors.fill: parent
icon: "dapp" name: dAppCaption.text ?? "dapp"
color: Theme.palette.baseColor1 asset.charactersLen: 2
asset.color: Theme.palette.primaryColor1
asset.letterIdenticonBgWithAlpha: true
asset.useAcronymForLetterIdenticon: false
visible: iconImage.isLoading || iconImage.isError || !root.iconUrl visible: iconImage.isLoading || iconImage.isError || !root.iconUrl
} }
@ -63,7 +67,9 @@ MouseArea {
Layout.rightMargin: 12 Layout.rightMargin: 12
StatusBaseText { StatusBaseText {
text: root.name id: dAppCaption
text: root.name ? root.name : SQUtils.StringUtils.extractDomainFromLink(root.url)
Layout.fillWidth: true Layout.fillWidth: true