From 42a5705215b9f0cba7fddb52372eb1dff17a91d6 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 13 Feb 2020 21:05:19 +0100 Subject: [PATCH 1/5] added filter invert to images --- package-lock.json | 2 +- src/app/panels/tab-proxy.js | 15 ++++++++++ src/app/tabs/compile-tab.js | 8 ++---- src/app/tabs/settings-tab.js | 2 +- src/app/tabs/styles/settings-tab-styles.js | 2 +- src/app/tabs/theme-module.js | 13 ++++++++- src/app/ui/landing-page/landing-page.js | 8 ++---- src/app/ui/persmission-handler.js | 33 ++++++++++++++++------ 8 files changed, 58 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index f291a48dfeb..c7fecd367f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17777,7 +17777,7 @@ "requires": { "underscore": "1.8.3", "web3-core-helpers": "1.0.0-beta.27", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" }, "dependencies": { "debug": { diff --git a/src/app/panels/tab-proxy.js b/src/app/panels/tab-proxy.js index d69dbd7e968..c07b07a56da 100644 --- a/src/app/panels/tab-proxy.js +++ b/src/app/panels/tab-proxy.js @@ -1,6 +1,7 @@ var yo = require('yo-yo') var $ = require('jquery') const EventEmitter = require('events') +const globalRegistry = require('../../global/registry') require('remix-tabs') @@ -14,6 +15,11 @@ export class TabProxy { this._view = {} this._handlers = {} + globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => { + // update invert for all icons + this.updateImgStyles() + }) + fileManager.events.on('fileRemoved', (name) => { this.removeTab(name) }) @@ -78,6 +84,14 @@ export class TabProxy { } }) } + updateImgStyles () { + const images = this._view.filetabs.getElementsByClassName('image') + if (images.length !== 0) { + for (let element of images) { + globalRegistry.get('themeModule').api.fixInvert(element) + }; + } + } switchTab (tabName) { if (this._handlers[tabName]) { @@ -130,6 +144,7 @@ export class TabProxy { icon, tooltip: name }) + this.updateImgStyles() this._handlers[name] = { switchTo, close } } diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 6fb90eb2c34..a1aac23349c 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -168,12 +168,8 @@ class CompileTab extends ViewPlugin { } }) - globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => { - const invert = theme.quality === 'dark' ? 1 : 0 - const img = document.getElementById('swarmLogo') - if (img) { - img.style.filter = `invert(${invert})` - } + globalRegistry.get('themeModule').api.events.on('themeChanged', () => { + globalRegistry.get('themeModule').api.fixInvert(document.getElementById('swarmLogo')) }) // Run the compiler instead of trying to save the website diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index 0d7ac7a09ff..221d59f38d5 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -68,7 +68,7 @@ module.exports = class SettingsTab extends ViewPlugin { if (self._view.el) return self._view.el // Gist settings - var gistAccessToken = yo`` + var gistAccessToken = yo`` var token = this.config.get('settings/gist-access-token') if (token) gistAccessToken.value = token var gistAddToken = yo` { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }} value="Save" type="button">` diff --git a/src/app/tabs/styles/settings-tab-styles.js b/src/app/tabs/styles/settings-tab-styles.js index 3c7cf404cef..2e836b5b043 100644 --- a/src/app/tabs/styles/settings-tab-styles.js +++ b/src/app/tabs/styles/settings-tab-styles.js @@ -85,7 +85,7 @@ const css = csjs` } .inline { display: inline; - width: 50%; + width: 40%; } ` diff --git a/src/app/tabs/theme-module.js b/src/app/tabs/theme-module.js index be7cb8184f6..445cb779e76 100644 --- a/src/app/tabs/theme-module.js +++ b/src/app/tabs/theme-module.js @@ -24,7 +24,7 @@ const themes = [ const profile = { name: 'theme', events: ['themeChanged'], - methods: ['switchTheme', 'getThemes', 'currentTheme'], + methods: ['switchTheme', 'getThemes', 'currentTheme', 'fixInvert'], version: packageJson.version, kind: 'theme' } @@ -84,4 +84,15 @@ export class ThemeModule extends Plugin { this.emit('themeChanged', nextTheme) this.events.emit('themeChanged', nextTheme) } + + /** + * fixes the invertion for images since this should be adjusted when we switch between dark/light qualified themes + * @param {element} [image] - the dom element which invert should be fixed to increase visibility + */ + fixInvert (image) { + const invert = this.currentTheme().quality === 'dark' ? 1 : 0 + if (image) { + image.style.filter = `invert(${invert})` + } + } } diff --git a/src/app/ui/landing-page/landing-page.js b/src/app/ui/landing-page/landing-page.js index 1548c4d4ddd..f2f98a9493e 100644 --- a/src/app/ui/landing-page/landing-page.js +++ b/src/app/ui/landing-page/landing-page.js @@ -163,12 +163,8 @@ export class LandingPage extends ViewPlugin { this.verticalIcons.select('fileExplorers') } - globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => { - const invert = theme.quality === 'dark' ? 1 : 0 - const img = document.getElementById('remixLogo') - if (img) { - img.style.filter = `invert(${invert})` - } + globalRegistry.get('themeModule').api.events.on('themeChanged', () => { + globalRegistry.get('themeModule').api.fixInvert(document.getElementById('remixLogo')) }) let switchToPreviousVersion = () => { diff --git a/src/app/ui/persmission-handler.js b/src/app/ui/persmission-handler.js index 9064521eedd..d25f3b28b5f 100644 --- a/src/app/ui/persmission-handler.js +++ b/src/app/ui/persmission-handler.js @@ -3,6 +3,7 @@ const yo = require('yo-yo') const csjs = require('csjs-inject') const addTooltip = require('./tooltip') const modalDialog = require('./modaldialog') +const globalRegistry = require('../../global/registry') const css = csjs` .permission h4 { @@ -140,20 +141,26 @@ export class PermissionHandler { : delete this.permissions[to.name][from.name] } const rememberSwitch = remember - ? yo`` - : yo`` + ? yo`` + : yo`` const message = remember ? `"${fromName}" has changed and would like to access "${toName}"` : `"${fromName}" would like to access "${toName}"` - return yo` -
-
+ const pluginsImages = yo` +
- +
- + + ` + + globalRegistry.get('themeModule').api.fixInvert(pluginsImages) + + return yo` +
+ ${pluginsImages}

${message} :

${fromName}
@@ -163,9 +170,9 @@ export class PermissionHandler {
-
+
${rememberSwitch} - +
@@ -173,4 +180,12 @@ export class PermissionHandler {
` } + + listenOnThemeChange (images) { + // update invert for Plugin icons + if (!globalRegistry.get('themeModule')) return + globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => { + globalRegistry.get('themeModule').api.fixInvert(images) + }) + } } From b4bcebe02428bfba7a462624868af8b25d6839b6 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Fri, 14 Feb 2020 15:51:06 +0100 Subject: [PATCH 2/5] fixed the arrow color --- src/app/ui/persmission-handler.js | 58 ++++++++++++++----------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/src/app/ui/persmission-handler.js b/src/app/ui/persmission-handler.js index d25f3b28b5f..ac70ef84ef2 100644 --- a/src/app/ui/persmission-handler.js +++ b/src/app/ui/persmission-handler.js @@ -147,45 +147,39 @@ export class PermissionHandler { ? `"${fromName}" has changed and would like to access "${toName}"` : `"${fromName}" would like to access "${toName}"` + const imgFrom = yo`` + const imgTo = yo`` const pluginsImages = yo` -
- - - +
+ ${imgFrom} + + ${imgTo}
` - globalRegistry.get('themeModule').api.fixInvert(pluginsImages) + globalRegistry.get('themeModule').api.fixInvert(imgFrom) + globalRegistry.get('themeModule').api.fixInvert(imgTo) return yo` -
- ${pluginsImages} -
-

${message} :

-
${fromName}
-

${from.description || yo`No description Provided`}

-
${toName} :

-

${to.description || yo`No description Provided`}

-
- -
-
- ${rememberSwitch} - -
- -
- -
+
+ ${pluginsImages} +
+

${message} :

+
${fromName}
+

${from.description || yo`No description Provided`}

+
${toName} :

+

${to.description || yo`No description Provided`}

+
+ +
+
+ ${rememberSwitch} + +
+ +
+
` } - - listenOnThemeChange (images) { - // update invert for Plugin icons - if (!globalRegistry.get('themeModule')) return - globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => { - globalRegistry.get('themeModule').api.fixInvert(images) - }) - } } From 1cf75cf80381c15f318122cfa09adbc4cd7550fa Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 21 Feb 2020 21:28:14 +0100 Subject: [PATCH 3/5] Update package-lock.json --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index c7fecd367f8..f291a48dfeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17777,7 +17777,7 @@ "requires": { "underscore": "1.8.3", "web3-core-helpers": "1.0.0-beta.27", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + "websocket": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible" }, "dependencies": { "debug": { From 5c38839e5a179e2f2867100a9db47ef4c528c96e Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 2 Mar 2020 15:59:22 +0100 Subject: [PATCH 4/5] removed invert from exposed methods --- src/app/tabs/theme-module.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tabs/theme-module.js b/src/app/tabs/theme-module.js index 445cb779e76..629a98c060e 100644 --- a/src/app/tabs/theme-module.js +++ b/src/app/tabs/theme-module.js @@ -24,7 +24,7 @@ const themes = [ const profile = { name: 'theme', events: ['themeChanged'], - methods: ['switchTheme', 'getThemes', 'currentTheme', 'fixInvert'], + methods: ['switchTheme', 'getThemes', 'currentTheme'], version: packageJson.version, kind: 'theme' } From 934acf5c21e20ebb9192e79f0b60772d9c77e2f0 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 2 Mar 2020 16:35:11 +0100 Subject: [PATCH 5/5] disableing the swarm --- test-browser/tests/publishContract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-browser/tests/publishContract.js b/test-browser/tests/publishContract.js index 9636d990a99..6abbc186814 100644 --- a/test-browser/tests/publishContract.js +++ b/test-browser/tests/publishContract.js @@ -23,7 +23,7 @@ module.exports = { }) .modalFooterOKClick() }, - 'Publish on Swarm': function (browser) { + 'Publish on Swarm': '' + function (browser) { browser .click('#publishOnSwarm') .getModalBody((value, done) => {