2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2020-08-18 18:46:11 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
import "../../../../shared"
|
2021-10-14 13:09:35 +00:00
|
|
|
import "../../../../shared/panels"
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../helpers/collectiblesData.js" as CollectiblesData
|
|
|
|
import "../popups"
|
|
|
|
import "../panels"
|
|
|
|
import "../stores"
|
2020-05-28 14:54:42 +00:00
|
|
|
|
|
|
|
Item {
|
2020-08-18 18:46:11 +00:00
|
|
|
id: root
|
2020-07-28 18:19:46 +00:00
|
|
|
|
2020-08-20 21:59:07 +00:00
|
|
|
StyledText {
|
|
|
|
id: noCollectiblesText
|
|
|
|
color: Style.current.secondaryText
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Collectibles will appear here"
|
|
|
|
text: qsTrId("collectibles-will-appear-here")
|
2020-08-20 21:59:07 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 15
|
2020-07-30 20:46:25 +00:00
|
|
|
}
|
|
|
|
|
2020-08-19 15:58:25 +00:00
|
|
|
CollectiblesModal {
|
|
|
|
id: collectiblesModalComponent
|
|
|
|
}
|
|
|
|
|
2020-08-20 21:59:07 +00:00
|
|
|
function checkCollectiblesVisibility() {
|
|
|
|
// Show the collectibles section only if at least one of the sub-items is visible
|
|
|
|
// Sub-items are visible only if they are loading or have more than zero collectible
|
|
|
|
let showCollectibles = false
|
|
|
|
let currentItem
|
|
|
|
for (let i = 0; i < collectiblesRepeater.count; i++) {
|
|
|
|
currentItem = collectiblesRepeater.itemAt(i)
|
|
|
|
if (currentItem && currentItem.active) {
|
|
|
|
showCollectibles = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
noCollectiblesText.visible = !showCollectibles
|
|
|
|
collectiblesSection.visible = showCollectibles
|
|
|
|
}
|
2020-08-18 18:46:11 +00:00
|
|
|
|
2020-08-20 21:59:07 +00:00
|
|
|
Column {
|
|
|
|
id: collectiblesSection
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
anchors.fill: parent
|
2020-08-19 17:07:07 +00:00
|
|
|
|
2020-08-20 21:59:07 +00:00
|
|
|
Repeater {
|
|
|
|
id: collectiblesRepeater
|
2021-10-05 20:50:22 +00:00
|
|
|
model: RootStore.collectiblesList
|
2020-08-19 17:07:07 +00:00
|
|
|
|
|
|
|
CollectiblesContainer {
|
2020-08-20 21:59:07 +00:00
|
|
|
property var collectibleData: CollectiblesData.collectiblesData[model.collectibleType]
|
2020-08-19 17:07:07 +00:00
|
|
|
|
2020-08-20 21:59:07 +00:00
|
|
|
collectibleName: collectibleData.collectibleName
|
2021-09-28 15:04:06 +00:00
|
|
|
collectibleIconSource: Style.png("collectibles/" + collectibleData.collectibleIconSource)
|
2020-08-19 17:07:07 +00:00
|
|
|
collectiblesModal: collectiblesModalComponent
|
2020-08-20 21:59:07 +00:00
|
|
|
buttonText: collectibleData.buttonText
|
|
|
|
getLink: collectibleData.getLink
|
2020-08-27 14:41:50 +00:00
|
|
|
onActiveChanged: {
|
2020-08-20 21:59:07 +00:00
|
|
|
checkCollectiblesVisibility()
|
2020-08-19 17:07:07 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
onReloadCollectibles: {
|
|
|
|
RootStore.reloadCollectible(collectibleType)
|
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
}
|
2020-08-18 18:46:11 +00:00
|
|
|
}
|
2020-07-28 18:19:46 +00:00
|
|
|
}
|
2020-08-24 20:50:49 +00:00
|
|
|
|
|
|
|
Connections {
|
2021-10-05 20:50:22 +00:00
|
|
|
target: RootStore.collectiblesList
|
2020-08-24 20:50:49 +00:00
|
|
|
onDataChanged: {
|
|
|
|
checkCollectiblesVisibility()
|
|
|
|
}
|
|
|
|
}
|
2020-05-28 14:54:42 +00:00
|
|
|
}
|