switch to all zhcn
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// filepath: src/views/Settings.vue
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useSettingsStore } from '../stores/settings'
|
||||
@@ -26,13 +25,13 @@ async function browsePath() {
|
||||
|
||||
async function updateYtdlp() {
|
||||
updatingYtdlp.value = true
|
||||
updateStatus.value = 'Updating yt-dlp...'
|
||||
updateStatus.value = '正在更新 yt-dlp...'
|
||||
try {
|
||||
const res = await invoke<string>('update_ytdlp')
|
||||
updateStatus.value = res
|
||||
await settingsStore.refreshVersions()
|
||||
} catch (e: any) {
|
||||
updateStatus.value = 'yt-dlp Error: ' + e.toString()
|
||||
updateStatus.value = 'yt-dlp 错误:' + e.toString()
|
||||
} finally {
|
||||
updatingYtdlp.value = false
|
||||
}
|
||||
@@ -40,13 +39,13 @@ async function updateYtdlp() {
|
||||
|
||||
async function updateQuickjs() {
|
||||
updatingQuickjs.value = true
|
||||
updateStatus.value = 'Updating QuickJS...'
|
||||
updateStatus.value = '正在更新 QuickJS...'
|
||||
try {
|
||||
const res = await invoke<string>('update_quickjs')
|
||||
updateStatus.value = res
|
||||
await settingsStore.refreshVersions()
|
||||
} catch (e: any) {
|
||||
updateStatus.value = 'QuickJS Error: ' + e.toString()
|
||||
updateStatus.value = 'QuickJS 错误:' + e.toString()
|
||||
} finally {
|
||||
updatingQuickjs.value = false
|
||||
}
|
||||
@@ -61,31 +60,31 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
<template>
|
||||
<div class="max-w-3xl mx-auto p-8">
|
||||
<header class="mb-8">
|
||||
<h1 class="text-3xl font-bold text-zinc-900 dark:text-white">Settings</h1>
|
||||
<p class="text-gray-500 dark:text-gray-400 mt-2">Configure your download preferences.</p>
|
||||
<h1 class="text-3xl font-bold text-zinc-900 dark:text-white">设置</h1>
|
||||
<p class="text-gray-500 dark:text-gray-400 mt-2">配置您的下载偏好。</p>
|
||||
</header>
|
||||
|
||||
<div class="space-y-6">
|
||||
<!-- Download Path -->
|
||||
<section class="bg-white dark:bg-zinc-900 p-6 rounded-2xl shadow-sm border border-gray-200 dark:border-zinc-800">
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">Download Location</h2>
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">下载位置</h2>
|
||||
<div class="flex gap-3">
|
||||
<div class="flex-1 bg-gray-50 dark:bg-zinc-800 rounded-xl px-4 py-3 text-sm text-gray-600 dark:text-gray-300 font-mono truncate border border-transparent focus-within:border-blue-500 transition-colors">
|
||||
{{ settingsStore.settings.download_path || 'Not set (using defaults)' }}
|
||||
{{ settingsStore.settings.download_path || '未设置 (使用默认)' }}
|
||||
</div>
|
||||
<button
|
||||
@click="browsePath"
|
||||
class="bg-gray-100 hover:bg-gray-200 dark:bg-zinc-800 dark:hover:bg-zinc-700 text-zinc-900 dark:text-white px-4 py-3 rounded-xl font-medium transition-colors flex items-center gap-2"
|
||||
>
|
||||
<Folder class="w-5 h-5" />
|
||||
Browse
|
||||
浏览
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Theme -->
|
||||
<section class="bg-white dark:bg-zinc-900 p-6 rounded-2xl shadow-sm border border-gray-200 dark:border-zinc-800">
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">Appearance</h2>
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">外观</h2>
|
||||
<div class="grid grid-cols-3 gap-4">
|
||||
<button
|
||||
@click="setTheme('light')"
|
||||
@@ -93,7 +92,7 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
:class="settingsStore.settings.theme === 'light' ? 'border-blue-600 bg-blue-50 dark:bg-blue-900/20 text-blue-600' : 'border-transparent bg-gray-50 dark:bg-zinc-800 text-gray-500 hover:bg-gray-100 dark:hover:bg-zinc-700'"
|
||||
>
|
||||
<Sun class="w-6 h-6" />
|
||||
<span class="font-medium">Light</span>
|
||||
<span class="font-medium">浅色</span>
|
||||
</button>
|
||||
<button
|
||||
@click="setTheme('dark')"
|
||||
@@ -101,7 +100,7 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
:class="settingsStore.settings.theme === 'dark' ? 'border-blue-600 bg-blue-50 dark:bg-blue-900/20 text-blue-600' : 'border-transparent bg-gray-50 dark:bg-zinc-800 text-gray-500 hover:bg-gray-100 dark:hover:bg-zinc-700'"
|
||||
>
|
||||
<Moon class="w-6 h-6" />
|
||||
<span class="font-medium">Dark</span>
|
||||
<span class="font-medium">深色</span>
|
||||
</button>
|
||||
<button
|
||||
@click="setTheme('system')"
|
||||
@@ -109,14 +108,14 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
:class="settingsStore.settings.theme === 'system' ? 'border-blue-600 bg-blue-50 dark:bg-blue-900/20 text-blue-600' : 'border-transparent bg-gray-50 dark:bg-zinc-800 text-gray-500 hover:bg-gray-100 dark:hover:bg-zinc-700'"
|
||||
>
|
||||
<Monitor class="w-6 h-6" />
|
||||
<span class="font-medium">System</span>
|
||||
<span class="font-medium">跟随系统</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Binary Management -->
|
||||
<section class="bg-white dark:bg-zinc-900 p-6 rounded-2xl shadow-sm border border-gray-200 dark:border-zinc-800">
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">External Binaries</h2>
|
||||
<h2 class="text-lg font-bold mb-4 text-zinc-900 dark:text-white">外部二进制文件</h2>
|
||||
|
||||
<div class="space-y-4">
|
||||
<!-- yt-dlp -->
|
||||
@@ -136,7 +135,7 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
class="text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 px-4 py-2 rounded-lg transition-colors text-sm font-medium flex items-center gap-2 disabled:opacity-50"
|
||||
>
|
||||
<RefreshCw class="w-4 h-4" :class="{ 'animate-spin': updatingYtdlp }" />
|
||||
Update
|
||||
更新
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -157,7 +156,7 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
class="text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 px-4 py-2 rounded-lg transition-colors text-sm font-medium flex items-center gap-2 disabled:opacity-50"
|
||||
>
|
||||
<RefreshCw class="w-4 h-4" :class="{ 'animate-spin': updatingQuickjs }" />
|
||||
Update
|
||||
更新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -165,7 +164,7 @@ function setTheme(theme: 'light' | 'dark' | 'system') {
|
||||
<div v-if="updateStatus" class="mt-4 p-3 bg-gray-50 dark:bg-zinc-800 rounded-lg text-xs font-mono text-gray-600 dark:text-gray-400 whitespace-pre-wrap border border-gray-200 dark:border-zinc-700">
|
||||
{{ updateStatus }}
|
||||
</div>
|
||||
<p class="text-xs text-gray-400 mt-4 text-right">Last Checked: {{ settingsStore.settings.last_updated ? new Date(settingsStore.settings.last_updated).toLocaleString() : 'Never' }}</p>
|
||||
<p class="text-xs text-gray-400 mt-4 text-right">上次检查: {{ settingsStore.settings.last_updated ? new Date(settingsStore.settings.last_updated).toLocaleString() : '从未' }}</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user