Skip to content

Commit 9eb66f9

Browse files
committed
feat: theme switch
1 parent c9b5772 commit 9eb66f9

File tree

7 files changed

+50
-8
lines changed

7 files changed

+50
-8
lines changed

dashboard/components/layout/Navigation.vue renamed to dashboard/components/layout/navigation.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
<v-spacer />
1212

13-
<LayoutAuthentication v-if="loggedIn" />
13+
<LayoutTheme class="mr-4" />
14+
<LayoutProfile v-if="loggedIn" />
1415
</v-row>
1516
</v-container>
1617
</v-app-bar>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template>
2+
<v-btn variant="text" v-bind="$attrs" :icon="icon" @click="changeTheme" />
3+
</template>
4+
5+
<script setup lang="ts">
6+
import { computed, useColorMode } from "#imports";
7+
import { useTheme } from "vuetify";
8+
9+
const theme = useTheme();
10+
const colorMode = useColorMode();
11+
const icon = computed(() =>
12+
colorMode.value === "light" ? "mdi-weather-night" : "mdi-weather-sunny",
13+
);
14+
const changeTheme = () => {
15+
colorMode.preference = colorMode.value === "light" ? "dark" : "light";
16+
colorMode.value = colorMode.preference;
17+
syncTheme();
18+
};
19+
20+
const syncTheme = () => {
21+
theme.global.name.value = colorMode.value;
22+
};
23+
24+
if (process.client) {
25+
syncTheme();
26+
}
27+
</script>

dashboard/components/prompt/preview.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
2-
<v-expansion-panels>
2+
<v-expansion-panels color="secondary">
33
<v-expansion-panel :title="$t('prompt.preview')">
44
<v-expansion-panel-text>
5-
<v-tabs bg-color="primary" v-model="tab">
5+
<v-tabs bg-color="secondary" v-model="tab">
66
<v-tab value="preview">
77
{{ $t("prompt.preview") }}
88
</v-tab>
@@ -30,8 +30,6 @@
3030
&lt;feedback-fusion-prompt
3131
baseUrl="{{ config.public.feedbackFusionEndpoint }}"
3232
promptId="{{ prompt }}"
33-
class="mt-4 mb-4"
34-
style="width: 500px; max-width: 95vw"
3533
/&gt;
3634
</code>
3735
</pre>

dashboard/nuxt.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default defineNuxtConfig({
1818
"@nuxtjs/i18n",
1919
"nuxt-oidc-auth",
2020
"@pinia/nuxt",
21+
"@nuxtjs/color-mode",
2122
],
2223
i18n: {
2324
locales: [{ code: "en", language: "en-US", file: "en.json" }],
@@ -70,9 +71,6 @@ export default defineNuxtConfig({
7071
},
7172
vuetify: {
7273
vuetifyOptions: {
73-
theme: {
74-
defaultTheme: "dark",
75-
},
7674
labComponents: true,
7775
},
7876
},

dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint": "eslint ."
1313
},
1414
"dependencies": {
15+
"@nuxtjs/color-mode": "^3.5.2",
1516
"@nuxtjs/i18n": "^9.1.1",
1617
"@onelitefeathernet/feedback-fusion": "link:../lib",
1718
"@pinia/nuxt": "0.9.0",

dashboard/pnpm-lock.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)