mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat; add config for startup page #40
This commit is contained in:
@@ -35,6 +35,7 @@ settings:
|
||||
mandarin_cn: 官话
|
||||
mandarin_tw: 官話
|
||||
jyut: 廣東話
|
||||
startup_page: 启动页
|
||||
recommendation_mode: 推荐模式
|
||||
recommendation_mode_desc: >
|
||||
如果您想使用 app 端的推荐算法,请先授权 BewlyBewly 使用 access key。
|
||||
|
||||
@@ -35,6 +35,7 @@ settings:
|
||||
mandarin_cn: 官话
|
||||
mandarin_tw: 官話
|
||||
jyut: 廣東話
|
||||
startup_page: 起始頁面
|
||||
recommendation_mode: 推薦模式
|
||||
recommendation_mode_desc: >
|
||||
如果您想要使用手機端的推薦演算法,請先授權 BewlyBewly 使用 access key。
|
||||
|
||||
@@ -35,6 +35,7 @@ settings:
|
||||
mandarin_cn: Mandarin - Simplified Chinese
|
||||
mandarin_tw: Mandarin - Traditional Chinese
|
||||
jyut: Cantonese
|
||||
startup_page: Startup page
|
||||
recommendation_mode: Recommendation mode
|
||||
recommendation_mode_desc: >
|
||||
If you want to use the recommendation algorithm on the app, please ensure that you authorize the BewlyBewly to use the access key first.
|
||||
|
||||
@@ -35,6 +35,7 @@ settings:
|
||||
mandarin_cn: 官话
|
||||
mandarin_tw: 官話
|
||||
jyut: 廣東話
|
||||
startup_page: 開始頁面
|
||||
recommendation_mode: 推介模式
|
||||
recommendation_mode_desc: >
|
||||
若然你想用手機版嘅推介演算法,就要俾 BewlyBewly 批准使用存取 access key。
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { settings } from '~/logic'
|
||||
import { AppPage } from '~/enums/appEnums'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
const langs = computed(() => {
|
||||
const langOptions = computed(() => {
|
||||
return [
|
||||
{
|
||||
value: 'en',
|
||||
@@ -41,6 +42,17 @@ const dockPositions = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const pageOptions = computed((): { label: string; value: string }[] => {
|
||||
return [
|
||||
{ label: t('dock.search'), value: AppPage.Search },
|
||||
{ label: t('dock.home'), value: AppPage.Home },
|
||||
{ label: t('dock.anime'), value: AppPage.Anime },
|
||||
{ label: t('dock.history'), value: AppPage.History },
|
||||
{ label: t('dock.favorites'), value: AppPage.Favorites },
|
||||
{ label: t('dock.watch_later'), value: AppPage.WatchLater },
|
||||
]
|
||||
})
|
||||
|
||||
watch(() => settings.value.language, (newValue, oldValue) => {
|
||||
locale.value = newValue
|
||||
})
|
||||
@@ -49,9 +61,16 @@ watch(() => settings.value.language, (newValue, oldValue) => {
|
||||
<template>
|
||||
<SettingItem :title="$t('settings.select_language')">
|
||||
<Select
|
||||
ref="langsSelect"
|
||||
v-model="settings.language"
|
||||
:options="langs"
|
||||
:options="langOptions"
|
||||
w="full"
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem :title="$t('settings.startup_page')">
|
||||
<Select
|
||||
v-model="settings.startupPage"
|
||||
:options="pageOptions"
|
||||
w="full"
|
||||
/>
|
||||
</SettingItem>
|
||||
|
||||
@@ -16,7 +16,7 @@ import { AppPage, LanguageType } from '~/enums/appEnums'
|
||||
import { getUserID, hexToRGBA, smoothScrollToTop } from '~/utils/main'
|
||||
import emitter from '~/utils/mitt'
|
||||
|
||||
const activatedPage = ref<AppPage>(AppPage.Home)
|
||||
const activatedPage = ref<AppPage>(settings.value.startupPage ?? AppPage.Home)
|
||||
const { locale } = useI18n()
|
||||
const [showSettings, toggleSettings] = useToggle(false)
|
||||
// const isDark = useDark({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useStorageLocal } from '~/composables/useStorageLocal'
|
||||
import { AppPage } from '~/enums/appEnums'
|
||||
import type { Settings } from '~/models/models'
|
||||
|
||||
export const storageDemo = useStorageLocal('webext-demo', 'Storage Demo')
|
||||
@@ -6,6 +7,7 @@ export const accessKey = useStorageLocal('accessKey', '')
|
||||
|
||||
export const settings = useStorageLocal('settings', ref<Settings>({
|
||||
language: '',
|
||||
startupPage: AppPage.Home,
|
||||
isShowTopbar: true,
|
||||
dockPosition: 'right',
|
||||
enableHorizontalScrolling: false,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { AppPage } from '~/enums/appEnums'
|
||||
|
||||
export interface Settings {
|
||||
language: string
|
||||
startupPage: AppPage
|
||||
isShowTopbar: boolean
|
||||
dockPosition: 'left' | 'right' | 'bottom'
|
||||
enableHorizontalScrolling: boolean
|
||||
|
||||
Reference in New Issue
Block a user