From edce4e5bbc10bba6af4aa5fb4a51d713a9efa819 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Sun, 15 Aug 2021 00:45:01 -0400 Subject: [PATCH] Refactoring switching logic, formatting LESS --- .../homebrew/editor/snippetbar/snippetbar.jsx | 14 +------ .../editor/snippetbar/snippets/snippets.js | 39 ++++++++++--------- .../snippetbar/snippetsLegacy/snippets.js | 33 +++++++++------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 5302a339b..9ea04695f 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -40,19 +40,9 @@ const Snippetbar = createClass({ let snippets = []; if(this.props.renderer === 'V3') - if(this.props.view === 'text') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsV3.filter((SnippetsV3)=>SnippetsV3.view === 'style'); - } else - snippets = null; + snippets = SnippetsV3.filter((snippetGroup)=>snippetGroup.view === this.props.view); else - if(this.props.view === 'text') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'text'); - } else if(this.props.view === 'style') { - snippets = SnippetsLegacy.filter((SnippetsLegacy)=>SnippetsLegacy.view === 'style'); - } else - snippets = null; + snippets = SnippetsLegacy.filter((snippetGroup)=>snippetGroup.view === this.props.view); return _.map(snippets, (snippetGroup)=>{ return