refactor(client): Refine routing (#8846)

This commit is contained in:
syuilo 2022-06-20 17:38:49 +09:00 committed by GitHub
parent 30a39a296d
commit 699f24f3dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
149 changed files with 6312 additions and 6670 deletions

View file

@ -19,8 +19,8 @@ import FormButton from '@/components/ui/button.vue';
import { applyTheme, validateTheme } from '@/scripts/theme';
import * as os from '@/os';
import { addTheme, getThemes } from '@/theme-store';
import * as symbols from '@/symbols';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
let installThemeCode = $ref(null);
@ -32,21 +32,21 @@ function parseThemeCode(code: string) {
} catch (err) {
os.alert({
type: 'error',
text: i18n.ts._theme.invalid
text: i18n.ts._theme.invalid,
});
return false;
}
if (!validateTheme(theme)) {
os.alert({
type: 'error',
text: i18n.ts._theme.invalid
text: i18n.ts._theme.invalid,
});
return false;
}
if (getThemes().some(t => t.id === theme.id)) {
os.alert({
type: 'info',
text: i18n.ts._theme.alreadyInstalled
text: i18n.ts._theme.alreadyInstalled,
});
return false;
}
@ -65,15 +65,17 @@ async function install(code: string): Promise<void> {
await addTheme(theme);
os.alert({
type: 'success',
text: i18n.t('_theme.installed', { name: theme.name })
text: i18n.t('_theme.installed', { name: theme.name }),
});
}
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.ts._theme.install,
icon: 'fas fa-download',
bg: 'var(--bg)',
},
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata({
title: i18n.ts._theme.install,
icon: 'fas fa-download',
bg: 'var(--bg)',
});
</script>