feat(frontend): Phase 5a — theme system + Vite 8 + vue-i18n 11

Bumps Vite to 8.0.11 (npm install picked up 6.4.2 from the stale
lockfile; clean install resolves the new constraint). Bumps vue-i18n
to 11.1.4 since v10 was just EOL'd.

Migrates aThemeSwitch.html — the two-flavor theme picker + global
themeSwitcher object — into:

- composables/useTheme.js: single reactive `theme` state with
  toggleTheme / toggleUltra. Boot side-effect applies the stored theme
  to <body>/<html> before Vue renders; watchEffect persists changes
  back to localStorage.
- components/ThemeSwitch.vue: full menu version for the main panel.
- components/ThemeSwitchLogin.vue: login-popover version.

AD-Vue 1 → 4 changes hit on this component:
- <a-icon type="bulb" :theme="filled|outlined"> dropped — replaced by
  explicit BulbFilled / BulbOutlined imports from
  @ant-design/icons-vue, swapped via <component :is="BulbIcon">
- Vue.component('a-theme-switch', { ... }) global registration → SFC
  + per-page import
- this.$message.config(...) (Vue 2 instance method) → message.config(...)
  imported from ant-design-vue, called once in login.js at boot

Login page now surfaces a settings button → popover → theme picker.

Known gap: web/assets/css/custom.min.css isn't yet imported into the
new bundle, so toggling dark mode currently only re-themes AD-Vue's
own components, not the panel chrome. The body class is still toggled
so behavior is correct; visual fidelity returns when custom.css is
ported or directly imported.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MHSanaei
2026-05-08 11:11:06 +02:00
parent 772e778aa0
commit 138696cf36
9 changed files with 850 additions and 747 deletions
+20 -1
View File
@@ -1,8 +1,10 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { UserOutlined, LockOutlined, KeyOutlined } from '@ant-design/icons-vue';
import { UserOutlined, LockOutlined, KeyOutlined, SettingOutlined } from '@ant-design/icons-vue';
import { HttpUtil } from '@/utils';
import { currentTheme } from '@/composables/useTheme.js';
import ThemeSwitchLogin from '@/components/ThemeSwitchLogin.vue';
// Phase 4 ships this page in English only. Translations come back in
// Phase 7 (vue-i18n) once we decide how the new build pipeline reads
@@ -69,6 +71,17 @@ async function login() {
</div>
<div v-else>
<div class="login-settings">
<a-popover :overlay-class-name="currentTheme" title="Settings" placement="bottomRight" trigger="click">
<template #content>
<ThemeSwitchLogin />
</template>
<a-button shape="circle">
<template #icon><SettingOutlined /></template>
</a-button>
</a-popover>
</div>
<a-row justify="center">
<a-col :span="24">
<h2 class="login-title">Welcome to 3x-ui</h2>
@@ -134,6 +147,12 @@ async function login() {
background: #f0f2f5;
}
.login-settings {
display: flex;
justify-content: flex-end;
margin-bottom: 8px;
}
.login-content {
position: relative;
}