2018-01-29 19:15:58 +01:00
|
|
|
/**
|
|
|
|
* BetterDiscord Settings Component
|
|
|
|
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
|
|
|
* All rights reserved.
|
|
|
|
* https://betterdiscord.net
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
<template>
|
2018-08-15 11:42:43 +02:00
|
|
|
<div class="bd-settings" :class="{'bd-active': active, 'bd-settingsOut': !item && animating}" @keyup="$emit('close')">
|
2018-08-09 23:50:14 +02:00
|
|
|
<SidebarView :contentVisible="item" :animating="animating" :class="{'bd-stop': item}">
|
2018-01-30 10:28:28 +01:00
|
|
|
<Sidebar slot="sidebar">
|
2018-08-15 05:33:42 +02:00
|
|
|
<div class="bd-settingsX" @click="$emit('close')">
|
2018-02-03 01:17:35 +01:00
|
|
|
<MiClose size="17"/>
|
2018-08-15 04:03:56 +02:00
|
|
|
<span class="bd-xText">ESC</span>
|
2018-01-30 10:28:28 +01:00
|
|
|
</div>
|
2018-03-07 21:19:02 +01:00
|
|
|
<template v-for="(category, text) in sidebar">
|
|
|
|
<SidebarItem :item="{text, type: 'header'}" />
|
2018-08-09 23:50:14 +02:00
|
|
|
<SidebarItem v-for="i in category" :key="i.id" :item="i" :active="item && i.id === item.id" @click="itemOnClick(i.id)" />
|
2018-03-07 21:19:02 +01:00
|
|
|
</template>
|
2018-01-30 10:28:28 +01:00
|
|
|
</Sidebar>
|
2018-08-09 23:50:14 +02:00
|
|
|
|
2018-02-03 06:38:28 +01:00
|
|
|
<div slot="sidebarfooter" class="bd-info">
|
2019-03-05 22:30:41 +01:00
|
|
|
<span class="bd-vtext">{{versionString}}</span>
|
2018-08-15 04:03:56 +02:00
|
|
|
<div @click="openGithub" v-tooltip="'GitHub'" class="bd-materialButton">
|
2018-02-03 06:38:28 +01:00
|
|
|
<MiGithubCircle size="16" />
|
|
|
|
</div>
|
2018-08-15 04:03:56 +02:00
|
|
|
<div @click="openTwitter" v-tooltip="'@Jiiksi'" class="bd-materialButton">
|
2018-02-03 06:44:18 +01:00
|
|
|
<MiTwitterCircle size="16" />
|
|
|
|
</div>
|
2018-08-15 04:03:56 +02:00
|
|
|
<div @click="openWebsite" v-tooltip="'BetterDiscord'" class="bd-materialButton">
|
2018-02-03 06:38:28 +01:00
|
|
|
<MiWeb size="16" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-09 23:50:14 +02:00
|
|
|
|
2018-01-30 10:28:28 +01:00
|
|
|
<ContentColumn slot="content">
|
2018-08-09 23:50:14 +02:00
|
|
|
<transition name="bd-contentcolumn" @before-enter="animating++" @after-enter="animating--" @enter-cancelled="animating--" @before-leave="animating++" @after-leave="animating--" @leave-cancelled="animating--">
|
2019-03-09 22:43:41 +01:00
|
|
|
<div v-if="item" :key="item.id">
|
2018-08-09 23:50:14 +02:00
|
|
|
<template v-if="item.component">
|
|
|
|
<component :is="item.component" :SettingsWrapper="SettingsWrapper" />
|
|
|
|
</template>
|
2018-03-07 21:19:02 +01:00
|
|
|
|
2018-08-09 23:50:14 +02:00
|
|
|
<SettingsWrapper v-else-if="typeof item.set === 'string'" :headertext="Settings.getSet(item.set).headertext">
|
|
|
|
<SettingsPanel :settings="Settings.getSet(item.set)" :schemes="Settings.getSet(item.set).schemes" />
|
|
|
|
</SettingsWrapper>
|
|
|
|
<SettingsWrapper v-else-if="item.set" :headertext="item.set.headertext">
|
|
|
|
<SettingsPanel :settings="item.set" :schemes="item.set.schemes" />
|
|
|
|
</SettingsWrapper>
|
2018-03-07 21:19:02 +01:00
|
|
|
|
2018-08-09 23:50:14 +02:00
|
|
|
<ConnectivityView v-else-if="item.contentid === 'connectivity'" />
|
|
|
|
<CssEditorView v-else-if="item.contentid === 'css'" />
|
|
|
|
<PluginsView v-else-if="item.contentid === 'plugins'" />
|
|
|
|
<ThemesView v-else-if="item.contentid === 'themes'" />
|
|
|
|
<UpdaterView v-else-if="item.contentid === 'updater'" />
|
|
|
|
</div>
|
|
|
|
</transition>
|
2018-01-30 10:28:28 +01:00
|
|
|
</ContentColumn>
|
|
|
|
</SidebarView>
|
2018-01-29 19:15:58 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
2018-03-29 22:46:33 +02:00
|
|
|
|
2018-01-29 19:15:58 +01:00
|
|
|
<script>
|
2018-01-30 10:28:28 +01:00
|
|
|
// Imports
|
2019-03-07 21:54:16 +01:00
|
|
|
import { Events, Settings, Globals, Reflection } from 'modules';
|
2018-03-07 21:19:02 +01:00
|
|
|
import { BdMenuItems } from 'ui';
|
2018-03-31 02:03:13 +02:00
|
|
|
import { shell } from 'electron';
|
2018-01-30 10:28:28 +01:00
|
|
|
import { SidebarView, Sidebar, SidebarItem, ContentColumn } from './sidebar';
|
2019-03-07 21:44:29 +01:00
|
|
|
import { SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView, SuperSecretView } from './bd';
|
2018-02-03 06:44:18 +01:00
|
|
|
import { SvgX, MiGithubCircle, MiWeb, MiClose, MiTwitterCircle } from './common';
|
2018-01-30 10:28:28 +01:00
|
|
|
|
2018-01-29 19:15:58 +01:00
|
|
|
export default {
|
2018-01-30 10:28:28 +01:00
|
|
|
data() {
|
|
|
|
return {
|
2018-08-09 23:50:14 +02:00
|
|
|
animating: 0,
|
|
|
|
item: null,
|
|
|
|
items: BdMenuItems.items,
|
2018-03-02 20:47:29 +01:00
|
|
|
Settings,
|
2018-07-09 02:08:40 +02:00
|
|
|
SettingsWrapper,
|
2019-03-09 22:43:41 +01:00
|
|
|
openMenuHandler: null
|
2018-03-30 02:17:02 +02:00
|
|
|
};
|
2018-01-30 10:28:28 +01:00
|
|
|
},
|
2018-03-30 02:17:02 +02:00
|
|
|
props: ['active'],
|
2018-01-30 10:28:28 +01:00
|
|
|
components: {
|
2018-01-30 11:01:24 +01:00
|
|
|
SidebarView, Sidebar, SidebarItem, ContentColumn,
|
2019-03-09 22:43:41 +01:00
|
|
|
SettingsWrapper, SettingsPanel, CssEditorView, PluginsView, ThemesView, UpdaterView, ConnectivityView,
|
2018-02-03 06:44:18 +01:00
|
|
|
MiGithubCircle, MiWeb, MiClose, MiTwitterCircle
|
2018-01-30 10:28:28 +01:00
|
|
|
},
|
2018-03-07 21:19:02 +01:00
|
|
|
computed: {
|
|
|
|
sidebar() {
|
|
|
|
const categories = {};
|
2018-08-09 23:50:14 +02:00
|
|
|
for (let item of this.items) {
|
2018-03-07 21:19:02 +01:00
|
|
|
if (item.hidden) continue;
|
|
|
|
const category = categories[item.category] || (categories[item.category] = []);
|
|
|
|
category.push(item);
|
|
|
|
}
|
|
|
|
return categories;
|
2019-03-05 22:30:41 +01:00
|
|
|
},
|
|
|
|
versionString() {
|
|
|
|
return Globals.version;
|
2018-03-07 21:19:02 +01:00
|
|
|
}
|
|
|
|
},
|
2018-01-30 10:28:28 +01:00
|
|
|
methods: {
|
2018-01-30 11:01:24 +01:00
|
|
|
itemOnClick(id) {
|
2018-08-09 23:50:14 +02:00
|
|
|
this.item = this.items.find(item => item.id === id);
|
2018-01-30 12:14:16 +01:00
|
|
|
},
|
2018-03-01 01:05:29 +01:00
|
|
|
closeContent() {
|
2018-08-09 23:50:14 +02:00
|
|
|
this.item = null;
|
2018-03-01 01:05:29 +01:00
|
|
|
},
|
2018-02-02 14:23:02 +01:00
|
|
|
openGithub() {
|
|
|
|
shell.openExternal('https://github.com/JsSucks/BetterDiscordApp');
|
|
|
|
},
|
|
|
|
openWebsite() {
|
|
|
|
shell.openExternal('https://betterdiscord.net');
|
2018-02-03 06:44:18 +01:00
|
|
|
},
|
|
|
|
openTwitter() {
|
2018-02-03 06:46:18 +01:00
|
|
|
shell.openExternal('https://twitter.com/Jiiksi');
|
2018-01-30 10:28:28 +01:00
|
|
|
}
|
2018-02-28 05:23:21 +01:00
|
|
|
},
|
|
|
|
watch: {
|
2018-03-01 01:05:29 +01:00
|
|
|
active(active) {
|
|
|
|
if (active) return;
|
|
|
|
this.closeContent();
|
2018-02-28 05:23:21 +01:00
|
|
|
}
|
2018-03-31 02:03:13 +02:00
|
|
|
},
|
|
|
|
created() {
|
2018-08-15 05:33:42 +02:00
|
|
|
Events.on('bd-open-menu', this.openMenuHandler = item => item && this.itemOnClick(this.items.find(i => i === item || i.id === item || i.contentid === item || i.set === item).id));
|
2019-03-09 23:02:40 +01:00
|
|
|
|
2019-03-07 21:54:16 +01:00
|
|
|
try {
|
|
|
|
const currentUser = Reflection.module.byName('UserStore').getCurrentUser();
|
2019-03-09 23:02:40 +01:00
|
|
|
if (['81388395867156480', '98003542823944192', '249746236008169473', '284056145272766465', '478559353516064769'].includes(currentUser.id)) {
|
2019-03-09 22:43:41 +01:00
|
|
|
BdMenuItems.addVueComponent('BD Devs', 'Super Secret', SuperSecretView);
|
|
|
|
}
|
2019-03-07 21:54:16 +01:00
|
|
|
} catch (err) {}
|
2018-07-09 02:08:40 +02:00
|
|
|
},
|
|
|
|
destroyed() {
|
2018-08-15 05:33:42 +02:00
|
|
|
if (this.openMenuHandler) Events.off('bd-open-menu', this.openMenuHandler);
|
2018-01-30 10:28:28 +01:00
|
|
|
}
|
2018-01-29 19:15:58 +01:00
|
|
|
}
|
2018-01-30 11:01:24 +01:00
|
|
|
</script>
|