Skip to content

Commit e8a914f

Browse files
Mingwwwwcursoragent
andcommitted
fix(settings): simplify About section, use i18n, hide commit details
Show only update status (up-to-date / update available) instead of raw commit messages. Use i18n keys so the section displays correctly in Chinese mode. Fix PROJECT_ROOT path for git commands. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 36e55bf commit e8a914f

1 file changed

Lines changed: 30 additions & 63 deletions

File tree

ui/src/components/settings/view/Settings.tsx

Lines changed: 30 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,14 @@ function SelectControl({
500500
}
501501

502502
function VersionUpdateSection() {
503+
const { t } = useTranslation('settings');
503504
const { info, loading, triggerUpdate, triggerRestart, fetchVersion } = useGitVersion();
504505
const [phase, setPhase] = useState<'idle' | 'updating' | 'success' | 'error'>('idle');
505-
const [logs, setLogs] = useState<string[]>([]);
506506

507507
const handleUpdate = async () => {
508508
setPhase('updating');
509-
setLogs([]);
510509
const result = await triggerUpdate();
511-
if (result.success) {
512-
setLogs(result.lines);
513-
setPhase('success');
514-
} else {
515-
setLogs(result.lines.length > 0 ? result.lines : ['Update failed']);
516-
setPhase('error');
517-
}
510+
setPhase(result.success ? 'success' : 'error');
518511
};
519512

520513
const handleRestart = async () => {
@@ -537,98 +530,72 @@ function VersionUpdateSection() {
537530
}, 2000);
538531
};
539532

540-
if (!info) return null;
533+
const statusText = !info
534+
? t('about.checking')
535+
: info.hasUpdate
536+
? t('about.updateAvailable')
537+
: t('about.upToDate');
541538

542539
return (
543-
<SettingsGroup title="About">
540+
<SettingsGroup title={t('about.title')}>
544541
<GroupedCard divided>
545542
<div className="flex min-h-[66px] items-center gap-3.5 px-5 py-3">
546543
<GitCommit className="h-4 w-4 flex-shrink-0 text-muted-foreground" />
547544
<div className="min-w-0 flex-1">
548-
<div className="text-[15px] font-semibold leading-5 text-foreground">Version</div>
549-
<div className="mt-0.5 text-xs leading-5 font-mono text-muted-foreground">
550-
{info.currentCommit} · {info.branch}
545+
<div className="text-[15px] font-semibold leading-5 text-foreground">{t('about.version')}</div>
546+
<div className="mt-0.5 text-xs leading-5 text-muted-foreground">
547+
{statusText}
551548
</div>
552549
</div>
553-
{info.hasUpdate && phase === 'idle' && (
554-
<span className="rounded-full bg-blue-100 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:bg-blue-900/40 dark:text-blue-300">
555-
{info.behindCount} update{info.behindCount > 1 ? 's' : ''}
556-
</span>
557-
)}
558-
</div>
559-
560-
{info.hasUpdate && phase === 'idle' && (
561-
<div className="px-5 py-3">
562-
{info.newCommits.length > 0 && (
563-
<ul className="mb-3 space-y-1">
564-
{info.newCommits.slice(0, 5).map((commit, i) => (
565-
<li key={i} className="truncate text-xs font-mono text-muted-foreground">
566-
{commit}
567-
</li>
568-
))}
569-
{info.newCommits.length > 5 && (
570-
<li className="text-xs text-muted-foreground">
571-
... and {info.newCommits.length - 5} more
572-
</li>
573-
)}
574-
</ul>
575-
)}
550+
{info?.hasUpdate && phase === 'idle' && (
576551
<button
577552
type="button"
578553
onClick={handleUpdate}
579554
disabled={loading}
580-
className="inline-flex items-center gap-1.5 rounded-lg bg-blue-600 px-3.5 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50 dark:bg-blue-500 dark:hover:bg-blue-600"
555+
className="inline-flex items-center gap-1.5 rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50 dark:bg-blue-500 dark:hover:bg-blue-600"
581556
>
582-
<Download className="h-3.5 w-3.5" />
583-
Update Now
557+
<Download className="h-3 w-3" />
558+
{t('about.updateNow')}
584559
</button>
585-
</div>
586-
)}
560+
)}
561+
</div>
587562

588563
{phase === 'updating' && (
589564
<div className="px-5 py-3">
590-
<div className="flex items-center gap-2 mb-2">
565+
<div className="flex items-center gap-2">
591566
<RefreshCw className="h-4 w-4 animate-spin text-blue-500" />
592-
<span className="text-sm font-medium text-foreground">Updating...</span>
593-
</div>
594-
<div className="max-h-32 overflow-y-auto rounded bg-neutral-900 p-2">
595-
{logs.map((line, i) => (
596-
<div key={i} className="text-[11px] font-mono text-neutral-300 leading-relaxed">{line}</div>
597-
))}
567+
<span className="text-sm font-medium text-foreground">{t('about.updating')}</span>
598568
</div>
599569
</div>
600570
)}
601571

602572
{phase === 'success' && (
603-
<div className="px-5 py-3 space-y-3">
604-
<div className="flex items-center gap-2">
605-
<span className="text-sm font-medium text-green-700 dark:text-green-400">Update complete!</span>
573+
<div className="flex min-h-[56px] items-center gap-3.5 px-5 py-3">
574+
<div className="min-w-0 flex-1">
575+
<span className="text-sm font-medium text-green-700 dark:text-green-400">{t('about.updateComplete')}</span>
606576
</div>
607577
<button
608578
type="button"
609579
onClick={handleRestart}
610-
className="inline-flex items-center gap-1.5 rounded-lg bg-green-600 px-3.5 py-2 text-sm font-medium text-white transition-colors hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600"
580+
className="inline-flex items-center gap-1.5 rounded-lg bg-green-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600"
611581
>
612-
<RefreshCw className="h-3.5 w-3.5" />
613-
Restart to Apply
582+
<RefreshCw className="h-3 w-3" />
583+
{t('about.restartToApply')}
614584
</button>
615585
</div>
616586
)}
617587

618588
{phase === 'error' && (
619-
<div className="px-5 py-3">
620-
<p className="text-sm font-medium text-red-700 dark:text-red-400 mb-2">Update failed</p>
621-
<div className="max-h-24 overflow-y-auto rounded bg-neutral-900 p-2">
622-
{logs.slice(-3).map((line, i) => (
623-
<div key={i} className="text-[11px] font-mono text-red-300 leading-relaxed">{line}</div>
624-
))}
589+
<div className="flex min-h-[56px] items-center gap-3.5 px-5 py-3">
590+
<div className="min-w-0 flex-1">
591+
<span className="text-sm font-medium text-red-700 dark:text-red-400">{t('about.updateFailed')}</span>
625592
</div>
626593
<button
627594
type="button"
628595
onClick={() => { setPhase('idle'); fetchVersion(); }}
629-
className="mt-2 text-xs text-muted-foreground hover:text-foreground"
596+
className="text-xs text-muted-foreground hover:text-foreground"
630597
>
631-
Dismiss
598+
{t('about.dismiss')}
632599
</button>
633600
</div>
634601
)}

0 commit comments

Comments
 (0)