fix(ManageTokensGroupDelegate): some smaller UI fixes
- add placeholder image if the collection/community has none - elide the whole group name, taking into account the copy button - fix the tooltip position over such elided text - do not go overboard and don't use a StatusSmartIdention just to to display a rounded icon/image
This commit is contained in:
parent
a6172eb1de
commit
9c5d132cb0
|
@ -26,10 +26,11 @@ DropArea {
|
||||||
property bool isHidden // inside the "Hidden" section
|
property bool isHidden // inside the "Hidden" section
|
||||||
|
|
||||||
readonly property string groupId: isCollection ? model.collectionUid : model.communityId
|
readonly property string groupId: isCollection ? model.collectionUid : model.communityId
|
||||||
|
readonly property string groupImage: !!model ? model.communityImage || model.imageUrl : ""
|
||||||
readonly property int childCount: model.enabledNetworkBalance // NB using "balance" as "count" in the grouped model
|
readonly property int childCount: model.enabledNetworkBalance // NB using "balance" as "count" in the grouped model
|
||||||
readonly property alias title: groupedCommunityTokenDelegate.title
|
readonly property alias title: groupedCommunityTokenDelegate.title
|
||||||
|
|
||||||
readonly property bool unknownCommunityName: model.communityName.startsWith("0x") && model.communityName == model.communityId
|
readonly property bool unknownCommunityName: model.communityName.startsWith("0x") && model.communityName === model.communityId
|
||||||
|
|
||||||
ListView.onRemove: SequentialAnimation {
|
ListView.onRemove: SequentialAnimation {
|
||||||
PropertyAction { target: root; property: "ListView.delayRemove"; value: true }
|
PropertyAction { target: root; property: "ListView.delayRemove"; value: true }
|
||||||
|
@ -50,6 +51,11 @@ DropArea {
|
||||||
drag.accept()
|
drag.accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: d
|
||||||
|
readonly property int iconSize: root.isCollectible ? 44 : 32
|
||||||
|
}
|
||||||
|
|
||||||
StatusDraggableListItem {
|
StatusDraggableListItem {
|
||||||
id: groupedCommunityTokenDelegate
|
id: groupedCommunityTokenDelegate
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -65,7 +71,7 @@ DropArea {
|
||||||
|
|
||||||
if (root.unknownCommunityName) {
|
if (root.unknownCommunityName) {
|
||||||
if (communityNameArea.hovered) {
|
if (communityNameArea.hovered) {
|
||||||
return qsTr("Community %1").arg(StatusQUtils.Utils.elideAndFormatWalletAddress(model.communityName))
|
return qsTr("Community %1").arg(model.communityName)
|
||||||
}
|
}
|
||||||
return qsTr("Unknown community")
|
return qsTr("Unknown community")
|
||||||
}
|
}
|
||||||
|
@ -89,63 +95,53 @@ DropArea {
|
||||||
color: root.dragEnabled ? Theme.palette.baseColor1 : Theme.palette.baseColor2
|
color: root.dragEnabled ? Theme.palette.baseColor1 : Theme.palette.baseColor2
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusSmartIdenticon {
|
StatusRoundIcon {
|
||||||
id: identicon
|
Layout.preferredWidth: d.iconSize
|
||||||
Layout.preferredWidth: visible ? 32 : 0
|
Layout.preferredHeight: d.iconSize
|
||||||
Layout.preferredHeight: visible ? 32 : 0
|
radius: root.isCollection ? Style.current.radius : height/2
|
||||||
asset.width: 32
|
visible: root.unknownCommunityName || !root.groupImage
|
||||||
asset.height: 32
|
asset.name: root.unknownCommunityName ? "help" : root.isCollection ? "gallery" : "group"
|
||||||
visible: root.unknownCommunityName
|
asset.color: root.unknownCommunityName ? Theme.palette.directColor1 : "black"
|
||||||
asset.name: "help"
|
asset.bgColor: root.unknownCommunityName ? Theme.palette.primaryColor3 : model.backgroundColor
|
||||||
asset.color: Theme.palette.baseColor1
|
|
||||||
asset.isImage: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusRoundedImage {
|
StatusRoundedImage {
|
||||||
visible: !root.unknownCommunityName
|
visible: !!root.groupImage
|
||||||
radius: root.isCollection ? Style.current.radius : height/2
|
radius: root.isCollection ? Style.current.radius : height/2
|
||||||
Layout.preferredWidth: {
|
Layout.preferredWidth: d.iconSize
|
||||||
if (!visible){
|
Layout.preferredHeight: d.iconSize
|
||||||
return 0
|
|
||||||
}
|
image.source: root.groupImage
|
||||||
return root.isCollectible ? 44 : 32
|
|
||||||
}
|
|
||||||
Layout.preferredHeight: {
|
|
||||||
if (!visible){
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return root.isCollectible ? 44 : 32
|
|
||||||
}
|
|
||||||
image.source: {
|
|
||||||
if(root.isCollection) {
|
|
||||||
return model.imageUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
return model.communityImage // FIXME unify group image
|
|
||||||
}
|
|
||||||
showLoadingIndicator: true
|
showLoadingIndicator: true
|
||||||
image.fillMode: Image.PreserveAspectCrop
|
image.fillMode: Image.PreserveAspectCrop
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
Row {
|
||||||
id: communityNameRow
|
id: communityNameRow
|
||||||
spacing: 2
|
spacing: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: Math.min(implicitWidth, parent.width - copyButton.width)
|
||||||
text: groupedCommunityTokenDelegate.title
|
text: groupedCommunityTokenDelegate.title
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
|
|
||||||
|
StatusToolTip {
|
||||||
|
text: qsTr("Community name could not be fetched")
|
||||||
|
visible: root.unknownCommunityName && communityNameArea.hovered
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyToClipBoardButton {
|
CopyToClipBoardButton {
|
||||||
|
id: copyButton
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: root.unknownCommunityName && communityNameArea.hovered
|
visible: root.unknownCommunityName && communityNameArea.hovered
|
||||||
icon.height: Theme.primaryTextFontSize
|
icon.height: Theme.primaryTextFontSize
|
||||||
icon.width: Theme.primaryTextFontSize
|
icon.width: Theme.primaryTextFontSize
|
||||||
icon.color: Theme.palette.directColor1
|
icon.color: Theme.palette.directColor1
|
||||||
Layout.preferredWidth: 16
|
|
||||||
Layout.preferredHeight: 16
|
|
||||||
color: Style.current.transparent
|
color: Style.current.transparent
|
||||||
textToCopy: model.communityName
|
textToCopy: model.communityName
|
||||||
onCopyClicked: {
|
onCopyClicked: {
|
||||||
|
@ -153,21 +149,11 @@ DropArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusToolTip {
|
|
||||||
id: communityNameToolTip
|
|
||||||
text: qsTr("Community name could not be fetched")
|
|
||||||
visible: root.unknownCommunityName && communityNameArea.hovered
|
|
||||||
orientation: StatusToolTip.Orientation.Top
|
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: communityNameArea
|
id: communityNameArea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
ManageTokensCommunityTag {
|
ManageTokensCommunityTag {
|
||||||
communityName: root.childCount
|
communityName: root.childCount
|
||||||
communityId: ""
|
communityId: ""
|
||||||
|
|
Loading…
Reference in New Issue