From edf6b547528c8eb544ff9f94390645dc85e655dd Mon Sep 17 00:00:00 2001 From: Bhavika Tibrewal Date: Mon, 20 Nov 2023 06:42:14 +0530 Subject: [PATCH] refactor the code --- app/components/task-tabs.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/app/components/task-tabs.js b/app/components/task-tabs.js index e7daf263..b62a38d5 100644 --- a/app/components/task-tabs.js +++ b/app/components/task-tabs.js @@ -6,22 +6,14 @@ export default class TaskTabsComponent extends Component { availabletaskTabsList = this.args.taskStatusList; get taskCardStatusList() { + if (!this.args.dev) return this.availabletaskTabsList; + const statusToRemove = [TASK_KEYS.VERIFIED, + TASK_KEYS.RELEASED, + TASK_KEYS.APPROVED, + TASK_KEYS.COMPLETED, + TASK_KEYS.NEEDS_REVIEW] const statusToDisplay = this.availabletaskTabsList.filter((taskStatus) => { - if (this.args.dev === true) { - if ( - taskStatus.key !== TASK_KEYS.VERIFIED && - taskStatus.key !== TASK_KEYS.RELEASED && - taskStatus.key !== TASK_KEYS.APPROVED && - taskStatus.key !== TASK_KEYS.COMPLETED && - taskStatus.key !== TASK_KEYS.NEEDS_REVIEW - ) { - return true; - } else { - return false; - } - } else { - return taskStatus; - } + !statusToRemove.includes(taskStatus.key) }); return statusToDisplay; }