diff --git a/src/app/wallet/views/collectibles_list.nim b/src/app/wallet/views/collectibles_list.nim index 4ba553ce7..5996e52a9 100644 --- a/src/app/wallet/views/collectibles_list.nim +++ b/src/app/wallet/views/collectibles_list.nim @@ -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) diff --git a/src/status/wallet/account.nim b/src/status/wallet/account.nim index d13ed5987..5e5969514 100644 --- a/src/status/wallet/account.nim +++ b/src/status/wallet/account.nim @@ -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 diff --git a/src/status/wallet/collectibles.nim b/src/status/wallet/collectibles.nim index 1f08f6d40..cee201b46 100644 --- a/src/status/wallet/collectibles.nim +++ b/src/status/wallet/collectibles.nim @@ -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 diff --git a/ui/app/AppLayouts/Wallet/CollectiblesTab.qml b/ui/app/AppLayouts/Wallet/CollectiblesTab.qml index 71ba19434..b8f693069 100644 --- a/ui/app/AppLayouts/Wallet/CollectiblesTab.qml +++ b/ui/app/AppLayouts/Wallet/CollectiblesTab.qml @@ -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 } } } diff --git a/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesContent.qml b/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesContent.qml index 34f3d055e..01b05831b 100644 --- a/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesContent.qml +++ b/ui/app/AppLayouts/Wallet/components/collectiblesComponents/CollectiblesContent.qml @@ -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 }) } diff --git a/ui/app/img/collectibles/ethermons.png b/ui/app/img/collectibles/ethermons.png index 8fc72f1d4..f8d85dc37 100644 Binary files a/ui/app/img/collectibles/ethermons.png and b/ui/app/img/collectibles/ethermons.png differ diff --git a/ui/app/img/collectibles/kudos.png b/ui/app/img/collectibles/kudos.png index b5d43e082..cc7dbfd6e 100644 Binary files a/ui/app/img/collectibles/kudos.png and b/ui/app/img/collectibles/kudos.png differ