2024-10-15 21:26:12 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtGraphicalEffects 1.15
|
2021-09-28 18:04:06 +03:00
|
|
|
|
2023-01-12 23:39:46 +01:00
|
|
|
import StatusQ.Core 0.1
|
2024-05-20 14:18:44 +02:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2023-01-12 23:39:46 +01:00
|
|
|
|
2021-09-28 18:04:06 +03:00
|
|
|
import utils 1.0
|
2021-10-28 00:27:49 +03:00
|
|
|
import shared 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2022-02-14 19:27:23 -04:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2023-09-05 17:27:30 +02:00
|
|
|
import shared.popups.send 1.0
|
2023-11-28 20:16:18 +01:00
|
|
|
import shared.stores.send 1.0
|
2022-02-14 19:27:23 -04:00
|
|
|
|
|
|
|
//TODO remove this dependency!
|
2024-05-22 11:13:39 +03:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
2024-02-05 17:44:49 +01:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
2021-03-08 15:24:39 -04:00
|
|
|
|
2021-10-14 13:33:34 +02:00
|
|
|
// TODO: replace with StatusModal
|
2021-03-08 15:24:39 -04:00
|
|
|
ModalPopup {
|
|
|
|
id: stickerPackDetailsPopup
|
|
|
|
|
2023-04-12 12:31:35 +02:00
|
|
|
property string packId
|
2021-03-08 15:24:39 -04:00
|
|
|
|
2024-05-22 11:13:39 +03:00
|
|
|
property ChatStores.RootStore store
|
2024-02-05 17:44:49 +01:00
|
|
|
required property WalletAssetsStore walletAssetsStore
|
2024-10-04 09:46:53 +02:00
|
|
|
required property var sendModalPopup
|
2021-03-08 15:24:39 -04:00
|
|
|
property string thumbnail: ""
|
|
|
|
property string name: ""
|
|
|
|
property string author: ""
|
2023-04-12 21:08:42 +02:00
|
|
|
property string price
|
2024-05-22 11:13:39 +03:00
|
|
|
property bool installed: false
|
|
|
|
property bool bought: false
|
|
|
|
property bool pending: false
|
|
|
|
property var stickers
|
2023-04-12 12:31:35 +02:00
|
|
|
signal buyClicked(string packId)
|
2021-03-08 15:24:39 -04:00
|
|
|
|
2024-07-23 17:26:13 +02:00
|
|
|
onAboutToShow: {
|
|
|
|
stickersModule.getInstalledStickerPacks()
|
|
|
|
|
2024-05-22 11:13:39 +03:00
|
|
|
const idx = stickersModule.stickerPacks.findIndexById(packId, false)
|
|
|
|
if(idx === -1) close()
|
2024-05-20 14:18:44 +02:00
|
|
|
const item = SQUtils.ModelUtils.get(stickersModule.stickerPacks, idx)
|
|
|
|
name = item.name
|
|
|
|
author = item.author
|
|
|
|
thumbnail = item.thumbnail
|
|
|
|
price = item.price
|
2024-07-23 17:26:13 +02:00
|
|
|
stickers = item.stickers
|
2024-05-20 14:18:44 +02:00
|
|
|
installed = item.installed
|
|
|
|
bought = item.bought
|
|
|
|
pending = item.pending
|
2021-03-08 15:24:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
height: 472
|
|
|
|
header: StatusStickerPackDetails {
|
|
|
|
id: stickerGrid
|
|
|
|
packThumb: thumbnail
|
|
|
|
packName: name
|
|
|
|
packAuthor: author
|
|
|
|
packNameFontSize: 17
|
2024-10-15 21:26:12 +02:00
|
|
|
spacing: Theme.padding / 2
|
2021-03-08 15:24:39 -04:00
|
|
|
}
|
2021-03-26 17:21:50 -04:00
|
|
|
|
|
|
|
contentWrapper.anchors.topMargin: 0
|
|
|
|
contentWrapper.anchors.bottomMargin: 0
|
2023-04-12 14:15:39 +02:00
|
|
|
contentWrapper.anchors.rightMargin: 0
|
2021-03-26 17:21:50 -04:00
|
|
|
StatusStickerList {
|
|
|
|
id: stickerGridInPopup
|
|
|
|
model: stickers
|
|
|
|
anchors.fill: parent
|
2024-10-15 21:26:12 +02:00
|
|
|
anchors.topMargin: Theme.padding
|
2021-12-08 23:20:43 +02:00
|
|
|
packId: stickerPackDetailsPopup.packId
|
2021-03-26 17:21:50 -04:00
|
|
|
}
|
|
|
|
|
2021-03-08 15:24:39 -04:00
|
|
|
footer: StatusStickerButton {
|
|
|
|
anchors.right: parent.right
|
|
|
|
style: StatusStickerButton.StyleType.LargeNoIcon
|
|
|
|
packPrice: price
|
|
|
|
isInstalled: installed
|
|
|
|
isBought: bought
|
|
|
|
isPending: pending
|
2023-04-12 13:23:33 +02:00
|
|
|
greyedOut: !store.networkConnectionStore.stickersNetworkAvailable
|
2023-04-12 12:31:35 +02:00
|
|
|
tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText
|
2021-03-08 15:24:39 -04:00
|
|
|
onInstallClicked: {
|
2024-05-22 11:13:39 +03:00
|
|
|
stickersModule.install(packId)
|
|
|
|
stickerPackDetailsPopup.close()
|
2021-03-08 15:24:39 -04:00
|
|
|
}
|
|
|
|
onUninstallClicked: {
|
2021-11-25 12:12:19 -05:00
|
|
|
stickersModule.uninstall(packId);
|
2021-03-08 15:24:39 -04:00
|
|
|
stickerPackDetailsPopup.close();
|
|
|
|
}
|
|
|
|
onCancelClicked: function(){}
|
|
|
|
onUpdateClicked: function(){}
|
|
|
|
onBuyClicked: {
|
2024-10-04 09:46:53 +02:00
|
|
|
const token = SQUtils.ModelUtils.getByKey(stickerPackDetailsPopup.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", stickerPackDetailsPopup.store.stickersStore.getStatusTokenKey())
|
|
|
|
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.interactive = false
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedRecipient = stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress()
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedHoldingID = !!token && !!token.symbol ? token.symbol : ""
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedSendType = Constants.SendType.StickersBuy
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(parseFloat(stickerPackDetailsPopup.price))
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.preSelectedChainId = stickerPackDetailsPopup.store.appNetworkId
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.stickersPackId = stickerPackDetailsPopup.packId
|
|
|
|
stickerPackDetailsPopup.sendModalPopup.open()
|
|
|
|
|
|
|
|
stickerPackDetailsPopup.buyClicked(stickerPackDetailsPopup.packId)
|
2021-03-08 15:24:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|