2023-06-27 15:53:29 +08:00
|
|
|
<script setup>
|
2023-07-02 03:25:57 +08:00
|
|
|
import ConnectionDialog from './components/dialogs/ConnectionDialog.vue'
|
2023-06-27 15:53:29 +08:00
|
|
|
import NewKeyDialog from './components/dialogs/NewKeyDialog.vue'
|
|
|
|
import PreferencesDialog from './components/dialogs/PreferencesDialog.vue'
|
|
|
|
import RenameKeyDialog from './components/dialogs/RenameKeyDialog.vue'
|
|
|
|
import SetTtlDialog from './components/dialogs/SetTtlDialog.vue'
|
|
|
|
import hljs from 'highlight.js/lib/core'
|
|
|
|
import json from 'highlight.js/lib/languages/json'
|
|
|
|
import plaintext from 'highlight.js/lib/languages/plaintext'
|
|
|
|
import AddFieldsDialog from './components/dialogs/AddFieldsDialog.vue'
|
2023-06-28 00:47:44 +08:00
|
|
|
import AppContent from './AppContent.vue'
|
2023-07-02 16:52:07 +08:00
|
|
|
import GroupDialog from './components/dialogs/GroupDialog.vue'
|
2023-07-06 01:22:14 +08:00
|
|
|
import DeleteKeyDialog from './components/dialogs/DeleteKeyDialog.vue'
|
2023-08-24 00:44:19 +08:00
|
|
|
import { onMounted, ref, watch } from 'vue'
|
2023-07-13 15:46:12 +08:00
|
|
|
import usePreferencesStore from './stores/preferences.js'
|
|
|
|
import useConnectionStore from './stores/connections.js'
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2023-08-24 00:44:19 +08:00
|
|
|
import { darkTheme } from 'naive-ui'
|
2023-07-17 17:17:52 +08:00
|
|
|
import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue'
|
2023-08-02 17:57:39 +08:00
|
|
|
import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js'
|
2023-08-20 15:45:20 +08:00
|
|
|
import { themeOverrides } from '@/utils/theme.js'
|
2023-06-27 15:53:29 +08:00
|
|
|
|
|
|
|
hljs.registerLanguage('json', json)
|
|
|
|
hljs.registerLanguage('plaintext', plaintext)
|
|
|
|
|
2023-07-13 15:46:12 +08:00
|
|
|
const prefStore = usePreferencesStore()
|
|
|
|
const connectionStore = useConnectionStore()
|
|
|
|
const i18n = useI18n()
|
|
|
|
const initializing = ref(false)
|
2023-08-24 00:44:19 +08:00
|
|
|
onMounted(async () => {
|
2023-07-13 15:46:12 +08:00
|
|
|
try {
|
|
|
|
initializing.value = true
|
2023-08-28 11:38:09 +08:00
|
|
|
await prefStore.loadFontList()
|
2023-07-13 15:46:12 +08:00
|
|
|
await connectionStore.initConnections()
|
2023-08-20 15:45:20 +08:00
|
|
|
if (prefStore.autoCheckUpdate) {
|
|
|
|
prefStore.checkForUpdate()
|
|
|
|
}
|
2023-07-13 15:46:12 +08:00
|
|
|
} finally {
|
|
|
|
initializing.value = false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2023-08-26 00:49:44 +08:00
|
|
|
// watch theme and dynamically switch
|
2023-08-24 00:44:19 +08:00
|
|
|
watch(
|
|
|
|
() => prefStore.isDark,
|
|
|
|
(isDark) => (isDark ? WindowSetDarkTheme() : WindowSetLightTheme()),
|
|
|
|
)
|
2023-08-26 00:49:44 +08:00
|
|
|
|
|
|
|
// watch language and dynamically switch
|
|
|
|
watch(
|
|
|
|
() => prefStore.general.language,
|
|
|
|
(lang) => (i18n.locale.value = prefStore.currentLanguage),
|
|
|
|
)
|
2023-06-27 15:53:29 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-07-13 15:46:12 +08:00
|
|
|
<n-config-provider
|
|
|
|
:hljs="hljs"
|
|
|
|
:inline-theme-disabled="true"
|
2023-08-24 00:44:19 +08:00
|
|
|
:theme="prefStore.isDark ? darkTheme : undefined"
|
2023-07-13 15:46:12 +08:00
|
|
|
:theme-overrides="themeOverrides"
|
2023-08-28 11:56:51 +08:00
|
|
|
:locale="prefStore.themeLocale"
|
2023-08-24 15:23:25 +08:00
|
|
|
class="fill-height">
|
2023-07-13 15:46:12 +08:00
|
|
|
<n-global-style />
|
2023-08-20 14:42:36 +08:00
|
|
|
<n-dialog-provider>
|
2023-09-02 18:23:40 +08:00
|
|
|
<n-spin v-show="initializing" :theme-overrides="{ opacitySpinning: 0 }" style="--wails-draggable: drag">
|
2023-08-20 14:42:36 +08:00
|
|
|
<div id="launch-container" />
|
|
|
|
</n-spin>
|
|
|
|
<app-content v-if="!initializing" class="flex-item-expand" />
|
2023-06-27 15:53:29 +08:00
|
|
|
|
2023-08-20 14:42:36 +08:00
|
|
|
<!-- top modal dialogs -->
|
|
|
|
<connection-dialog />
|
|
|
|
<group-dialog />
|
|
|
|
<new-key-dialog />
|
|
|
|
<key-filter-dialog />
|
|
|
|
<add-fields-dialog />
|
|
|
|
<rename-key-dialog />
|
|
|
|
<delete-key-dialog />
|
|
|
|
<set-ttl-dialog />
|
|
|
|
<preferences-dialog />
|
|
|
|
</n-dialog-provider>
|
2023-06-27 15:53:29 +08:00
|
|
|
</n-config-provider>
|
|
|
|
</template>
|
|
|
|
|
2023-07-13 15:46:12 +08:00
|
|
|
<style lang="scss">
|
|
|
|
#launch-container {
|
|
|
|
width: 100vw;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
2023-07-15 01:54:40 +08:00
|
|
|
|
|
|
|
#app-title {
|
|
|
|
text-align: center;
|
|
|
|
width: 100vw;
|
|
|
|
height: 30px;
|
|
|
|
line-height: 30px;
|
|
|
|
}
|
2023-07-13 15:46:12 +08:00
|
|
|
</style>
|