Add dark mode support (#16)
This commit is contained in:
1 parent
ddef4cec2a
commit
b8970e1373
46 files changed
+247
-166
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "minor",
|
||||
"comment": "add dark mode support",
|
||||
"packageName": "@acedatacloud/hub",
|
||||
"email": "cqc@cuiqingcai.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -52,6 +52,7 @@
|
||||
"uuid": "^8.3.2",
|
||||
"vue": "^3.2.6",
|
||||
"vue-codemirror": "^6.1.1",
|
||||
"vue-dark-switch": "^1.0.6",
|
||||
"vue-i18n": "^9.1.7",
|
||||
"vue-qrcode": "^2.2.0",
|
||||
"vue-router": "^4.0.11",
|
||||
|
||||
@@ -7,6 +7,18 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
html,
|
||||
html.dark,
|
||||
:root {
|
||||
--el-color-primary: #277186;
|
||||
--el-color-primary-light-3: #689caa;
|
||||
--el-color-primary-light-5: #93b8c3;
|
||||
--el-color-primary-light-7: #bed4db;
|
||||
--el-color-primary-light-8: #d4e3e7;
|
||||
--el-color-primary-light-9: #e9f1f3;
|
||||
--el-color-primary-dark-2: #1f5a6b;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
@forward 'element-plus/theme-chalk/src/common/var.scss' with (
|
||||
$colors: (
|
||||
'primary': (
|
||||
'base': #277186
|
||||
),
|
||||
'danger': (
|
||||
'base': #ec4450
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$--font-path: 'element-plus/theme-chalk/src/fonts';
|
||||
|
||||
@import 'element-plus/theme-chalk/src/index.scss';
|
||||
@import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
@@ -144,7 +144,6 @@ export default defineComponent({
|
||||
.info {
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-regular);
|
||||
// display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
.actions {
|
||||
|
||||
@@ -34,7 +34,7 @@ export default defineComponent({
|
||||
width: 2px;
|
||||
height: 16px;
|
||||
margin-top: 3px;
|
||||
background-color: var(--el-color-black);
|
||||
background-color: var(--el-text-color-primary);
|
||||
animation: blink 1s infinite;
|
||||
}
|
||||
</style>
|
||||
@@ -34,7 +34,6 @@
|
||||
</span>
|
||||
<el-input
|
||||
v-model="questionValue"
|
||||
:rows="3"
|
||||
:disabled="disabled"
|
||||
class="input"
|
||||
type="textarea"
|
||||
@@ -143,6 +142,8 @@ export default defineComponent({
|
||||
position: relative;
|
||||
.input {
|
||||
textarea {
|
||||
height: auto;
|
||||
max-height: 100px;
|
||||
border: none;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
@@ -165,7 +166,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.input-box {
|
||||
width: 100%;
|
||||
border: 1px solid #eee;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 10px;
|
||||
background: none;
|
||||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
|
||||
@@ -175,7 +176,7 @@ export default defineComponent({
|
||||
.btn-upload {
|
||||
cursor: not-allowed;
|
||||
.icon-attachment {
|
||||
color: #eee;
|
||||
color: var(--el-text-color-disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,20 +196,20 @@ export default defineComponent({
|
||||
left: 10px;
|
||||
.icon-attachment {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
&.btn-send {
|
||||
right: 15px;
|
||||
&.disabled {
|
||||
.icon-send {
|
||||
color: #eee;
|
||||
color: var(--el-text-color-disabled);
|
||||
}
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.icon-send {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.introduction-item {
|
||||
font-size: 14px;
|
||||
background-color: #eee;
|
||||
color: #333;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
color: var(--el-text-color-primary);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export default defineComponent({
|
||||
align-items: start;
|
||||
.content {
|
||||
background-color: var(--el-bg-color-page);
|
||||
color: var(--el-color-black);
|
||||
color: var(--el-text-color-primary);
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,23 +130,21 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.model-selector {
|
||||
background-color: #ececf1;
|
||||
background-color: var(--el-bg-color-page);
|
||||
padding: 7px 6px;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 5px;
|
||||
.group {
|
||||
padding: 20px 30px;
|
||||
color: black;
|
||||
color: var(--el-text-color-primary);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
margin: 0 3px;
|
||||
background-color: inherit;
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: inherit;
|
||||
}
|
||||
&:focus,
|
||||
&.active {
|
||||
background-color: white;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
}
|
||||
.icon {
|
||||
display: inline-block;
|
||||
@@ -161,7 +159,7 @@ export default defineComponent({
|
||||
.fa-chevron-down {
|
||||
margin-left: 5px;
|
||||
font-weight: 100;
|
||||
color: #999;
|
||||
color: var(--el-text-color-primary);
|
||||
transform: scale(0.8);
|
||||
}
|
||||
}
|
||||
@@ -171,6 +169,7 @@ export default defineComponent({
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
.icon {
|
||||
width: 15px;
|
||||
display: flex;
|
||||
@@ -190,12 +189,12 @@ export default defineComponent({
|
||||
.name {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
margin: 0;
|
||||
}
|
||||
.description {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
color: var(--el-text-color-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ export default defineComponent({
|
||||
padding: 15px;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
border-right: 1px solid #eee;
|
||||
border-right: 1px solid var(--el-border-color);
|
||||
overflow-y: scroll;
|
||||
|
||||
.conversations {
|
||||
@@ -164,15 +164,15 @@ export default defineComponent({
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
margin-bottom: 5px;
|
||||
border: 1px dashed hsl(0, 0%, 93%);
|
||||
border: 1px dashed var(--el-border-color);
|
||||
line-height: 30px;
|
||||
border-radius: 10px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
cursor: pointer;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
background-color: #eee;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
}
|
||||
|
||||
.icons {
|
||||
@@ -189,10 +189,11 @@ export default defineComponent({
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-right: 8px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.operations {
|
||||
width: 40px;
|
||||
color: var(--el-text-color-regular);
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -34,7 +34,7 @@ export default defineComponent({
|
||||
width: 2px;
|
||||
height: 16px;
|
||||
margin-top: 3px;
|
||||
background-color: var(--el-color-black);
|
||||
background-color: var(--el-text-color-primary);
|
||||
animation: blink 1s infinite;
|
||||
}
|
||||
</style>
|
||||
@@ -143,7 +143,7 @@ export default defineComponent({
|
||||
padding: 15px;
|
||||
width: 300px;
|
||||
height: 100%;
|
||||
border-right: 1px solid #eee;
|
||||
border-right: 1px solid var(--el-border-color);
|
||||
overflow-y: scroll;
|
||||
|
||||
.conversations {
|
||||
@@ -158,15 +158,15 @@ export default defineComponent({
|
||||
flex-direction: row;
|
||||
padding: 10px;
|
||||
margin-bottom: 5px;
|
||||
border: 1px dashed hsl(0, 0%, 93%);
|
||||
border: 1px dashed var(--el-border-color);
|
||||
line-height: 30px;
|
||||
border-radius: 10px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
cursor: pointer;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
background-color: #eee;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
}
|
||||
|
||||
.icons {
|
||||
@@ -183,10 +183,11 @@ export default defineComponent({
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-right: 8px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.operations {
|
||||
width: 40px;
|
||||
color: var(--el-text-color-regular);
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
@@ -88,7 +88,7 @@ export default defineComponent({
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
margin-top: 5px;
|
||||
background-color: #eee;
|
||||
background-color: var(--el-bg-color-page);
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</span>
|
||||
<el-input
|
||||
v-model="questionValue"
|
||||
:rows="3"
|
||||
:disabled="disabled"
|
||||
class="input"
|
||||
type="textarea"
|
||||
@@ -89,6 +88,8 @@ export default defineComponent({
|
||||
.input-box {
|
||||
.input {
|
||||
textarea {
|
||||
height: auto;
|
||||
max-height: 100px;
|
||||
border: none;
|
||||
background: none;
|
||||
box-shadow: none;
|
||||
@@ -112,7 +113,7 @@ export default defineComponent({
|
||||
.input-box {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
border: 1px solid #eee;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 10px;
|
||||
background: none;
|
||||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
|
||||
@@ -132,13 +133,13 @@ export default defineComponent({
|
||||
right: 15px;
|
||||
&.disabled {
|
||||
.icon-send {
|
||||
color: #eee;
|
||||
color: var(--el-text-color-disabled);
|
||||
}
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.icon-send {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +148,7 @@ export default defineComponent({
|
||||
.info {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-regular);
|
||||
margin-top: 5px;
|
||||
margin-left: 3px;
|
||||
margin-bottom: 0;
|
||||
|
||||
@@ -140,7 +140,7 @@ export default defineComponent({
|
||||
align-items: start;
|
||||
.content {
|
||||
background-color: var(--el-bg-color-page);
|
||||
color: var(--el-color-black);
|
||||
color: var(--el-text-color-primary);
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export default defineComponent({
|
||||
border-radius: 50%;
|
||||
padding: 5px 6px;
|
||||
cursor: pointer;
|
||||
color: var(--el-color-black);
|
||||
background: var(--el-color-white);
|
||||
background-color: inherit;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<dark-switch class="switch" dark-background="#333" light-background="#fff" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { Switch as DarkSwitch, toggleDark, isDark } from 'vue-dark-switch';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
DarkSwitch
|
||||
},
|
||||
emits: ['update:dark'],
|
||||
computed: {
|
||||
dark() {
|
||||
return this.$store.getters.dark;
|
||||
},
|
||||
switchValue() {
|
||||
return isDark.value;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
switchValue(val) {
|
||||
console.log('switchValue', val);
|
||||
this.$store.dispatch('setDark', val);
|
||||
},
|
||||
dark(val) {
|
||||
document.documentElement.classList.toggle('dark', val);
|
||||
this.$store.dispatch('setDark', this.dark);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.dark) {
|
||||
toggleDark(true);
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
toggleDark(false);
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.switch {
|
||||
margin-top: 2px;
|
||||
--n-rail-color-active: var(--el-color-primary) !important;
|
||||
--n-loading-color: var(--el-color-primary) !important;
|
||||
border-radius: 10px !important;
|
||||
border: 1px solid var(--el-border-color);
|
||||
overflow: hidden;
|
||||
.n-switch__button {
|
||||
border-radius: 50% !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,29 +0,0 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="`<p>${$t('common.message.helpWechat')}: yuxingzou</p><p>${$t(
|
||||
'common.message.helpWechat2'
|
||||
)}: sunbitty</p>`"
|
||||
placement="top-start"
|
||||
raw-content
|
||||
>
|
||||
<el-button type="primary" circle size="large">
|
||||
<font-awesome-icon icon="fa-solid fa-question" />
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElTooltip, ElButton } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'HelpEntry',
|
||||
components: {
|
||||
ElTooltip,
|
||||
ElButton,
|
||||
FontAwesomeIcon
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,45 +0,0 @@
|
||||
<template>
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="`<p>${$t('common.message.helpWechat')}: yuxingzou</p><p>${$t(
|
||||
'common.message.helpWechat2'
|
||||
)}: sunbitty</p>`"
|
||||
placement="top-start"
|
||||
raw-content
|
||||
>
|
||||
<el-button class="button">
|
||||
<font-awesome-icon icon="fa-solid fa-question" />
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { ElTooltip, ElButton } from 'element-plus';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'HelpEntry',
|
||||
components: {
|
||||
ElTooltip,
|
||||
ElButton,
|
||||
FontAwesomeIcon
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
background-color: var(--el-bg-color-page);
|
||||
&.active,
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--el-button-hover-bg-color);
|
||||
color: var(--el-button-active-text-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<img :src="url" class="logo" @click="$emit('click')" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
emits: ['click'],
|
||||
data() {
|
||||
return {
|
||||
url1: 'https://cdn.acedata.cloud/logo.png/thumb_450x_',
|
||||
url2: 'https://cdn.acedata.cloud/logo2.png/thumb_450x_'
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dark() {
|
||||
return this.$store.getters.dark;
|
||||
},
|
||||
url() {
|
||||
return this.dark ? this.url2 : this.url1;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -4,7 +4,8 @@
|
||||
<chevron v-else class="chevron" direction="left" @click="onCollapseMenu"></chevron>
|
||||
<div class="top">
|
||||
<div v-if="!collapsed">
|
||||
<img src="@/assets/images/logo.png" class="logo" @click="onHome" />
|
||||
<logo @click="onHome" />
|
||||
<dark-selector v-show="false" />
|
||||
</div>
|
||||
<el-menu v-if="!collapsed" :default-active="activeIndex">
|
||||
<el-menu-item
|
||||
@@ -97,11 +98,15 @@ import {
|
||||
ROUTE_MIDJOURNEY_INDEX
|
||||
} from '@/router/constants';
|
||||
import Chevron from './Chevron.vue';
|
||||
import DarkSelector from './DarkSelector.vue';
|
||||
import Logo from './Logo.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Navigator',
|
||||
components: {
|
||||
ElButton,
|
||||
Logo,
|
||||
DarkSelector,
|
||||
ElTooltip,
|
||||
LocaleSelector,
|
||||
FontAwesomeIcon,
|
||||
@@ -213,8 +218,16 @@ export default defineComponent({
|
||||
.el-menu {
|
||||
width: 180px;
|
||||
border-right: none;
|
||||
background: none;
|
||||
.el-menu-item {
|
||||
height: 50px;
|
||||
color: var(--el-text-color-primary);
|
||||
&.active,
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--el-button-hover-bg-color);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,11 +261,11 @@ export default defineComponent({
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
background-color: var(--el-bg-color-page);
|
||||
color: var(--el-text-color-primary);
|
||||
background-color: var(--el-bg-color-overlay);
|
||||
&.active,
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: var(--el-button-hover-bg-color);
|
||||
color: var(--el-button-active-text-color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ $padding-left: 10px;
|
||||
cursor: pointer;
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
color: #444;
|
||||
color: var(--el-text-color-primary);
|
||||
line-height: $height;
|
||||
padding-left: 10px;
|
||||
.suffix {
|
||||
@@ -150,7 +150,7 @@ $padding-left: 10px;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background-color: #ebedf1;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2139,7 +2139,7 @@ export default defineComponent({
|
||||
margin-bottom: 8px;
|
||||
border-width: 3px;
|
||||
border-style: solid;
|
||||
border-color: #eee;
|
||||
border-color: var(--el-border-color);
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -48,7 +48,7 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.channel-selector {
|
||||
background-color: #ececf1;
|
||||
background-color: var(--el-bg-color-page);
|
||||
padding: 7px 6px;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 5px;
|
||||
@@ -57,17 +57,15 @@ export default defineComponent({
|
||||
margin-right: auto;
|
||||
.button {
|
||||
padding: 20px 30px;
|
||||
color: black;
|
||||
color: var(--el-text-color-primary);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
margin: 0 3px;
|
||||
background-color: inherit;
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: inherit;
|
||||
}
|
||||
&:focus,
|
||||
&.active {
|
||||
background-color: white;
|
||||
background-color: var(--el-fill-color-extra-light);
|
||||
}
|
||||
.icon {
|
||||
display: inline-block;
|
||||
|
||||
@@ -56,7 +56,6 @@ export default defineComponent({
|
||||
border-right: 1px solid var(--el-border-color);
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
background-color: var(--el-bg-color);
|
||||
.block {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ export default defineComponent({
|
||||
.item {
|
||||
width: 115px;
|
||||
height: 60px;
|
||||
border: 2px solid #eee;
|
||||
border: 2px solid var(--el-border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@@ -101,7 +101,7 @@ export default defineComponent({
|
||||
.item {
|
||||
width: 40px;
|
||||
height: 60px;
|
||||
border: 2px solid #eee;
|
||||
border: 2px solid var(--el-border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@@ -118,7 +118,7 @@ export default defineComponent({
|
||||
justify-content: center;
|
||||
|
||||
.rect {
|
||||
border: 2px solid #eee;
|
||||
border: 2px solid var(--el-border-color);
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 2px;
|
||||
|
||||
@@ -85,7 +85,7 @@ export default defineComponent({
|
||||
<style lang="scss" scoped>
|
||||
.description {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.tasks {
|
||||
|
||||
@@ -2,6 +2,10 @@ import { createI18n, I18n } from 'vue-i18n';
|
||||
import { nextTick } from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
declare namespace Intl {
|
||||
function getCanonicalLocales(locales: string | string[] | undefined): string[];
|
||||
}
|
||||
|
||||
export const DEFAULT_LOCALE = 'en';
|
||||
|
||||
export const SUPPORTED_LOCALES = [
|
||||
@@ -43,6 +47,24 @@ export const loadLocalResource = async (name: string, locale: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getLocale = (): string => {
|
||||
const canonicalLang = Intl.getCanonicalLocales(navigator.language)?.[0];
|
||||
const supportedLocales = SUPPORTED_LOCALES.map((locale) => locale.value);
|
||||
// if the canonical language is supported, use it
|
||||
if (canonicalLang && supportedLocales.includes(canonicalLang)) {
|
||||
console.debug('canonicalLang', canonicalLang);
|
||||
return canonicalLang;
|
||||
} else {
|
||||
// if the canonical language prefix is supported, use it
|
||||
const canonicalLangPrefix = canonicalLang?.split('-')?.[0];
|
||||
if (canonicalLangPrefix && supportedLocales.includes(canonicalLangPrefix)) {
|
||||
console.debug('canonicalLangPrefix', canonicalLangPrefix);
|
||||
return canonicalLangPrefix;
|
||||
}
|
||||
}
|
||||
return DEFAULT_LOCALE;
|
||||
};
|
||||
|
||||
export const loadLocaleMessages = async (i18n: I18n, locale: string) => {
|
||||
const names = [
|
||||
'api',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export interface IToken {
|
||||
access?: string;
|
||||
refresh?: string;
|
||||
expiration?: number;
|
||||
}
|
||||
|
||||
export interface ITokenResponse extends IToken {}
|
||||
|
||||
@@ -132,7 +132,7 @@ export default defineComponent({
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 20px;
|
||||
background-color: #f2f3f5;
|
||||
background-color: var(--el-bg-color-page);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -141,12 +141,13 @@ export default defineComponent({
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.introduction {
|
||||
margin-bottom: 20px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.status {
|
||||
@@ -184,12 +185,12 @@ export default defineComponent({
|
||||
|
||||
.id {
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export default defineComponent({
|
||||
.introduction {
|
||||
margin-bottom: 20px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.operations {
|
||||
|
||||
@@ -197,13 +197,13 @@ export default defineComponent({
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.el-card {
|
||||
padding: 50px 0;
|
||||
|
||||
@@ -208,13 +208,13 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.el-table {
|
||||
min-height: calc(100vh - 350px);
|
||||
|
||||
@@ -249,13 +249,13 @@ export default defineComponent({
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
.el-card {
|
||||
min-height: 500px;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ export default defineComponent({
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
border: 2px solid #eee;
|
||||
border: 2px solid var(--el-border-color);
|
||||
&:first-child {
|
||||
border-top-left-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
|
||||
@@ -191,13 +191,13 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.el-table {
|
||||
min-height: calc(100vh - 300px);
|
||||
|
||||
@@ -154,7 +154,7 @@ export default defineComponent({
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.el-table {
|
||||
@@ -165,7 +165,7 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ export default defineComponent({
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.item-mini {
|
||||
@@ -343,7 +343,7 @@ export default defineComponent({
|
||||
width: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 50%;
|
||||
background-color: #eee;
|
||||
background-color: var(--el-bg-color-page);
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
.icon {
|
||||
@@ -364,7 +364,7 @@ export default defineComponent({
|
||||
margin: 0;
|
||||
}
|
||||
.description {
|
||||
color: #999;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 14px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
@@ -415,13 +415,13 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
|
||||
.message {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -139,7 +139,7 @@ export default defineComponent({
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.el-table {
|
||||
@@ -150,7 +150,7 @@ export default defineComponent({
|
||||
.panel {
|
||||
padding: 30px;
|
||||
width: calc(100% - 300px);
|
||||
background-color: #f3f5f6;
|
||||
background-color: var(--el-bg-color-page);
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@ export const setToken = ({ commit }: ActionContext<IRootState, IRootState>, payl
|
||||
commit('setToken', payload);
|
||||
};
|
||||
|
||||
export const setDark = ({ commit }: ActionContext<IRootState, IRootState>, payload: boolean) => {
|
||||
commit('setDark', payload);
|
||||
};
|
||||
|
||||
export const setLocale = ({ commit }: ActionContext<IRootState, IRootState>, payload: string) => {
|
||||
commit('setLocale', payload);
|
||||
};
|
||||
@@ -63,6 +67,7 @@ export default {
|
||||
resetUser,
|
||||
resetSetting,
|
||||
setToken,
|
||||
setDark,
|
||||
setUser,
|
||||
getToken,
|
||||
getUser
|
||||
|
||||
@@ -8,6 +8,10 @@ export const user = (state: IRootState): any => {
|
||||
return state.user;
|
||||
};
|
||||
|
||||
export const dark = (state: IRootState): boolean => {
|
||||
return state.dark;
|
||||
};
|
||||
|
||||
export const locale = (state: IRootState): string => {
|
||||
return state.locale;
|
||||
};
|
||||
@@ -25,5 +29,6 @@ export default {
|
||||
authenticated,
|
||||
user,
|
||||
token,
|
||||
dark,
|
||||
setting
|
||||
};
|
||||
@@ -9,9 +9,10 @@ export interface ISetting {
|
||||
|
||||
export interface ICommonState {
|
||||
token: IToken;
|
||||
user: IUser;
|
||||
user?: IUser;
|
||||
setting?: ISetting;
|
||||
locale: string;
|
||||
dark: boolean;
|
||||
}
|
||||
|
||||
export interface IRootState extends ICommonState {
|
||||
|
||||
@@ -12,6 +12,10 @@ export const setLocale = (state: IRootState, payload: string): void => {
|
||||
state.locale = payload;
|
||||
};
|
||||
|
||||
export const setDark = (state: IRootState, payload: boolean): void => {
|
||||
state.dark = payload;
|
||||
};
|
||||
|
||||
export const setToken = (state: IRootState, payload: any): void => {
|
||||
state.token = {
|
||||
...state.token,
|
||||
@@ -43,6 +47,7 @@ export default {
|
||||
setUser,
|
||||
resetUser,
|
||||
setToken,
|
||||
setDark,
|
||||
resetToken,
|
||||
setSetting,
|
||||
resetSetting
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { IRootState } from './models';
|
||||
import chatState from '../chat/state';
|
||||
import midjourneyState from '../midjourney/state';
|
||||
import chatdocState from '../chatdoc/state';
|
||||
import { getLocale } from '@/i18n';
|
||||
|
||||
export default (): IRootState => {
|
||||
return {
|
||||
user: {},
|
||||
locale: getLocale(),
|
||||
dark: window.matchMedia('(prefers-color-scheme: dark)').matches,
|
||||
token: {
|
||||
access: undefined,
|
||||
refresh: undefined,
|
||||
@@ -14,6 +18,7 @@ export default (): IRootState => {
|
||||
// if PC, set default to true, else false
|
||||
navigationCollapsed: window.innerWidth < 768
|
||||
},
|
||||
chatdoc: chatdocState(),
|
||||
chat: chatState(),
|
||||
midjourney: midjourneyState()
|
||||
};
|
||||
|
||||
@@ -4333,6 +4333,11 @@ vue-codemirror@^6.1.1:
|
||||
"@codemirror/state" "6.x"
|
||||
"@codemirror/view" "6.x"
|
||||
|
||||
vue-dark-switch@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/vue-dark-switch/-/vue-dark-switch-1.0.6.tgz#1b64a0f42618a1efb1332dddef2e91ccf5c5cd0d"
|
||||
integrity sha512-M8P2pdoEfO98Zgj3OMDjOgSKTU961oqZoOUidzaP61JzfqVbsEa7KUvQ1pNVx7oeNNXJiYMN147eYxb2oZzPKw==
|
||||
|
||||
vue-demi@*:
|
||||
version "0.12.1"
|
||||
resolved "https://registry.npmjs.org/vue-demi/-/vue-demi-0.12.1.tgz"
|
||||
|
||||
Reference in new issue
Block a user