From 25f3cd7dc0779ea2b00666a971ec3def733e2b5f Mon Sep 17 00:00:00 2001 From: Justin Ferrari Date: Wed, 8 Nov 2023 10:51:30 -0500 Subject: [PATCH] Fixed custom property field format & UI --- core/language/us.json | 9 +- .../friends-view/profile-modal-update.js | 97 +++++++++++++++---- 2 files changed, 83 insertions(+), 23 deletions(-) diff --git a/core/language/us.json b/core/language/us.json index 9778380d..48cc93cd 100644 --- a/core/language/us.json +++ b/core/language/us.json @@ -1229,9 +1229,9 @@ "profile8": "Add custom property", "profile9": "Property name", "profile10": "Fields", - "profile11": "Add new field", + "profile11": "Add field", "profile12": "Field name", - "profile13": "Fill out", + "profile13": "Field value", "profile14": "Activity", "profile15": "No value", "profile16": "This name has no profile", @@ -1239,6 +1239,9 @@ "profile18": "Open profile", "profile19": "Cannot fetch profile", "profile20": "Register name", - "profile21": "Insert address from UI" + "profile21": "Insert address from UI", + "profile22": "Success", + "profile23": "encrypted", + "profile24": "You must fill out both field name and field value to add a custom property" } } \ No newline at end of file diff --git a/core/src/components/friends-view/profile-modal-update.js b/core/src/components/friends-view/profile-modal-update.js index aedc9f3b..4800b096 100644 --- a/core/src/components/friends-view/profile-modal-update.js +++ b/core/src/components/friends-view/profile-modal-update.js @@ -36,6 +36,7 @@ class ProfileModalUpdate extends connect(store)(LitElement) { newFieldName: {type: String}, qortalRequestCustomData: {type: Object}, newCustomDataKey: {type: String}, + newCustomDataValue: {type: String}, isSaving: {type: Boolean} }; } @@ -75,11 +76,13 @@ class ProfileModalUpdate extends connect(store)(LitElement) { this.hasFetchedArrr = false; this.isOpenCustomDataModal = false; this.customData = {}; - this.newCustomDataKey = "" + this.newCustomDataKey = ""; + this.newCustomDataValue = ""; this.newCustomDataField = {}; this.newFieldName = ''; - this.isSaving = false - + this.isSaving = false; + this.addPrivate = this.addPrivate.bind(this); + this.checkForPrivate = this.checkForPrivate.bind(this); } static get styles() { @@ -178,7 +181,6 @@ class ProfileModalUpdate extends connect(store)(LitElement) { transform: translate(-50%, -50%); background-color: var(--mdc-theme-surface); width: 80vw; - max-width: 600px; padding: 20px; box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px; z-index: 1001; @@ -190,6 +192,7 @@ class ProfileModalUpdate extends connect(store)(LitElement) { .modal-overlay.hidden { display: none; } + .avatar { width: 36px; height: 36px; @@ -231,6 +234,16 @@ class ProfileModalUpdate extends connect(store)(LitElement) { border-radius: 7px; transition: all 0.3s ease-in-out; } + + .checkbox-row { + position: relative; + display: flex; + align-items: center; + align-content: center; + font-family: Montserrat, sans-serif; + font-weight: 600; + color: var(--black); + } `; } @@ -384,10 +397,16 @@ class ProfileModalUpdate extends connect(store)(LitElement) { } addField(){ + if (!this.newFieldName || !this.newCustomDataValue) { + let snack5string = get("profile.profile24"); + parentEpml.request('showSnackBar', `${snack5string}`); + return; + } const copyObj = {...this.newCustomDataField} - copyObj[this.newFieldName] = '' + copyObj[this.newFieldName] = this.newCustomDataValue this.newCustomDataField = copyObj this.newFieldName = "" + this.newCustomDataValue = "" } addCustomData(){ @@ -397,6 +416,7 @@ class ProfileModalUpdate extends connect(store)(LitElement) { this.newCustomDataKey = "" this.newCustomDataField = {}; this.newFieldName = '' + this.newCustomDataValue = '' this.isOpenCustomDataModal = false; } @@ -406,12 +426,31 @@ class ProfileModalUpdate extends connect(store)(LitElement) { this.newCustomDataKey = key } + removeCustomData(key){ const copyObj = {...this.customData} delete copyObj[key] this.customData = copyObj } + checkForPrivate(){ + let isPrivate = false + if(this.newCustomDataKey.includes('-private')) isPrivate = true + return isPrivate + } + + addPrivate(e){ + if (e.target.checked) { + if(this.newCustomDataKey.includes('-private')){ + + } else { + this.newCustomDataKey = this.newCustomDataKey + '-private' + } + } else { + this.newCustomDataKey = this.newCustomDataKey.replace('-private', ''); + } + } + render() { return html`