Merge remote-tracking branch 'upstream/master' into settings

# Conflicts:
#	client/src/modules/thememanager.js
#	client/src/ui/components/BdSettings.vue
This commit is contained in:
Samuel Elliott 2018-03-02 19:47:29 +00:00
commit e94a7c50a4
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
9 changed files with 78 additions and 30 deletions

View File

@ -45,8 +45,10 @@ export default class ExtModule {
get main() { return this.__pluginInternals.main } get main() { return this.__pluginInternals.main }
get defaultConfig() { return this.configs.defaultConfig } get defaultConfig() { return this.configs.defaultConfig }
get userConfig() { return this.configs.userConfig } get userConfig() { return this.configs.userConfig }
get id() { return this.info.id || this.info.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/--/g, '-') } get configSchemes() { return this.configs.schemes }
get id() { return this.info.id || this.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/--/g, '-') }
get name() { return this.info.name } get name() { return this.info.name }
get description() { return this.info.description }
get authors() { return this.info.authors } get authors() { return this.info.authors }
get version() { return this.info.version } get version() { return this.info.version }
get contentPath() { return this.paths.contentPath } get contentPath() { return this.paths.contentPath }

View File

@ -58,6 +58,7 @@ export default class Plugin {
get configSchemes() { return this.configs.schemes } get configSchemes() { return this.configs.schemes }
get id() { return this.info.id || this.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/--/g, '-') } get id() { return this.info.id || this.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/--/g, '-') }
get name() { return this.info.name } get name() { return this.info.name }
get description() { return this.info.description }
get authors() { return this.info.authors } get authors() { return this.info.authors }
get version() { return this.info.version } get version() { return this.info.version }
get contentPath() { return this.paths.contentPath } get contentPath() { return this.paths.contentPath }

View File

@ -58,6 +58,7 @@ export default class Theme {
get configSchemes() { return this.configs.schemes } get configSchemes() { return this.configs.schemes }
get id() { return this.info.id || this.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/\s+/g, '-') } get id() { return this.info.id || this.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/\s+/g, '-') }
get name() { return this.info.name } get name() { return this.info.name }
get description() { return this.info.description }
get authors() { return this.info.authors } get authors() { return this.info.authors }
get version() { return this.info.version } get version() { return this.info.version }
get contentPath() { return this.paths.contentPath } get contentPath() { return this.paths.contentPath }

View File

@ -49,7 +49,6 @@
background: transparent; background: transparent;
opacity: 1; opacity: 1;
box-shadow: none; box-shadow: none;
z-index: 3001;
.bd-settings-button-btn { .bd-settings-button-btn {
background-image: $logoBigBw; background-image: $logoBigBw;
@ -62,6 +61,11 @@
cursor: default; cursor: default;
} }
} }
&.bd-active,
&.bd-animating {
z-index: 3001;
}
} }
@keyframes bd-settings-button-pulse { @keyframes bd-settings-button-pulse {

View File

@ -119,14 +119,33 @@
.platform-linux & { .platform-linux & {
top: 0; top: 0;
} }
}
.bd-settings .bd-sidebar-view.bd-stop .bd-content-region { .bd-sidebar-view.bd-stop .bd-content-region {
z-index: 3003; z-index: 3003;
} }
.bd-backdrop { .bd-sidebar-view.active {
z-index: 3003; .bd-content-region {
transition: transform 0.4s ease-in-out, opacity 0.2s ease;
transform: none;
opacity: 1;
}
}
&:not(.active) .bd-sidebar-view.active,
&.bd-settings-out .bd-sidebar-view.active {
.bd-content-region {
transform: translate(-600px, 0%);
opacity: 0;
width: 590px;
}
}
&:not(.active) .bd-sidebar-view.active {
.bd-content-region {
transform: translate(-600px, 100%);
}
}
} }
.bd-sidebar .bd-settings-button { .bd-sidebar .bd-settings-button {

View File

@ -31,6 +31,7 @@
background: #36393e; background: #36393e;
box-shadow: 0 0 4px #202225; box-shadow: 0 0 4px #202225;
backface-visibility: hidden; backface-visibility: hidden;
transition: transform 0.6s ease;
} }
&.bd-stop { &.bd-stop {
@ -38,10 +39,4 @@
transform: none; transform: none;
} }
} }
&.active {
.bd-content-region {
animation: bd-slidein .6s;
}
}
} }

View File

@ -41,10 +41,11 @@
&:hover, &:hover,
&.active { &.active {
background: $colbdblue; background: $colbdblue;
color: #fff;
} }
&.active { &.active {
color: #fff; cursor: default;
} }
} }
} }

View File

@ -9,8 +9,8 @@
*/ */
<template> <template>
<div class="bd-settings" :class="{active: active}" @keyup="close"> <div class="bd-settings" :class="{active: active, 'bd-settings-out': this.activeIndex === -1 && this.lastActiveIndex >= 0}" @keyup="close">
<SidebarView :contentVisible="this.activeIndex >= 0" :animating="this.animating" :class="{'bd-stop': !first}"> <SidebarView :contentVisible="this.activeIndex >= 0 || this.lastActiveIndex >= 0" :animating="this.animating" :class="{'bd-stop': !first}">
<Sidebar slot="sidebar"> <Sidebar slot="sidebar">
<div class="bd-settings-x" @click="close"> <div class="bd-settings-x" @click="close">
<MiClose size="17"/> <MiClose size="17"/>
@ -20,7 +20,7 @@
</Sidebar> </Sidebar>
<div slot="sidebarfooter" class="bd-info"> <div slot="sidebarfooter" class="bd-info">
<span class="bd-vtext">v2.0.0a by Jiiks/JsSucks</span> <span class="bd-vtext">v2.0.0a by Jiiks/JsSucks</span>
<div @click="openGithub" v-tooltip="'Github'" class="bd-material-button"> <div @click="openGithub" v-tooltip="'GitHub'" class="bd-material-button">
<MiGithubCircle size="16" /> <MiGithubCircle size="16" />
</div> </div>
<div @click="openTwitter" v-tooltip="'@Jiiksi'" class="bd-material-button"> <div @click="openTwitter" v-tooltip="'@Jiiksi'" class="bd-material-button">
@ -77,8 +77,9 @@
lastActiveIndex: -1, lastActiveIndex: -1,
animating: false, animating: false,
first: true, first: true,
Settings Settings,
}; timeout: null
}
}, },
props: ['active', 'close'], props: ['active', 'close'],
components: { components: {
@ -95,10 +96,12 @@
this.lastActiveIndex = this.activeIndex; this.lastActiveIndex = this.activeIndex;
this.activeIndex = id; this.activeIndex = id;
setTimeout(() => { if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.first = false; this.first = false;
this.animating = false; this.animating = false;
this.lastActiveIndex = -1; this.lastActiveIndex = -1;
this.timeout = null;
}, 400); }, 400);
}, },
activeContent(s) { activeContent(s) {
@ -109,6 +112,19 @@
const item = this.sidebarItems.find(item => item.contentid === s); const item = this.sidebarItems.find(item => item.contentid === s);
return item && item.id === this.lastActiveIndex; return item && item.id === this.lastActiveIndex;
}, },
closeContent() {
if (this.activeIndex >= 0) this.sidebarItems.find(item => item.id === this.activeIndex).active = false;
this.first = true;
this.lastActiveIndex = this.activeIndex;
this.activeIndex = -1;
if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.animating = false;
this.lastActiveIndex = -1;
this.timeout = null;
}, 400);
},
openGithub() { openGithub() {
shell.openExternal('https://github.com/JsSucks/BetterDiscordApp'); shell.openExternal('https://github.com/JsSucks/BetterDiscordApp');
}, },
@ -120,13 +136,9 @@
} }
}, },
watch: { watch: {
active(newVal, oldVal) { active(active) {
if (!newVal) { if (active) return;
this.sidebarItems.find(item => item.id === this.activeIndex).active = false; this.closeContent();
this.activeIndex = this.lastActiveIndex = -1;
this.animating = false;
this.first = true;
}
} }
} }
} }

View File

@ -10,12 +10,12 @@
<template> <template>
<div class="bd-settings-wrapper" :class="[{active: active}, 'platform-' + this.platform]"> <div class="bd-settings-wrapper" :class="[{active: active}, 'platform-' + this.platform]">
<div class="bd-settings-button" :class="{'bd-active': active}" @click="showSettings"> <div class="bd-settings-button" :class="{'bd-active': active, 'bd-animating': animating}" @click="showSettings">
<div v-if="updating === 0" v-tooltip.right="'Checking for updates'" class="bd-settings-button-btn bd-loading"></div> <div v-if="updating === 0" v-tooltip.right="'Checking for updates'" class="bd-settings-button-btn bd-loading"></div>
<div v-else-if="updating === 2" v-tooltip.right="'Updates available!'" class="bd-settings-button-btn bd-updates"></div> <div v-else-if="updating === 2" v-tooltip.right="'Updates available!'" class="bd-settings-button-btn bd-updates"></div>
<div v-else class="bd-settings-button-btn" :class="[{'bd-loading': !loaded}]"></div> <div v-else class="bd-settings-button-btn" :class="[{'bd-loading': !loaded}]"></div>
</div> </div>
<BdSettings :active="active" :close="hideSettings" /> <BdSettings ref="settings" :active="active" :close="hideSettings" />
</div> </div>
</template> </template>
<script> <script>
@ -29,6 +29,8 @@
loaded: false, loaded: false,
updating: false, updating: false,
active: false, active: false,
animating: false,
timeout: null,
platform: global.process.platform platform: global.process.platform
} }
}, },
@ -44,12 +46,23 @@
toggleSettings() { this.active = !this.active }, toggleSettings() { this.active = !this.active },
keyupListener(e) { keyupListener(e) {
if (document.getElementsByClassName('bd-backdrop').length) return; if (document.getElementsByClassName('bd-backdrop').length) return;
if (this.$refs.settings.activeIndex !== -1 && e.which === 27) return this.$refs.settings.closeContent();
if (this.active && e.which === 27) return this.hideSettings(); if (this.active && e.which === 27) return this.hideSettings();
if (!e.metaKey && !e.ctrlKey || e.key !== 'b') return; if (!e.metaKey && !e.ctrlKey || e.key !== 'b') return;
this.toggleSettings(); this.toggleSettings();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
} }
}, },
watch: {
active(active) {
this.animating = true;
if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.animating = false;
this.timeout = null;
}, 400);
}
},
created() { created() {
Events.on('ready', e => this.loaded = true); Events.on('ready', e => this.loaded = true);
Events.on('update-check-start', e => this.updating = 0); Events.on('update-check-start', e => this.updating = 0);