2018-01-30 18:12:13 +01:00
|
|
|
/**
|
|
|
|
* BetterDiscord Plugin 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.
|
|
|
|
*/
|
|
|
|
|
2018-01-30 16:59:27 +01:00
|
|
|
<template>
|
2018-01-30 18:12:13 +01:00
|
|
|
<div class="bd-plugin-card">
|
|
|
|
<div class="bd-plugin-header">
|
|
|
|
<span v-tooltip="'wat'">{{plugin.name}}</span>
|
|
|
|
<div class="bd-flex-spacer" />
|
2018-01-31 09:32:20 +01:00
|
|
|
<label class="bd-switch-wrapper" @click="() => { togglePlugin(plugin); this.$forceUpdate(); }">
|
2018-01-30 18:12:13 +01:00
|
|
|
<input type="checkbox" class="bd-switch-checkbox" />
|
|
|
|
<div class="bd-switch" :class="{'bd-checked': plugin.enabled}" />
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<div class="bd-plugin-body">
|
|
|
|
<div class="bd-plugin-description">{{plugin.description}}</div>
|
|
|
|
<div class="bd-plugin-footer">
|
|
|
|
<div class="bd-plugin-extra">v{{plugin.version}} by {{plugin.authors.join(', ').replace(/,(?!.*,)/gmi, ' and')}}</div>
|
|
|
|
<div class="bd-controls">
|
|
|
|
<ButtonGroup>
|
|
|
|
<Button v-tooltip="'Settings'" v-if="plugin.hasSettings" :onClick="() => showSettings(plugin)">
|
2018-02-03 01:00:18 +01:00
|
|
|
<MiSettings size="18"/>
|
2018-01-30 18:12:13 +01:00
|
|
|
</Button>
|
|
|
|
<Button v-tooltip="'Reload'" :onClick="() => reloadPlugin(plugin)">
|
2018-02-03 01:00:18 +01:00
|
|
|
<MiRefresh size="18" />
|
2018-01-30 18:12:13 +01:00
|
|
|
</Button>
|
|
|
|
<Button v-tooltip="'Edit'" :onClick="editPlugin">
|
2018-02-03 01:00:18 +01:00
|
|
|
<MiPencil size="18" />
|
2018-01-30 18:12:13 +01:00
|
|
|
</Button>
|
|
|
|
<Button v-tooltip="'Uninstall'" type="err">
|
2018-02-03 01:00:18 +01:00
|
|
|
<MiDelete size="18" />
|
2018-01-30 18:12:13 +01:00
|
|
|
</Button>
|
|
|
|
</ButtonGroup>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-01-30 16:59:27 +01:00
|
|
|
</template>
|
|
|
|
<script>
|
2018-01-30 18:12:13 +01:00
|
|
|
// Imports
|
|
|
|
import { shell } from 'electron';
|
2018-02-03 01:00:18 +01:00
|
|
|
import { Button, ButtonGroup, SettingSwitch, MiSettings, MiRefresh, MiPencil, MiDelete } from '../common';
|
2018-01-30 18:12:13 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
settingsOpen: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: ['plugin', 'togglePlugin', 'reloadPlugin', 'showSettings'],
|
|
|
|
components: {
|
2018-02-03 01:00:18 +01:00
|
|
|
Button, ButtonGroup, SettingSwitch, MiSettings, MiRefresh, MiPencil, MiDelete
|
2018-01-30 18:12:13 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
editPlugin() {
|
|
|
|
try {
|
|
|
|
shell.openItem(this.plugin.pluginPath);
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|