fix: fix pixelated icon and add description and URL for kudos
This commit is contained in:
parent
f4d16d7661
commit
95f4bd8d09
|
@ -7,6 +7,8 @@ type
|
||||||
Image = UserRole + 2
|
Image = UserRole + 2
|
||||||
CollectibleId = UserRole + 3
|
CollectibleId = UserRole + 3
|
||||||
CollectibleType = UserRole + 4
|
CollectibleType = UserRole + 4
|
||||||
|
Description = UserRole + 5
|
||||||
|
ExternalUrl = UserRole + 6
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type CollectiblesList* = ref object of QAbstractListModel
|
type CollectiblesList* = ref object of QAbstractListModel
|
||||||
|
@ -38,12 +40,16 @@ QtObject:
|
||||||
of CollectiblesRoles.Image: result = newQVariant(collectible.image)
|
of CollectiblesRoles.Image: result = newQVariant(collectible.image)
|
||||||
of CollectiblesRoles.CollectibleId: result = newQVariant(collectible.id)
|
of CollectiblesRoles.CollectibleId: result = newQVariant(collectible.id)
|
||||||
of CollectiblesRoles.CollectibleType: result = newQVariant(collectible.collectibleType)
|
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] =
|
method roleNames(self: CollectiblesList): Table[int, string] =
|
||||||
{ CollectiblesRoles.Name.int:"name",
|
{ CollectiblesRoles.Name.int:"name",
|
||||||
CollectiblesRoles.Image.int:"image",
|
CollectiblesRoles.Image.int:"image",
|
||||||
CollectiblesRoles.CollectibleId.int:"collectibleId",
|
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) =
|
proc addCollectibleToList*(self: CollectiblesList, colelctible: Collectible) =
|
||||||
self.beginInsertRows(newQModelIndex(), self.collectibles.len, self.collectibles.len)
|
self.beginInsertRows(newQModelIndex(), self.collectibles.len, self.collectibles.len)
|
||||||
|
|
|
@ -2,7 +2,7 @@ from eventemitter import Args
|
||||||
import ../libstatus/types
|
import ../libstatus/types
|
||||||
|
|
||||||
type Collectible* = ref object
|
type Collectible* = ref object
|
||||||
name*, image*, id*, collectibleType*: string
|
name*, image*, id*, collectibleType*, description*, externalUrl*: string
|
||||||
|
|
||||||
type CurrencyArgs* = ref object of Args
|
type CurrencyArgs* = ref object of Args
|
||||||
currency*: string
|
currency*: string
|
||||||
|
|
|
@ -78,7 +78,12 @@ proc getCryptoKitties*(address: EthAddress): seq[Collectible] =
|
||||||
finalId = $id
|
finalId = $id
|
||||||
if (not (name.kind == JNull)):
|
if (not (name.kind == JNull)):
|
||||||
finalName = $name
|
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:
|
except Exception as e2:
|
||||||
error "Error with this individual cat", msg = e2.msg, cat = kitty
|
error "Error with this individual cat", msg = e2.msg, cat = kitty
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -105,7 +110,12 @@ proc getEthermons*(address: EthAddress): seq[Collectible] =
|
||||||
var i = 0
|
var i = 0
|
||||||
for monsterKey in json.keys(monsters):
|
for monsterKey in json.keys(monsters):
|
||||||
let monster = monsters[monsterKey]
|
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
|
i = i + 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error getting Ethermons", msg = e.msg
|
error "Error getting Ethermons", msg = e.msg
|
||||||
|
@ -133,7 +143,12 @@ proc getKudos*(address: EthAddress): seq[Collectible] =
|
||||||
let response = client.request(url)
|
let response = client.request(url)
|
||||||
let kudo = parseJson(response.body)
|
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:
|
except Exception as e:
|
||||||
error "Error getting Kudos", msg = e.msg
|
error "Error getting Kudos", msg = e.msg
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ Item {
|
||||||
collectiblesModal: collectiblesModalComponent
|
collectiblesModal: collectiblesModalComponent
|
||||||
buttonText: qsTr("View in Ethermon")
|
buttonText: qsTr("View in Ethermon")
|
||||||
getLink: function (id) {
|
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
|
isLoading: root.isLoading
|
||||||
collectiblesModal: collectiblesModalComponent
|
collectiblesModal: collectiblesModalComponent
|
||||||
buttonText: qsTr("View in Gitcoin")
|
buttonText: qsTr("View in Gitcoin")
|
||||||
getLink: function (id) {
|
getLink: function (id, externalUrl) {
|
||||||
return ""
|
return externalUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,24 +6,6 @@ import "../../../../../imports"
|
||||||
import "../../../../../shared"
|
import "../../../../../shared"
|
||||||
|
|
||||||
ScrollView {
|
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
|
readonly property int imageSize: 164
|
||||||
property string collectibleType: "cryptokitty"
|
property string collectibleType: "cryptokitty"
|
||||||
property var collectiblesModal
|
property var collectiblesModal
|
||||||
|
@ -100,10 +82,9 @@ ScrollView {
|
||||||
collectiblesModal.openModal({
|
collectiblesModal.openModal({
|
||||||
name: name,
|
name: name,
|
||||||
id: collectibleId,
|
id: collectibleId,
|
||||||
// TODO do we even have a description?
|
description: description,
|
||||||
description: "",
|
|
||||||
buttonText: root.buttonText,
|
buttonText: root.buttonText,
|
||||||
link: root.getLink(collectibleId),
|
link: root.getLink(collectibleId, externalUrl),
|
||||||
image: image
|
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 |
Loading…
Reference in New Issue