From 48e65499e226d593fd6cf8354d214e29acbe32b2 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Wed, 1 Apr 2020 17:16:16 -0400 Subject: [PATCH] groups: set sigil color on blur, not automatically --- .../groups/src/js/components/lib/contact-card.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/interface/groups/src/js/components/lib/contact-card.js b/pkg/interface/groups/src/js/components/lib/contact-card.js index 6948c35070..9a9531580a 100644 --- a/pkg/interface/groups/src/js/components/lib/contact-card.js +++ b/pkg/interface/groups/src/js/components/lib/contact-card.js @@ -53,7 +53,7 @@ export class ContactCard extends Component { if (hexTest && (hexTest[1] !== currentColor) && !props.share) { api.contactEdit(props.path, `~${props.ship}`, {color: hexTest[1]}); - } + } } editToggle() { @@ -116,6 +116,18 @@ export class ContactCard extends Component { ); switch (field) { + case "color": { + let currentColor = (props.contact.color) ? props.contact.color : "000000"; + currentColor = uxToHex(currentColor); + let hexExp = /([0-9A-Fa-f]{6})/ + let hexTest = hexExp.exec(this.state.colorToSet); + + if (hexTest && (hexTest[1] !== currentColor) && !props.share) { + api.contactEdit(props.path, `~${props.ship}`, { color: hexTest[1] }).then(() => { + }); + } + break; + } case "email": { if ( (state.emailToSet === "") || @@ -318,6 +330,7 @@ export class ContactCard extends Component { onChange={this.sigilColorSet} defaultValue={defaultColor} key={"default" + defaultColor} + onBlur={(() => this.setField("color"))} style={{ resize: "none", height: 40,