Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jun 15, 2023
1 parent 954b874 commit 1d1401d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Components/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function getSystemIcon(obj) {
return null;
}

// system or design have special icons
// system or design has special icons
if (id.startsWith('_design/') || (id === 'system')) {
icon = <IconSystem className="iconOwn" />;
} else if (id === '0_userdata' || id === '0_userdata.0') {
Expand Down
15 changes: 9 additions & 6 deletions src/Components/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class Utils {
return defaultValue === undefined ? true : defaultValue;
}
color = color.toString();
if (color.indexOf('#') === 0) {
if (color.startsWith('#')) {
color = color.slice(1);
}
let r;
Expand Down Expand Up @@ -818,14 +818,14 @@ class Utils {
static updateSmartName(obj, newSmartName, byON, smartType, instanceId, noCommon) {
const language = I18n.getLanguage();

// convert Old format
// convert the old format
if (typeof obj.common.smartName === 'string') {
const nnn = obj.common.smartName;
obj.common.smartName = {};
obj.common.smartName[language] = nnn;
}

// convert old settings
// convert the old settings
if (obj.native && obj.native.byON) {
delete obj.native.byON;
let _smartName = obj.common.smartName;
Expand Down Expand Up @@ -853,9 +853,9 @@ class Utils {
} else {
obj.common.smartName.smartType = smartType;
}

}
}

if (byON !== undefined) {
if (noCommon) {
obj.common.custom = obj.common.custom || {};
Expand All @@ -867,6 +867,7 @@ class Utils {
obj.common.smartName.byON = byON;
}
}

if (newSmartName !== undefined) {
let smartName;
if (noCommon) {
Expand All @@ -883,10 +884,10 @@ class Utils {
// If smart name deleted
if (smartName && (!smartName[language] ||
(smartName[language] === obj.common.name &&
(!obj.common.role || obj.common.role.indexOf('button') >= 0)))) {
(!obj.common.role || obj.common.role.includes('button'))))) {
delete smartName[language];
let empty = true;
// Check if structure has any definitions
// Check if the structure has any definitions
for (const key in smartName) {
if (smartName.hasOwnProperty(key)) {
empty = false;
Expand All @@ -908,6 +909,7 @@ class Utils {
delete obj.common.custom[instanceId].fr;
delete obj.common.custom[instanceId].pt;
delete obj.common.custom[instanceId].es;
delete obj.common.custom[instanceId].uk;
delete obj.common.custom[instanceId]['zh-cn'];
}
} else {
Expand All @@ -921,6 +923,7 @@ class Utils {
delete obj.common.smartName.fr;
delete obj.common.smartName.pt;
delete obj.common.smartName.es;
delete obj.common.smartName.uk;
delete obj.common.smartName['zh-cn'];
} else {
obj.common.smartName = null;
Expand Down

0 comments on commit 1d1401d

Please sign in to comment.