mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
291 lines
8.9 KiB
291 lines
8.9 KiB
4 years ago
|
<template>
|
||
|
<div>
|
||
2 years ago
|
<h3 class="text-center mb-5 grey--text text--darken-2">Appearance</h3>
|
||
4 years ago
|
|
||
|
<v-simple-table dense style="">
|
||
3 years ago
|
<template #default>
|
||
4 years ago
|
<tbody>
|
||
3 years ago
|
<tr>
|
||
|
<td>Dark Mode</td>
|
||
|
<td>
|
||
|
<v-tooltip bottom>
|
||
|
<template #activator="{ on }">
|
||
|
<v-icon
|
||
|
x-large
|
||
2 years ago
|
:color="$vuetify.theme.dark ? 'primary' : 'primary'"
|
||
3 years ago
|
@click="toggleDarkTheme($vuetify.theme.dark)"
|
||
3 years ago
|
v-on="on"
|
||
|
>
|
||
|
mdi-bat
|
||
|
</v-icon>
|
||
|
</template>
|
||
|
<h3 class="pa-3">
|
||
|
{{ $vuetify.theme.dark ? 'It does come in Black' : 'Does it come in Black ?' }}
|
||
|
<i />
|
||
|
</h3>
|
||
|
</v-tooltip>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<!--<tr>
|
||
4 years ago
|
<td>Show metatables</td>
|
||
|
<td>
|
||
|
<v-tooltip bottom>
|
||
|
<template v-slot:activator="{ on }">
|
||
|
<v-checkbox v-model="showMetatable" v-on="on" x-large
|
||
|
color="primary">
|
||
|
mdi-bat
|
||
|
</v-checkbox>
|
||
|
</template>
|
||
|
Show/hide metatables
|
||
|
</v-tooltip>
|
||
|
</td>
|
||
4 years ago
|
</tr>-->
|
||
3 years ago
|
<!-- <tr>
|
||
3 years ago
|
<td>Show Screensaver</td>
|
||
|
<td>
|
||
|
<v-tooltip bottom>
|
||
|
<template #activator="{ on }">
|
||
|
<v-checkbox
|
||
|
v-model="showScreensaver"
|
||
|
x-large
|
||
|
color="primary"
|
||
|
v-on="on"
|
||
|
>
|
||
|
mdi-bat
|
||
|
</v-checkbox>
|
||
|
</template>
|
||
|
Show/hide metatables
|
||
|
</v-tooltip>
|
||
|
</td>
|
||
3 years ago
|
</tr>-->
|
||
3 years ago
|
<tr>
|
||
|
<td>Themes</td>
|
||
|
<td class="pa-1">
|
||
|
<v-list rounded>
|
||
|
<!-- <v-subheader>REPORTS</v-subheader>-->
|
||
|
<v-list-item-group v-model="item" color="primary">
|
||
|
<v-list-item
|
||
2 years ago
|
v-for="(t, i) in themes"
|
||
3 years ago
|
:key="i"
|
||
|
class="mb-n1"
|
||
|
:value="i"
|
||
2 years ago
|
@click.native.prevent.stop="changeTheme(t, i)"
|
||
3 years ago
|
>
|
||
|
<v-list-item-content class="py-0">
|
||
2 years ago
|
<div class="d-flex align-center" style="width: 100%">
|
||
3 years ago
|
<div style="width: 100px">
|
||
|
{{ i }}
|
||
|
</div>
|
||
|
<div class="flex-grow-1">
|
||
|
<v-container fluid class="pa-0">
|
||
|
<v-row>
|
||
|
<v-col
|
||
2 years ago
|
v-for="(col, key) in t"
|
||
3 years ago
|
:key="key"
|
||
|
class="mx-2"
|
||
|
style="height: 20px"
|
||
2 years ago
|
:style="{ backgroundColor: col }"
|
||
3 years ago
|
/>
|
||
|
</v-row>
|
||
|
</v-container>
|
||
|
</div>
|
||
4 years ago
|
</div>
|
||
3 years ago
|
</v-list-item-content>
|
||
|
</v-list-item>
|
||
|
<v-list-item
|
||
|
class="mb-n2"
|
||
|
value="Custom"
|
||
2 years ago
|
@click.native.prevent.stop="changeTheme(customTheme, 'Custom')"
|
||
3 years ago
|
>
|
||
|
<v-list-item-content class="py-0">
|
||
2 years ago
|
<div class="d-flex align-center" style="width: 100%">
|
||
|
<div style="min-width: 100px">Custom</div>
|
||
3 years ago
|
<div class="flex-grow-1">
|
||
|
<!-- <v-container fluid>-->
|
||
4 years ago
|
|
||
3 years ago
|
<x-btn
|
||
2 years ago
|
v-for="(col, key) in customTheme"
|
||
3 years ago
|
:key="key"
|
||
|
small
|
||
|
btn.class="ma-1 caption"
|
||
|
:color="col"
|
||
|
tooltip="Click to change the color"
|
||
2 years ago
|
@click="(customKey = key), (colorPickerModel = true)"
|
||
3 years ago
|
>
|
||
|
{{ key }}
|
||
|
</x-btn>
|
||
|
</div>
|
||
4 years ago
|
</div>
|
||
3 years ago
|
</v-list-item-content>
|
||
|
</v-list-item>
|
||
|
</v-list-item-group>
|
||
|
</v-list>
|
||
|
</td>
|
||
|
</tr>
|
||
3 years ago
|
|
||
|
<tr>
|
||
|
<td>Show M2M Tables</td>
|
||
|
<td>
|
||
|
<v-tooltip bottom>
|
||
|
<template #activator="{ on }">
|
||
2 years ago
|
<v-checkbox v-model="includeM2M" v-t="[`c:themes:show-m2m-tables`]" x-large color="primary" v-on="on">
|
||
3 years ago
|
mdi-table-network
|
||
|
</v-checkbox>
|
||
|
</template>
|
||
|
Include/Exclude M2M tables
|
||
|
</v-tooltip>
|
||
|
</td>
|
||
|
</tr>
|
||
4 years ago
|
</tbody>
|
||
|
</template>
|
||
|
</v-simple-table>
|
||
|
|
||
2 years ago
|
<v-dialog v-model="colorPickerModel" width="350">
|
||
3 years ago
|
<v-color-picker
|
||
|
v-if="customTheme[customKey]"
|
||
|
v-model="customTheme[customKey]"
|
||
|
class="mx-auto my-2"
|
||
|
@input="changeTheme(customTheme)"
|
||
|
/>
|
||
4 years ago
|
</v-dialog>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script>
|
||
2 years ago
|
import themes from '../../../helpers/themes';
|
||
4 years ago
|
|
||
|
export default {
|
||
2 years ago
|
components: {},
|
||
4 years ago
|
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
|
rightClickCount: 0,
|
||
|
tab: null,
|
||
|
languages: [
|
||
2 years ago
|
{ label: 'English', value: 'en' },
|
||
4 years ago
|
// {label: 'Japanese', value: 'ja'},
|
||
|
// {label: 'Chinese', value: 'zh'}
|
||
|
],
|
||
|
item: 'default',
|
||
|
primary: '',
|
||
2 years ago
|
colors: ['#ea4235', '#4CAF50', '#FF9800', '#0288D1'],
|
||
4 years ago
|
customKey: null,
|
||
|
colorPickerModel: false,
|
||
|
customTheme: {
|
||
3 years ago
|
primary: '#6f5dcc',
|
||
|
secondary: '#BFDBF7',
|
||
|
accent: '#ED254E',
|
||
|
info: '#00CED1',
|
||
|
success: '#4CAF50',
|
||
|
warning: '#FB8C00',
|
||
2 years ago
|
error: '#ff0100',
|
||
4 years ago
|
},
|
||
2 years ago
|
themes,
|
||
|
};
|
||
3 years ago
|
},
|
||
2 years ago
|
fetch({ store, params }) {},
|
||
4 years ago
|
computed: {
|
||
|
language: {
|
||
3 years ago
|
get() {
|
||
2 years ago
|
return this.$store.state.settings.language;
|
||
3 years ago
|
},
|
||
3 years ago
|
set(val) {
|
||
2 years ago
|
this.$store.commit('settings/MutLanguage', val);
|
||
|
},
|
||
4 years ago
|
},
|
||
|
showMetatable: {
|
||
3 years ago
|
get() {
|
||
2 years ago
|
return this.$store.state.settings.metatables;
|
||
4 years ago
|
},
|
||
3 years ago
|
set(show) {
|
||
2 years ago
|
this.$store.commit('settings/MutMetatables', show);
|
||
|
},
|
||
4 years ago
|
},
|
||
|
showScreensaver: {
|
||
3 years ago
|
get() {
|
||
2 years ago
|
return this.$store.state.settings.screensaver;
|
||
4 years ago
|
},
|
||
3 years ago
|
set(show) {
|
||
2 years ago
|
this.$store.commit('settings/MutScreensaver', show);
|
||
|
},
|
||
3 years ago
|
},
|
||
|
includeM2M: {
|
||
|
get() {
|
||
2 years ago
|
return this.$store.state.settings.includeM2M;
|
||
3 years ago
|
},
|
||
|
set(show) {
|
||
2 years ago
|
this.$store.commit('settings/MutIncludeM2M', show);
|
||
|
},
|
||
|
},
|
||
4 years ago
|
},
|
||
3 years ago
|
created() {
|
||
2 years ago
|
this.customTheme = { ...this.customTheme, ...this.$store.state.settings.customTheme };
|
||
|
this.item = this.$store.state.settings.themeName;
|
||
4 years ago
|
this.$store.watch(
|
||
3 years ago
|
state => state.settings.customTheme,
|
||
2 years ago
|
theme => {
|
||
|
this.customTheme = { ...this.customTheme, ...theme };
|
||
|
}
|
||
|
);
|
||
4 years ago
|
|
||
2 years ago
|
this.$store.watch(
|
||
|
state => state.settings.themeName,
|
||
|
theme => {
|
||
4 years ago
|
this.$nextTick(() => {
|
||
2 years ago
|
if (this.item !== theme) {
|
||
|
this.item = theme;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
);
|
||
4 years ago
|
},
|
||
3 years ago
|
methods: {
|
||
3 years ago
|
rightClick() {
|
||
2 years ago
|
this.rightClickCount++;
|
||
3 years ago
|
if (this.rightClickCount > 5) {
|
||
|
// require('electron').remote.getCurrentWindow().toggleDevTools();
|
||
2 years ago
|
this.rightClickCount = 0;
|
||
3 years ago
|
}
|
||
|
},
|
||
3 years ago
|
async changeTheme(t, theme = 'Custom') {
|
||
2 years ago
|
this.item = theme;
|
||
|
if (theme === 'Custom') {
|
||
|
await this.$store.dispatch('settings/ActSetTheme', { theme: { ...t }, custom: true });
|
||
|
}
|
||
|
await this.$store.dispatch('settings/ActSetTheme', { theme: { ...t }, themeName: theme });
|
||
|
this.$e('c:themes:change', { mode: theme });
|
||
3 years ago
|
},
|
||
3 years ago
|
toggleDarkTheme(mode) {
|
||
2 years ago
|
this.$store.commit('settings/MutToggleDarkMode');
|
||
|
this.$e('c:themes:dark-mode', { dark: mode });
|
||
|
},
|
||
3 years ago
|
},
|
||
2 years ago
|
beforeCreated() {},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
2 years ago
|
<style scoped></style>
|
||
4 years ago
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|