1<template>
2 <FrappeUIProvider>
3 <router-view />
4 </FrappeUIProvider>
5 <Dialogs />
6</template>
7
8<script setup lang="ts">
9import { Dialogs } from "@/components/dialogs";
10import { useConfigStore } from "@/stores/config";
11import { useFavicon } from "@vueuse/core";
12import { FrappeUIProvider, setConfig, toast, useColorScheme } from "frappe-ui";
13import { storeToRefs } from "pinia";
14import { h, onMounted } from "vue";
15import Wifi from "~icons/lucide/wifi";
16import WifiOff from "~icons/lucide/wifi-off";
17import { __ } from "./translation";
18
19const configStore = useConfigStore();
20const { favicon } = storeToRefs(configStore);
21
22useFavicon(favicon);
23
24if (!localStorage.getItem("theme")) {
25 localStorage.setItem("theme", "light");
26}
27useColorScheme();
28
29onMounted(() => {
30 window.addEventListener("online", () => {
31 toast(__("You are now online."), {
32 icon: () => h(Wifi, { class: "text-ink-base" }),
33 });
34 });
35
36 window.addEventListener("offline", () => {
37 toast(__("You are now offline."), {
38 icon: () => h(WifiOff, { class: "text-ink-base" }),
39 });
40 });
41 setConfig("localTimezone", window.timezone?.user);
42 setConfig("systemTimezone", window.timezone?.system || null);
43});
44</script>
45