2018-02-05 17:48:03 +01:00
/ * *
* BetterDiscord Theme Card 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-02-05 17:58:35 +01:00
< Card :item ="theme" >
2018-02-19 19:10:09 +01:00
< SettingSwitch slot = "toggle" :checked ="theme.enabled" :change ="toggleTheme" / >
2018-02-05 17:58:35 +01:00
< ButtonGroup slot = "controls" >
2018-03-06 22:55:50 +01:00
< Button v-tooltip ="'Settings (shift + click to open settings without cloning the set)'" v-if="theme.hasSettings" :onClick="e => showSettings(e.shiftKey)" > < MiSettings size = "18" / > < / Button >
< Button v-tooltip ="'Recompile (shift + click to reload)'" :onClick="e => reloadTheme(e.shiftKey)" > < MiRefresh size = "18" / > < / Button >
2018-02-19 19:10:09 +01:00
< Button v-tooltip ="'Edit'" :onClick ="editTheme" > < MiPencil size = "18" / > < / Button >
2018-03-06 22:55:50 +01:00
< Button v-tooltip ="'Uninstall (shift + click to unload)'" :onClick="e => deleteTheme(e.shiftKey)" type="err" > < MiDelete size = "18" / > < / Button >
2018-02-05 17:58:35 +01:00
< / ButtonGroup >
< / Card >
2018-02-05 17:48:03 +01:00
< / template >
< script >
// Imports
import { shell } from 'electron' ;
2018-02-05 17:58:35 +01:00
import Card from './Card.vue' ;
2018-02-05 17:48:03 +01:00
import { Button , ButtonGroup , SettingSwitch , MiSettings , MiRefresh , MiPencil , MiDelete , MiExtension } from '../common' ;
export default {
2018-02-21 18:46:27 +01:00
props : [ 'theme' , 'toggleTheme' , 'reloadTheme' , 'deleteTheme' , 'showSettings' ] ,
2018-02-05 17:48:03 +01:00
components : {
2018-02-05 17:58:35 +01:00
Card , Button , ButtonGroup , SettingSwitch , MiSettings , MiRefresh , MiPencil , MiDelete , MiExtension
2018-02-05 17:48:03 +01:00
} ,
methods : {
editTheme ( ) {
try {
shell . openItem ( this . theme . themePath ) ;
} catch ( err ) {
2018-03-21 00:24:31 +01:00
Logger . err ( 'ThemeCard' , [ ` Error opening theme directory ${ this . theme . contentPath } : ` , err ] ) ;
2018-02-05 17:48:03 +01:00
}
}
}
}
< / script >