From 89a5bfba20625e69313abf14e6ed4f95e0a674bd Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Thu, 9 Aug 2018 23:49:10 +0100 Subject: [PATCH 1/2] Make the hide button setting functional --- .../styles/partials/bdsettings/button.scss | 15 ++++++++++- .../src/styles/partials/discordoverrides.scss | 26 ++++++++++--------- client/src/ui/bdui.js | 9 ++++++- .../src/ui/components/BdSettingsWrapper.vue | 19 +++++++++++--- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/client/src/styles/partials/bdsettings/button.scss b/client/src/styles/partials/bdsettings/button.scss index 9ab8ae99..e2fc7fb3 100644 --- a/client/src/styles/partials/bdsettings/button.scss +++ b/client/src/styles/partials/bdsettings/button.scss @@ -43,9 +43,22 @@ } } + &.bd-hide-button { + transition: opacity 0.4s ease-out; + opacity: 0; + + &.bd-active { + transition-timing-function: ease-in; + } + } + &.bd-active { - background: transparent; opacity: 1; + } + + &.bd-active, + &.bd-hide-button { + background: transparent; box-shadow: none; .bd-settings-button-btn { diff --git a/client/src/styles/partials/discordoverrides.scss b/client/src/styles/partials/discordoverrides.scss index 6d051e20..42d668a9 100644 --- a/client/src/styles/partials/discordoverrides.scss +++ b/client/src/styles/partials/discordoverrides.scss @@ -1,20 +1,22 @@ -[class*="guildsWrapper-"] { - padding-top: 49px !important; +body:not(.bd-hide-button) { + [class*="guildsWrapper-"] { + padding-top: 49px !important; - .platform-osx & { - margin-top: 26px; + .platform-osx & { + margin-top: 26px; + } } -} -[class*="guildsWrapper-"] + [class*="flex"] { - border-radius: 0 0 0 5px; -} + [class*="guildsWrapper-"] + [class*="flex"] { + border-radius: 0 0 0 5px; + } -[class*="unreadMentionsIndicatorTop-"] { - top: 49px; + [class*="unreadMentionsIndicatorTop-"] { + top: 49px; - .platform-osx & { - top: 50px; + .platform-osx & { + top: 50px; + } } } diff --git a/client/src/ui/bdui.js b/client/src/ui/bdui.js index 4cf25833..4d4e5261 100644 --- a/client/src/ui/bdui.js +++ b/client/src/ui/bdui.js @@ -8,7 +8,7 @@ * LICENSE file in the root directory of this source tree. */ -import { Events, DiscordApi } from 'modules'; +import { Events, DiscordApi, Settings } from 'modules'; import { remote } from 'electron'; import DOM from './dom'; import Vue from './vue'; @@ -17,6 +17,13 @@ import { BdSettingsWrapper, BdModals, BdToasts } from './components'; export default class { static initUiEvents() { + const hideButtonSetting = Settings.getSetting('ui', 'default', 'hide-button'); + hideButtonSetting.on('setting-updated', event => { + if (event.value) document.body.classList.add('bd-hide-button'); + else document.body.classList.remove('bd-hide-button'); + }); + if (hideButtonSetting.value) document.body.classList.add('bd-hide-button'); + this.pathCache = { isDm: null, server: DiscordApi.currentGuild, diff --git a/client/src/ui/components/BdSettingsWrapper.vue b/client/src/ui/components/BdSettingsWrapper.vue index 196639a4..96c34a7b 100644 --- a/client/src/ui/components/BdSettingsWrapper.vue +++ b/client/src/ui/components/BdSettingsWrapper.vue @@ -9,8 +9,8 @@ */