mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 22:36:24 +00:00
feat(MintToken): Add navigation from retry to filled token form
Enable navigation from token view to new token view (edition). Closes #10878
This commit is contained in:
parent
f58f82d4c6
commit
7d551b8311
@ -88,6 +88,8 @@ SettingsPageLayout {
|
|||||||
property int burnAmount
|
property int burnAmount
|
||||||
property int remainingTokens
|
property int remainingTokens
|
||||||
property url artworkSource
|
property url artworkSource
|
||||||
|
property bool isAssetType
|
||||||
|
property var currentToken // CollectibleObject or AssetObject type
|
||||||
|
|
||||||
readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView
|
readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView
|
||||||
|
|
||||||
@ -107,6 +109,13 @@ SettingsPageLayout {
|
|||||||
onInitialItemChanged: updateInitialStackView()
|
onInitialItemChanged: updateInitialStackView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: temp_
|
||||||
|
|
||||||
|
property CollectibleObject collectible: CollectibleObject{}
|
||||||
|
property AssetObject asset: AssetObject{}
|
||||||
|
}
|
||||||
|
|
||||||
secondaryHeaderButton.type: StatusBaseButton.Type.Danger
|
secondaryHeaderButton.type: StatusBaseButton.Type.Danger
|
||||||
|
|
||||||
content: StackView {
|
content: StackView {
|
||||||
@ -129,6 +138,7 @@ SettingsPageLayout {
|
|||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: d.newTokenViewState
|
name: d.newTokenViewState
|
||||||
|
PropertyChanges {target: root; title: d.isAssetType ? d.newAssetPageTitle : d.newCollectiblePageTitle }
|
||||||
PropertyChanges {target: root; subTitle: ""}
|
PropertyChanges {target: root; subTitle: ""}
|
||||||
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
||||||
PropertyChanges {target: root; primaryHeaderButton.visible: false}
|
PropertyChanges {target: root; primaryHeaderButton.visible: false}
|
||||||
@ -151,8 +161,50 @@ SettingsPageLayout {
|
|||||||
onPrimaryHeaderButtonClicked: {
|
onPrimaryHeaderButtonClicked: {
|
||||||
if(root.state == d.initialViewState)
|
if(root.state == d.initialViewState)
|
||||||
stackManager.push(d.newTokenViewState, newTokenView, null, StackView.Immediate)
|
stackManager.push(d.newTokenViewState, newTokenView, null, StackView.Immediate)
|
||||||
if(root.state == d.tokenViewState)
|
|
||||||
d.retryMintClicked()
|
if(root.state == d.tokenViewState) {
|
||||||
|
if(d.currentToken) {
|
||||||
|
if(d.isAssetType) {
|
||||||
|
// Create new asset instance:
|
||||||
|
temp_.asset.clearAsset()
|
||||||
|
temp_.asset.copyAsset(d.currentToken)
|
||||||
|
|
||||||
|
// Update to point to new instance
|
||||||
|
d.currentToken = temp_.asset
|
||||||
|
|
||||||
|
// Reset the stack:
|
||||||
|
stackManager.clear(d.initialViewState, StackView.Immediate)
|
||||||
|
|
||||||
|
// Then move on to the new token view, but asset pre-filled:
|
||||||
|
stackManager.push(d.newTokenViewState,
|
||||||
|
newTokenView,
|
||||||
|
{
|
||||||
|
isAssetView: d.isAssetType,
|
||||||
|
asset: d.currentToken
|
||||||
|
},
|
||||||
|
StackView.Immediate)
|
||||||
|
} else {
|
||||||
|
// Create new collectible instance:
|
||||||
|
temp_.collectible.clearCollectible()
|
||||||
|
temp_.collectible.copyCollectible(d.currentToken)
|
||||||
|
|
||||||
|
// Update to point to new instance
|
||||||
|
d.currentToken = temp_.collectible
|
||||||
|
|
||||||
|
// Reset the stack:
|
||||||
|
stackManager.clear(d.initialViewState, StackView.Immediate)
|
||||||
|
|
||||||
|
// Then move on to the new token view, but collectible pre-filled:
|
||||||
|
stackManager.push(d.newTokenViewState,
|
||||||
|
newTokenView,
|
||||||
|
{
|
||||||
|
isAssetView: d.isAssetType,
|
||||||
|
collectible: d.currentToken
|
||||||
|
},
|
||||||
|
StackView.Immediate)
|
||||||
|
}
|
||||||
|
} else console.warn("Mint Token Settings - Trying to retry undefined token object.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSecondaryHeaderButtonClicked: {
|
onSecondaryHeaderButtonClicked: {
|
||||||
@ -187,6 +239,12 @@ SettingsPageLayout {
|
|||||||
id: newTokenView
|
id: newTokenView
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: _colLayout
|
||||||
|
|
||||||
|
property CollectibleObject collectible: CollectibleObject{}
|
||||||
|
property AssetObject asset: AssetObject{}
|
||||||
|
property bool isAssetView: false
|
||||||
|
|
||||||
width: root.viewWidth
|
width: root.viewWidth
|
||||||
spacing: Style.current.padding
|
spacing: Style.current.padding
|
||||||
|
|
||||||
@ -194,6 +252,7 @@ SettingsPageLayout {
|
|||||||
id: optionsTab
|
id: optionsTab
|
||||||
|
|
||||||
Layout.preferredWidth: root.viewWidth
|
Layout.preferredWidth: root.viewWidth
|
||||||
|
currentIndex: _colLayout.isAssetView ? 1 : 0
|
||||||
|
|
||||||
StatusSwitchTabButton {
|
StatusSwitchTabButton {
|
||||||
id: collectiblesTab
|
id: collectiblesTab
|
||||||
@ -206,12 +265,6 @@ SettingsPageLayout {
|
|||||||
|
|
||||||
text: qsTr("Assets")
|
text: qsTr("Assets")
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding {
|
|
||||||
target: root
|
|
||||||
property: "title"
|
|
||||||
value: optionsTab.currentItem == collectiblesTab ? d.newCollectiblePageTitle : d.newAssetPageTitle
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StackLayout {
|
StackLayout {
|
||||||
@ -220,9 +273,19 @@ SettingsPageLayout {
|
|||||||
|
|
||||||
currentIndex: optionsTab.currentItem == collectiblesTab ? 0 : 1
|
currentIndex: optionsTab.currentItem == collectiblesTab ? 0 : 1
|
||||||
|
|
||||||
CustomCommunityNewTokenView {}
|
CustomCommunityNewTokenView {
|
||||||
|
id: newCollectibleView
|
||||||
|
|
||||||
CustomCommunityNewTokenView { isAssetView: true }
|
isAssetView: false
|
||||||
|
collectible: _colLayout.collectible
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomCommunityNewTokenView {
|
||||||
|
id: newAssetView
|
||||||
|
|
||||||
|
isAssetView: true
|
||||||
|
asset: _colLayout.asset
|
||||||
|
}
|
||||||
|
|
||||||
component CustomCommunityNewTokenView: CommunityNewTokenView {
|
component CustomCommunityNewTokenView: CommunityNewTokenView {
|
||||||
isAssetView: false
|
isAssetView: false
|
||||||
@ -248,6 +311,13 @@ SettingsPageLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
target: root
|
||||||
|
property: "title"
|
||||||
|
value: optionsTab.currentItem == collectiblesTab ? d.newCollectiblePageTitle : d.newAssetPageTitle
|
||||||
|
restoreMode: Binding.RestoreBindingOrValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,6 +591,18 @@ SettingsPageLayout {
|
|||||||
value: view.artworkSource
|
value: view.artworkSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
target: d
|
||||||
|
property: "isAssetType"
|
||||||
|
value: view.tokenType === Constants.TokenType.ERC20
|
||||||
|
}
|
||||||
|
|
||||||
|
Binding {
|
||||||
|
target: d
|
||||||
|
property: "currentToken"
|
||||||
|
value: view.isAssetView ? view.asset : view.collectible
|
||||||
|
}
|
||||||
|
|
||||||
Instantiator {
|
Instantiator {
|
||||||
id: instantiator
|
id: instantiator
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ StatusScrollView {
|
|||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: d.imageSelectorRectWidth
|
Layout.preferredHeight: d.imageSelectorRectWidth
|
||||||
artworkSource: root.isAssetView ? assetObj.artworkSource : collectibleObj.artworkSource
|
dataImage: root.isAssetView ? asset.artworkSource : collectible.artworkSource
|
||||||
|
artworkSource: root.isAssetView ? asset.artworkSource : collectible.artworkSource
|
||||||
editorAnchorLeft: !root.isAssetView
|
editorAnchorLeft: !root.isAssetView
|
||||||
editorRoundedImage: root.isAssetView
|
editorRoundedImage: root.isAssetView
|
||||||
uploadTextLabel.uploadText: root.isAssetView ? qsTr("Upload") : qsTr("Drag and Drop or Upload Artwork")
|
uploadTextLabel.uploadText: root.isAssetView ? qsTr("Upload") : qsTr("Drag and Drop or Upload Artwork")
|
||||||
|
@ -24,6 +24,7 @@ Item {
|
|||||||
property bool editorAnchorLeft: true
|
property bool editorAnchorLeft: true
|
||||||
property alias uploadTextLabel: textLabel
|
property alias uploadTextLabel: textLabel
|
||||||
property alias editorRoundedImage: editor.roundedImage
|
property alias editorRoundedImage: editor.roundedImage
|
||||||
|
property alias dataImage: editor.dataImage
|
||||||
property alias artworkSource: editor.source
|
property alias artworkSource: editor.source
|
||||||
property alias artworkCropRect: editor.cropRect
|
property alias artworkCropRect: editor.cropRect
|
||||||
property alias editorTitle: editor.title
|
property alias editorTitle: editor.title
|
||||||
@ -75,7 +76,7 @@ Item {
|
|||||||
id: textLabel
|
id: textLabel
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: !editor.userSelectedImage
|
visible: !editor.userSelectedImage && !root.dataImage
|
||||||
additionalTextPixelSize: Theme.secondaryTextFontSize
|
additionalTextPixelSize: Theme.secondaryTextFontSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user