feat: add mt theme option to default and classic frontend settings
Docker Build / Build and Push Docker Image (push) Failing after 4m7s

This commit is contained in:
2026-06-14 00:18:39 +08:00
parent a8a96a7e60
commit 0c34bbcd46
3 changed files with 24 additions and 10 deletions
+17 -7
View File
@@ -280,10 +280,14 @@ const OtherSetting = () => {
}
};
const switchToDefaultFrontend = () => {
const switchToFrontend = (theme) => {
const names = {
default: t('新版前端'),
mt: 'MT 前端',
};
Modal.confirm({
title: t('切换到新版前端'),
content: t('切换后页面会自动刷新,并进入新版前端。是否继续?'),
title: t('切换到') + names[theme],
content: t('切换后页面会自动刷新,并进入') + names[theme] + t('。是否继续?'),
okText: t('确认切换'),
cancelText: t('取消'),
onOk: async () => {
@@ -294,19 +298,19 @@ const OtherSetting = () => {
}));
const res = await API.put('/api/option/', {
key: 'theme.frontend',
value: 'default',
value: theme,
});
const { success, message } = res.data;
if (!success) {
showError(message);
return;
}
showSuccess(t('已切换到新版前端,正在刷新页面'));
showSuccess(t('已切换到') + names[theme] + t(',正在刷新页面'));
setTimeout(() => {
window.location.reload();
}, 600);
} catch (error) {
console.error('切换新版前端失败', error);
console.error(t('切换前端失败'), error);
showError(t('切换失败,请稍后重试'));
} finally {
setLoadingInput((loadingInput) => ({
@@ -383,11 +387,17 @@ const OtherSetting = () => {
{t('检查更新')}
</Button>
<Button
onClick={switchToDefaultFrontend}
onClick={() => switchToFrontend('default')}
loading={loadingInput['FrontendTheme']}
>
{t('切换到新版前端')}
</Button>
<Button
onClick={() => switchToFrontend('mt')}
loading={loadingInput['FrontendTheme']}
>
MT 前端
</Button>
</Space>
</Col>
</Row>
@@ -85,7 +85,7 @@ export function SystemInfoSection({ defaultValues }: SystemInfoSectionProps) {
const normalizedDefaults: SystemInfoFormValues = {
theme: {
frontend:
defaultValues.theme?.frontend === 'classic' ? 'classic' : 'default',
defaultValues.theme?.frontend === 'classic' ? 'classic' : defaultValues.theme?.frontend === 'mt' ? 'mt' : 'default',
},
SystemName: normalizeValue(defaultValues.SystemName),
ServerAddress: normalizeValue(defaultValues.ServerAddress),
@@ -101,7 +101,7 @@ export function SystemInfoSection({ defaultValues }: SystemInfoSectionProps) {
const systemInfoSchemaWithI18n = z.object({
theme: z.object({
frontend: z.enum(['default', 'classic']),
frontend: z.enum(['default', 'classic', 'mt']),
}),
SystemName: z.string().min(1, {
error: () => t('System name is required'),
@@ -170,6 +170,10 @@ export function SystemInfoSection({ defaultValues }: SystemInfoSectionProps) {
value: 'classic',
label: t('Classic (Legacy Frontend)'),
},
{
value: 'mt',
label: 'MT (MT Frontend)',
},
]}
onValueChange={field.onChange}
value={field.value}
@@ -37,7 +37,7 @@ const SITE_SECTIONS = [
<SystemInfoSection
defaultValues={{
theme: {
frontend: settings['theme.frontend'] as 'default' | 'classic',
frontend: settings['theme.frontend'] as 'default' | 'classic' | 'mt',
},
SystemName: settings.SystemName,
Logo: settings.Logo,