From 54648f9854be9ea4e9535492b339abc8dca43eae Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 29 Jun 2023 15:09:46 +0100 Subject: [PATCH] update hints type refactor --- apps/remix-ide/src/app/tabs/analysis-tab.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js index 13d6aea573..69dece2eb5 100644 --- a/apps/remix-ide/src/app/tabs/analysis-tab.js +++ b/apps/remix-ide/src/app/tabs/analysis-tab.js @@ -50,13 +50,20 @@ class AnalysisTab extends ViewPlugin { this.event.register('staticAnaysisWarning', (count) => { let payloadType = '' - this.hints && this.hints.length > 0 ? this.hints.forEach(hint => { - if (hint.type === 'error') { - payloadType = 'error' - } else if (hint.type === 'warning' && payloadType !== 'error') { - payloadType = 'warning' - } - }) : payloadType = 'warning' + // this.hints && this.hints.length > 0 ? this.hints.forEach(hint => { + // if (hint.type === 'error') { + // payloadType = 'error' + // } else if (hint.type === 'warning' && payloadType !== 'error') { + // payloadType = 'warning' + // } + // }) : payloadType = 'warning' + const error = this.hints.find(hint => hint.type === 'error') + const warning = this.hints.find(hints => hints.type === 'warning') + if (error) { + payloadType = 'error' + } else { + payloadType = 'warning' + } if (count > 0) { // this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: payloadType })