diff --git a/Projects/Governance/Icons/referrer.png b/Projects/Governance/Icons/referrer.png new file mode 100644 index 000000000..c42733847 Binary files /dev/null and b/Projects/Governance/Icons/referrer.png differ diff --git a/Projects/Governance/Schemas/App-Schema/Referrer.json b/Projects/Governance/Schemas/App-Schema/Referrer.json new file mode 100644 index 000000000..39fb7fc32 --- /dev/null +++ b/Projects/Governance/Schemas/App-Schema/Referrer.json @@ -0,0 +1,40 @@ +{ + "type": "Referrer", + "menuItems": [ + { + "action": "Configure", + "actionFunction": "uiObject.configEditor.activate", + "label": "Configure", + "iconPathOn": "configuration", + "iconPathOff": "configuration" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "label": "Delete", + "iconPathOn": "delete-entity", + "iconPathOff": "delete-entity", + "actionFunction": "payload.executeAction" + } + ], + "title": [ + "Use Reference Parent" + ], + "editors": { + "config": true + }, + "initialValues": { + "config": "{\n \"description\": \"\"\n}" + }, + "addLeftIcons": true, + "level": 2, + "attachingRules": { + "compatibleTypes": "->User Profile->" + }, + "referencingRules": { + "compatibleTypes": "->User Profile->" + }, + "propertyNameAtParent": "referrer", + "icon": "github-api" +} \ No newline at end of file diff --git a/Projects/Governance/Schemas/App-Schema/user-profile.json b/Projects/Governance/Schemas/App-Schema/user-profile.json index 91d3cac6c..937d36785 100644 --- a/Projects/Governance/Schemas/App-Schema/user-profile.json +++ b/Projects/Governance/Schemas/App-Schema/user-profile.json @@ -38,6 +38,14 @@ "label": "Add Civic Contributions", "relatedUiObject": "Civic Contributions" }, + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "referrer", + "actionFunction": "payload.executeAction", + "label": "Add Referrer", + "relatedUiObject": "Referrer" + }, { "action": "Delete UI Object", "askConfirmation": true, @@ -88,6 +96,12 @@ "type": "array", "childType": "Civic Contributions", "autoAdd": false + }, + { + "name": "referrer", + "type": "node", + "childType": "Referrer", + "autoAdd": false } ] } \ No newline at end of file diff --git a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js index bfd8a9f6a..cf05724e0 100644 --- a/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js +++ b/Projects/Governance/UI/Spaces/User-Profile-Space/UserProfile.js @@ -15,17 +15,13 @@ function newGovernanceUserProfileSpace() { return thisObject - function finalize() { - thisObject.container.finalize() - thisObject.container = undefined - } - function initialize() { } - function physics() { - + function finalize() { + thisObject.container.finalize() + thisObject.container = undefined } function getContainer(point) { @@ -38,6 +34,26 @@ function newGovernanceUserProfileSpace() { } } + function physics() { + if (UI.projects.superalgos.spaces.designSpace.workspace === undefined) {return} + + let userProfiles = UI.projects.superalgos.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile') + + for (let i = 0; i < userProfiles.length; i++) { + let userProfile = userProfiles[i] + userProfilePhysics(userProfile) + } + } + + function userProfilePhysics(userProfile) { + let tokens = UI.projects.superalgos.utilities.nodeConfig.loadPropertyFromNodeConfig(userProfile.payload, 'tokens') + tokens = new Intl.NumberFormat().format(tokens) + ' ' + 'SA' + if ( userProfile.payload !== undefined) { + userProfile.payload.uiObject.valueAtAngle = false + userProfile.payload.uiObject.setValue(tokens) + } + } + function draw() { }