mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-19 13:33:35 +08:00
feat: add i18n to ScheduledTasks page
Translate the scheduled tasks header, subtitle, desktop notice, and new task button that were missed in the initial i18n pass.
This commit is contained in:
parent
d23b739abd
commit
5a8fb8ad4e
@ -278,8 +278,10 @@ export const en = {
|
|||||||
'teams.members': 'members',
|
'teams.members': 'members',
|
||||||
|
|
||||||
// ─── Scheduled Tasks Pages ──────────────────────────────────────
|
// ─── Scheduled Tasks Pages ──────────────────────────────────────
|
||||||
'scheduledPage.title': 'Scheduled Tasks',
|
'scheduledPage.title': 'Scheduled tasks',
|
||||||
'scheduledPage.subtitle': 'Manage automated operational routines and background maintenance.',
|
'scheduledPage.subtitle': 'Run tasks on a schedule or whenever you need them. Type {code} in any existing session to create one.',
|
||||||
|
'scheduledPage.desktopNotice': 'Scheduled tasks only run while the desktop app is open. Make sure it stays running for tasks to fire on time.',
|
||||||
|
'scheduledPage.oldSubtitle': 'Manage automated operational routines and background maintenance.',
|
||||||
'scheduledPage.executionMode': 'Execution Mode',
|
'scheduledPage.executionMode': 'Execution Mode',
|
||||||
'scheduledPage.localMode': 'Local Mode',
|
'scheduledPage.localMode': 'Local Mode',
|
||||||
'scheduledPage.remoteMode': 'Remote Mode',
|
'scheduledPage.remoteMode': 'Remote Mode',
|
||||||
|
|||||||
@ -281,7 +281,9 @@ export const zh: Record<TranslationKey, string> = {
|
|||||||
|
|
||||||
// ─── Scheduled Tasks Pages ──────────────────────────────────────
|
// ─── Scheduled Tasks Pages ──────────────────────────────────────
|
||||||
'scheduledPage.title': '定时任务',
|
'scheduledPage.title': '定时任务',
|
||||||
'scheduledPage.subtitle': '管理自动化运维流程和后台维护任务。',
|
'scheduledPage.subtitle': '按计划或在需要时运行任务。在任意会话中输入 {code} 即可创建。',
|
||||||
|
'scheduledPage.desktopNotice': '定时任务仅在桌面应用打开时运行。请确保应用持续运行以按时触发任务。',
|
||||||
|
'scheduledPage.oldSubtitle': '管理自动化运维流程和后台维护任务。',
|
||||||
'scheduledPage.executionMode': '执行模式',
|
'scheduledPage.executionMode': '执行模式',
|
||||||
'scheduledPage.localMode': '本地模式',
|
'scheduledPage.localMode': '本地模式',
|
||||||
'scheduledPage.remoteMode': '远程模式',
|
'scheduledPage.remoteMode': '远程模式',
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTaskStore } from '../stores/taskStore'
|
import { useTaskStore } from '../stores/taskStore'
|
||||||
import { useUIStore } from '../stores/uiStore'
|
import { useUIStore } from '../stores/uiStore'
|
||||||
|
import { useTranslation } from '../i18n'
|
||||||
import { Button } from '../components/shared/Button'
|
import { Button } from '../components/shared/Button'
|
||||||
import { TaskList } from '../components/tasks/TaskList'
|
import { TaskList } from '../components/tasks/TaskList'
|
||||||
import { TaskEmptyState } from '../components/tasks/TaskEmptyState'
|
import { TaskEmptyState } from '../components/tasks/TaskEmptyState'
|
||||||
@ -9,6 +10,7 @@ import { NewTaskModal } from '../components/tasks/NewTaskModal'
|
|||||||
export function ScheduledTasks() {
|
export function ScheduledTasks() {
|
||||||
const { tasks, fetchTasks, isLoading } = useTaskStore()
|
const { tasks, fetchTasks, isLoading } = useTaskStore()
|
||||||
const { activeModal, openModal, closeModal } = useUIStore()
|
const { activeModal, openModal, closeModal } = useUIStore()
|
||||||
|
const t = useTranslation()
|
||||||
const [initialized, setInitialized] = useState(false)
|
const [initialized, setInitialized] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -21,19 +23,22 @@ export function ScheduledTasks() {
|
|||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold text-[var(--color-text-primary)]">Scheduled tasks</h1>
|
<h1 className="text-2xl font-bold text-[var(--color-text-primary)]">{t('scheduledPage.title')}</h1>
|
||||||
<p className="mt-1 text-sm text-[var(--color-text-secondary)]">
|
<p className="mt-1 text-sm text-[var(--color-text-secondary)]">
|
||||||
Run tasks on a schedule or whenever you need them. Type <code className="px-1 py-0.5 rounded bg-[var(--color-surface-container)] text-xs font-[var(--font-mono)]">/schedule</code> in any existing session to create one.
|
{(() => {
|
||||||
|
const parts = t('scheduledPage.subtitle').split('{code}')
|
||||||
|
return <>{parts[0]}<code className="px-1 py-0.5 rounded bg-[var(--color-surface-container)] text-xs font-[var(--font-mono)]">/schedule</code>{parts[1]}</>
|
||||||
|
})()}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button onClick={() => openModal('new-task')}>+ New task</Button>
|
<Button onClick={() => openModal('new-task')}>{t('tasks.newTask')}</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Desktop-online notice */}
|
{/* Desktop-online notice */}
|
||||||
<div className="flex items-center gap-2.5 px-3.5 py-2.5 rounded-[var(--radius-md)] bg-[var(--color-warning)]/8 border border-[var(--color-warning)]/15 mb-6">
|
<div className="flex items-center gap-2.5 px-3.5 py-2.5 rounded-[var(--radius-md)] bg-[var(--color-warning)]/8 border border-[var(--color-warning)]/15 mb-6">
|
||||||
<span className="material-symbols-outlined text-[18px] text-[var(--color-warning)]">schedule</span>
|
<span className="material-symbols-outlined text-[18px] text-[var(--color-warning)]">schedule</span>
|
||||||
<span className="text-xs text-[var(--color-text-secondary)]">
|
<span className="text-xs text-[var(--color-text-secondary)]">
|
||||||
Scheduled tasks only run while the desktop app is open. Make sure it stays running for tasks to fire on time.
|
{t('scheduledPage.desktopNotice')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user