diff --git a/src/app/components/main-panel.js b/src/app/components/main-panel.js new file mode 100644 index 0000000000..d9813493f9 --- /dev/null +++ b/src/app/components/main-panel.js @@ -0,0 +1,24 @@ +import { AbstractPanel } from './panel' +const yo = require('yo-yo') +const csjs = require('csjs-inject') + +const css = csjs` + .pluginsContainer { + height: 100%; + display: flex; + overflow-y: hidden; + } +` + +export class MainPanel extends AbstractPanel { + constructor (appStore, options) { + super('mainPanel', appStore, options) + } + + render () { + return yo` +
+ ${this.view} +
` + } +} diff --git a/src/app/components/swap-panel.js b/src/app/components/swap-panel.js new file mode 100644 index 0000000000..1f7de07c88 --- /dev/null +++ b/src/app/components/swap-panel.js @@ -0,0 +1,84 @@ +import { AbstractPanel } from './panel' +const csjs = require('csjs-inject') +const yo = require('yo-yo') + +const css = csjs` + .panel { + height: 100%; + overflow-y: hidden; + } + .swapitTitle { + text-transform: uppercase; + } + .swapitHeader { + height: 35px; + padding: 0 20px; + display: flex; + justify-content: space-between; + align-items: center; + } + .swapitHeader h6 { + margin: 0; + } + .icons i { + height: 80%; + cursor: pointer; + } + .pluginsContainer { + height: calc(100% - 35px); + overflow: auto; + } +` + +const options = { + default: true, + displayHeader: true +} + +export class SwapPanel extends AbstractPanel { + + constructor (appStore) { + super('swapPanel', appStore, options) + this.header = this.renderHeader() + this.store = appStore + } + + /** + * Display content and update the header + * @param {String} name The name of the plugin to display + */ + showContent (name) { + super.showContent(name) + yo.update(this.header, this.renderHeader()) + } + + /** The header of the swap panel */ + renderHeader () { + let name = ' - ' + let hasSettings = false + if (this.active) { + const { profile } = this.store.getOne(this.active) + name = profile.displayName ? profile.displayName : profile.name + hasSettings = profile.settings || false + } + return yo` +
+
${name}
+
+ ${hasSettings + ? yo`` + : yo``} +
+
` + } + + render () { + return yo` +
+ ${this.header} +
+ ${this.view} +
+
` + } +}