add dark mode

This commit is contained in:
Gabriel Pastori 2023-11-23 22:07:25 -03:00
parent 4cd491cf7f
commit af3f3f5736
4 changed files with 26 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "evolution-manager", "name": "evolution-manager",
"version": "0.3.5", "version": "0.3.6",
"main": "dist", "main": "dist",
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=16.0.0"

View File

@ -119,8 +119,8 @@
</v-alert> </v-alert>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-btn text @click="dialog = false" :disabled="loading">Fechar</v-btn>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn text to="/" :disabled="loading">Cancel</v-btn>
<v-btn <v-btn
color="success" color="success"
variant="tonal" variant="tonal"

View File

@ -1,7 +1,7 @@
<template> <template>
<v-app-bar flat> <v-app-bar flat>
<v-app-bar-title class="flex-shrink-0"> <v-app-bar-title class="flex-shrink-0">
<v-btn variant="text" @click="$router.push({name: 'instances'})"> <v-btn variant="text" @click="$router.push({ name: 'instances' })">
<v-img src="@/assets/logo.png" height="24" width="24" class="mr-2" /> <v-img src="@/assets/logo.png" height="24" width="24" class="mr-2" />
Evolution Manager Evolution Manager
</v-btn> </v-btn>
@ -9,7 +9,11 @@
<v-icon v-if="AppStore.connecting" color="info"> <v-icon v-if="AppStore.connecting" color="info">
mdi-loading mdi-spin mdi-loading mdi-spin
</v-icon> </v-icon>
<v-chip v-else-if="AppStore.validConnection" color="success" style="max-width: 40vw"> <v-chip
v-else-if="AppStore.validConnection"
color="success"
style="max-width: 40vw"
>
<v-icon color="success" start> mdi-check-circle </v-icon> <v-icon color="success" start> mdi-check-circle </v-icon>
{{ {{
AppStore.connection.host.replace(/https?:\/\//, "").replace(/\/$/, "") AppStore.connection.host.replace(/https?:\/\//, "").replace(/\/$/, "")
@ -19,6 +23,11 @@
<v-btn @click="openSettings" icon> <v-btn @click="openSettings" icon>
<v-icon>mdi-cog</v-icon> <v-icon>mdi-cog</v-icon>
</v-btn> </v-btn>
<v-btn @click="toggleTheme" icon>
<v-icon>mdi-{{
dark ? "white-balance-sunny" : "weather-night"
}}</v-icon>
</v-btn>
</v-app-bar> </v-app-bar>
<SettingsModal ref="settings" /> <SettingsModal ref="settings" />
</template> </template>
@ -26,20 +35,32 @@
<script> <script>
import SettingsModal from "@/components/modal/Settings.vue"; import SettingsModal from "@/components/modal/Settings.vue";
import { useAppStore } from "@/store/app"; import { useAppStore } from "@/store/app";
import { useTheme } from "vuetify";
export default { export default {
name: "AppBar", name: "AppBar",
data: () => ({ data: () => ({
AppStore: useAppStore(), AppStore: useAppStore(),
theme: useTheme(),
}), }),
components: { components: {
SettingsModal, SettingsModal,
}, },
methods: { methods: {
toggleTheme() {
this.theme.global.name = this.theme.global.current.dark
? "light"
: "dark";
},
openSettings() { openSettings() {
this.$refs.settings.open(); this.$refs.settings.open();
}, },
}, },
computed: {
dark() {
return this.theme.global.current.dark;
},
},
async mounted() { async mounted() {
await this.AppStore.loadConnection(); await this.AppStore.loadConnection();
if (!this.AppStore.validConnection) this.openSettings(); if (!this.AppStore.validConnection) this.openSettings();

View File

@ -1,5 +1,5 @@
<template> <template>
<v-footer absolute app class="pt-10"> <v-footer absolute app class="mt-10">
<div class="d-flex flex-grow-1 flex-wrap gap-y-1 align-end"> <div class="d-flex flex-grow-1 flex-wrap gap-y-1 align-end">
<div class="flex-shrink-0 d-flex gap-2 align-center"> <div class="flex-shrink-0 d-flex gap-2 align-center">
<v-btn <v-btn