fix: fix pixelated icon and add description and URL for kudos

This commit is contained in:
Jonathan Rainville 2020-08-20 10:16:58 -04:00
parent f4d16d7661
commit 95f4bd8d09
7 changed files with 32 additions and 29 deletions

View File

@ -7,6 +7,8 @@ type
Image = UserRole + 2
CollectibleId = UserRole + 3
CollectibleType = UserRole + 4
Description = UserRole + 5
ExternalUrl = UserRole + 6
QtObject:
type CollectiblesList* = ref object of QAbstractListModel
@ -38,12 +40,16 @@ QtObject:
of CollectiblesRoles.Image: result = newQVariant(collectible.image)
of CollectiblesRoles.CollectibleId: result = newQVariant(collectible.id)
of CollectiblesRoles.CollectibleType: result = newQVariant(collectible.collectibleType)
of CollectiblesRoles.Description: result = newQVariant(collectible.description)
of CollectiblesRoles.ExternalUrl: result = newQVariant(collectible.externalUrl)
method roleNames(self: CollectiblesList): Table[int, string] =
{ CollectiblesRoles.Name.int:"name",
CollectiblesRoles.Image.int:"image",
CollectiblesRoles.CollectibleId.int:"collectibleId",
CollectiblesRoles.CollectibleType.int:"collectibleType" }.toTable
CollectiblesRoles.CollectibleType.int:"collectibleType",
CollectiblesRoles.Description.int:"description",
CollectiblesRoles.ExternalUrl.int:"externalUrl" }.toTable
proc addCollectibleToList*(self: CollectiblesList, colelctible: Collectible) =
self.beginInsertRows(newQModelIndex(), self.collectibles.len, self.collectibles.len)

View File

@ -2,7 +2,7 @@ from eventemitter import Args
import ../libstatus/types
type Collectible* = ref object
name*, image*, id*, collectibleType*: string
name*, image*, id*, collectibleType*, description*, externalUrl*: string
type CurrencyArgs* = ref object of Args
currency*: string

View File

@ -78,7 +78,12 @@ proc getCryptoKitties*(address: EthAddress): seq[Collectible] =
finalId = $id
if (not (name.kind == JNull)):
finalName = $name
result.add(Collectible(id: finalId, name: finalName, image: kitty["image_url_png"].str, collectibleType: CRYPTOKITTY))
result.add(Collectible(id: finalId,
name: finalName,
image: kitty["image_url_png"].str,
collectibleType: CRYPTOKITTY,
description: "",
externalUrl: ""))
except Exception as e2:
error "Error with this individual cat", msg = e2.msg, cat = kitty
except Exception as e:
@ -105,7 +110,12 @@ proc getEthermons*(address: EthAddress): seq[Collectible] =
var i = 0
for monsterKey in json.keys(monsters):
let monster = monsters[monsterKey]
result.add(Collectible(id: $tokens[i], name: monster["class_name"].str, image: monster["image"].str, collectibleType: ETHERMON))
result.add(Collectible(id: $tokens[i],
name: monster["class_name"].str,
image: monster["image"].str,
collectibleType: ETHERMON,
description: "",
externalUrl: ""))
i = i + 1
except Exception as e:
error "Error getting Ethermons", msg = e.msg
@ -133,7 +143,12 @@ proc getKudos*(address: EthAddress): seq[Collectible] =
let response = client.request(url)
let kudo = parseJson(response.body)
result.add(Collectible(id: $token, name: kudo["name"].str, image: kudo["image"].str, collectibleType: KUDO))
result.add(Collectible(id: $token,
name: kudo["name"].str,
image: kudo["image"].str,
collectibleType: KUDO,
description: kudo["description"].str,
externalUrl: kudo["external_url"].str))
except Exception as e:
error "Error getting Kudos", msg = e.msg

View File

@ -60,7 +60,8 @@ Item {
collectiblesModal: collectiblesModalComponent
buttonText: qsTr("View in Ethermon")
getLink: function (id) {
return `https://www.etheremon.com/#/mons/${id}`
// TODO find a more direct URL
return "https://ethermon.io/inventory"
}
}
@ -71,8 +72,8 @@ Item {
isLoading: root.isLoading
collectiblesModal: collectiblesModalComponent
buttonText: qsTr("View in Gitcoin")
getLink: function (id) {
return ""
getLink: function (id, externalUrl) {
return externalUrl
}
}
}

View File

@ -6,24 +6,6 @@ import "../../../../../imports"
import "../../../../../shared"
ScrollView {
property var collectibles: [{
name: "Kitty cat1",
image: "../../../../img/collectibles/placeholders/kitty.png",
collectibleId: "1337",
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
},
{
name: "Kitty cat2",
image: "../../../../img/collectibles/placeholders/kitty.png",
collectibleId: "1338",
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
},
{
name: "Kitty cat3",
image: "../../../../img/collectibles/placeholders/kitty.png",
collectibleId: "1339",
description: "Avast ye! I'm the dread pirate Furbeard, and I'll most likely sleep"
}]
readonly property int imageSize: 164
property string collectibleType: "cryptokitty"
property var collectiblesModal
@ -100,10 +82,9 @@ ScrollView {
collectiblesModal.openModal({
name: name,
id: collectibleId,
// TODO do we even have a description?
description: "",
description: description,
buttonText: root.buttonText,
link: root.getLink(collectibleId),
link: root.getLink(collectibleId, externalUrl),
image: image
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 1.7 KiB