mirror of
https://github.com/overte-org/overte.git
synced 2025-07-05 23:49:28 +02:00
Start work on Pay Out UI
This commit is contained in:
parent
022fea107f
commit
371c50b2ab
1 changed files with 139 additions and 7 deletions
|
@ -269,7 +269,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText;
|
id: sendAssetText;
|
||||||
text: root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
text: root.assetCertID === "" ? "Send Money To:" : "Send \"" + root.assetName + "\" To:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -370,6 +370,50 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: authorizedScriptButton;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: nearbyButton.bottom;
|
||||||
|
anchors.topMargin: 32;
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
|
height: connectionButton.height;
|
||||||
|
width: connectionButton.width;
|
||||||
|
|
||||||
|
Image {
|
||||||
|
anchors.top: parent.top;
|
||||||
|
source: "./images/nearby.svg";
|
||||||
|
height: 70;
|
||||||
|
width: parent.width;
|
||||||
|
fillMode: Image.PreserveAspectFit;
|
||||||
|
horizontalAlignment: Image.AlignHCenter;
|
||||||
|
verticalAlignment: Image.AlignTop;
|
||||||
|
mipmap: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
text: "Authorized Script";
|
||||||
|
// Anchors
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
height: 15;
|
||||||
|
width: parent.width;
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.baseGray;
|
||||||
|
horizontalAlignment: Text.AlignHCenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
onClicked: {
|
||||||
|
sendAssetStep.referrer = "authorizedScript";
|
||||||
|
sendAssetStep.selectedRecipientNodeID = "";
|
||||||
|
|
||||||
|
root.nextActiveView = "sendAssetStep";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: backButton_sendAssetHome;
|
id: backButton_sendAssetHome;
|
||||||
visible: parentAppNavBarHeight === 0;
|
visible: parentAppNavBarHeight === 0;
|
||||||
|
@ -860,7 +904,7 @@ Item {
|
||||||
id: sendAssetStep;
|
id: sendAssetStep;
|
||||||
z: 996;
|
z: 996;
|
||||||
|
|
||||||
property string referrer; // either "connections", "nearby", or "payIn"
|
property string referrer; // either "connections", "nearby", "payIn", or "authorizedScript"
|
||||||
property string selectedRecipientNodeID;
|
property string selectedRecipientNodeID;
|
||||||
property string selectedRecipientDisplayName;
|
property string selectedRecipientDisplayName;
|
||||||
property string selectedRecipientUserName;
|
property string selectedRecipientUserName;
|
||||||
|
@ -872,7 +916,8 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText_sendAssetStep;
|
id: sendAssetText_sendAssetStep;
|
||||||
text: sendAssetStep.referrer === "payIn" && root.assetCertID !== "" ? "Send \"" + root.assetName + "\":" :
|
text: ((sendAssetStep.referrer === "payIn" || sendAssetStep.referrer === "authorizedScript") &&
|
||||||
|
root.assetCertID !== "") ? "Send \"" + root.assetName + "\":" :
|
||||||
(root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:");
|
(root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:");
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
|
@ -901,12 +946,13 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendToText_sendAssetStep;
|
id: sendToText_sendAssetStep;
|
||||||
text: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ? "Send to:" : "Gift to:";
|
text: sendAssetStep.referrer === "authorizedScript" ? "Script Secret:" :
|
||||||
|
(root.assetCertID === "" || sendAssetStep.referrer === "payIn") ? "Send to:" : "Gift to:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
width: 90;
|
width: paintedWidth;
|
||||||
// Text size
|
// Text size
|
||||||
size: 18;
|
size: 18;
|
||||||
// Style
|
// Style
|
||||||
|
@ -915,8 +961,10 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RecipientDisplay {
|
RecipientDisplay {
|
||||||
|
visible: sendAssetStep.referrer !== "authorizedScript";
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: sendToText_sendAssetStep.right;
|
anchors.left: sendToText_sendAssetStep.right;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
anchors.right: changeButton.left;
|
anchors.right: changeButton.left;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
|
@ -929,6 +977,71 @@ Item {
|
||||||
multiLineDisplay: sendAssetStep.referrer === "nearby" || sendAssetStep.referrer === "payIn";
|
multiLineDisplay: sendAssetStep.referrer === "nearby" || sendAssetStep.referrer === "payIn";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: scriptSecretContainer;
|
||||||
|
visible: sendAssetStep.referrer === "authorizedScript";
|
||||||
|
anchors.top: parent.top;
|
||||||
|
anchors.left: sendToText_sendAssetStep.right;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: parent.height;
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
id: scriptSecretHelp;
|
||||||
|
text: "[?]";
|
||||||
|
// Anchors
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 8;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
height: 30;
|
||||||
|
width: paintedWidth;
|
||||||
|
// Text size
|
||||||
|
size: 18;
|
||||||
|
// Style
|
||||||
|
color: hifi.colors.blueAccent;
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent;
|
||||||
|
hoverEnabled: true;
|
||||||
|
onEntered: {
|
||||||
|
parent.color = hifi.colors.blueHighlight;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
parent.color = hifi.colors.blueAccent;
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
lightboxPopup.titleText = "Script Secret";
|
||||||
|
lightboxPopup.bodyText = "This alphanumeric text string will be used to ensure " +
|
||||||
|
"that only your scripts have access to the asset that you are sending. Keep it private!";
|
||||||
|
lightboxPopup.button1text = "CLOSE";
|
||||||
|
lightboxPopup.button1method = function() {
|
||||||
|
lightboxPopup.visible = false;
|
||||||
|
}
|
||||||
|
lightboxPopup.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControlsUit.TextField {
|
||||||
|
id: scriptSecretTextField;
|
||||||
|
text: generateRandomSecret();
|
||||||
|
colorScheme: root.assetCertID === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
|
// Anchors
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
anchors.left: scriptSecretHelp.right;
|
||||||
|
anchors.leftMargin: 16;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
height: 50;
|
||||||
|
// Style
|
||||||
|
activeFocusOnPress: true;
|
||||||
|
activeFocusOnTab: true;
|
||||||
|
|
||||||
|
validator: RegExpValidator { regExp: /^[a-zA-Z0-9]+$/ }
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
optionalMessage.focus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "CHANGE" button
|
// "CHANGE" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: changeButton;
|
id: changeButton;
|
||||||
|
@ -939,7 +1052,7 @@ Item {
|
||||||
height: 35;
|
height: 35;
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "CHANGE";
|
text: "CHANGE";
|
||||||
visible: sendAssetStep.referrer !== "payIn";
|
visible: sendAssetStep.referrer !== "payIn" && sendAssetStep.referrer !== "authorizedScript";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (sendAssetStep.referrer === "connections") {
|
if (sendAssetStep.referrer === "connections") {
|
||||||
root.nextActiveView = "chooseRecipientConnection";
|
root.nextActiveView = "chooseRecipientConnection";
|
||||||
|
@ -1263,6 +1376,8 @@ Item {
|
||||||
root.assetCertID,
|
root.assetCertID,
|
||||||
parseInt(amountTextField.text),
|
parseInt(amountTextField.text),
|
||||||
optionalMessage.text);
|
optionalMessage.text);
|
||||||
|
} else if (sendAssetStep.referrer === "authorizedScript") {
|
||||||
|
console.log("ZRF HERE: SENDING TO AUTHORIZED SCRIPT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1867,6 +1982,17 @@ Item {
|
||||||
sendAssetStep.referrer = "";
|
sendAssetStep.referrer = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateRandomSecret() {
|
||||||
|
var randomSecret = "";
|
||||||
|
var possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
for (var i = 0; i < 10; i++) {
|
||||||
|
randomSecret += possibleCharacters.charAt(Math.floor(Math.random() * possibleCharacters.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
return randomSecret;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Name: fromScript()
|
// Function Name: fromScript()
|
||||||
//
|
//
|
||||||
|
@ -1908,9 +2034,15 @@ Item {
|
||||||
sendAssetStep.referrer = "payIn";
|
sendAssetStep.referrer = "payIn";
|
||||||
sendAssetStep.selectedRecipientNodeID = "";
|
sendAssetStep.selectedRecipientNodeID = "";
|
||||||
sendAssetStep.selectedRecipientDisplayName = "Determined by script:";
|
sendAssetStep.selectedRecipientDisplayName = "Determined by script:";
|
||||||
sendAssetStep.selectedRecipientUserName = message.username;
|
sendAssetStep.selectedRecipientUserName = message.username || "";
|
||||||
optionalMessage.text = message.message || "No Message Provided";
|
optionalMessage.text = message.message || "No Message Provided";
|
||||||
|
|
||||||
|
if (sendAssetStep.selectedRecipientUserName === "") {
|
||||||
|
console.log("SendAsset: Script didn't specify a recipient username!");
|
||||||
|
sendAssetHome.visible = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
root.nextActiveView = "sendAssetStep";
|
root.nextActiveView = "sendAssetStep";
|
||||||
break;
|
break;
|
||||||
case 'inspectionCertificate_resetCert':
|
case 'inspectionCertificate_resetCert':
|
||||||
|
|
Loading…
Reference in a new issue