fix(settings): navigate to About tab when clicking update badge

- Add defaultTab prop to SettingsPage for external tab control
- UpdateBadge click now opens settings directly to About tab
- Settings button still opens to General tab (default behavior)
- Change update badge text from version number to "Update available"
This commit is contained in:
Jason
2026-01-06 11:27:32 +08:00
Unverified
parent 0020889a8f
commit 2c4c2ce83d
6 changed files with 18 additions and 5 deletions
+10 -2
View File
@@ -70,6 +70,7 @@ function App() {
const [activeApp, setActiveApp] = useState<AppId>("claude");
const [currentView, setCurrentView] = useState<View>("providers");
const [settingsDefaultTab, setSettingsDefaultTab] = useState("general");
const [isAddOpen, setIsAddOpen] = useState(false);
const [editingProvider, setEditingProvider] = useState<Provider | null>(null);
@@ -411,6 +412,7 @@ function App() {
open={true}
onOpenChange={() => setCurrentView("providers")}
onImportSuccess={handleImportSuccess}
defaultTab={settingsDefaultTab}
/>
);
case "prompts":
@@ -610,14 +612,20 @@ function App() {
<Button
variant="ghost"
size="icon"
onClick={() => setCurrentView("settings")}
onClick={() => {
setSettingsDefaultTab("general");
setCurrentView("settings");
}}
title={t("common.settings")}
className="hover:bg-black/5 dark:hover:bg-white/5"
>
<Settings className="w-4 h-4" />
</Button>
</div>
<UpdateBadge onClick={() => setCurrentView("settings")} />
<UpdateBadge onClick={() => {
setSettingsDefaultTab("about");
setCurrentView("settings");
}} />
</>
)}
</div>
+1 -1
View File
@@ -41,7 +41,7 @@ export function UpdateBadge({ className = "", onClick }: UpdateBadgeProps) {
>
<Download className="w-3 h-3 text-blue-500 dark:text-blue-400" />
<span className="text-gray-700 dark:text-gray-300 font-medium">
v{updateInfo.availableVersion}
{t("settings.updateBadge")}
</span>
<button
onClick={(e) => {
+4 -2
View File
@@ -52,12 +52,14 @@ interface SettingsDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
onImportSuccess?: () => void | Promise<void>;
defaultTab?: string;
}
export function SettingsPage({
open,
onOpenChange,
onImportSuccess,
defaultTab = "general",
}: SettingsDialogProps) {
const { t } = useTranslation();
const {
@@ -98,10 +100,10 @@ export function SettingsPage({
useEffect(() => {
if (open) {
setActiveTab("general");
setActiveTab(defaultTab);
resetStatus();
}
}, [open, resetStatus]);
}, [open, resetStatus, defaultTab]);
useEffect(() => {
if (requiresRestart) {
+1
View File
@@ -251,6 +251,7 @@
"aboutHint": "View version information and update status.",
"portableMode": "Portable mode: updates require manual download.",
"updateAvailable": "New version available: {{version}}",
"updateBadge": "Update available",
"updateFailed": "Update installation failed, attempted to open download page.",
"checkUpdateFailed": "Failed to check for updates, please try again later.",
"openReleaseNotesFailed": "Failed to open release notes",
+1
View File
@@ -251,6 +251,7 @@
"aboutHint": "バージョン情報と更新状況を表示します。",
"portableMode": "ポータブルモード: 更新は手動ダウンロードが必要です。",
"updateAvailable": "新しいバージョンがあります: {{version}}",
"updateBadge": "更新あり",
"updateFailed": "更新のインストールに失敗しました。ダウンロードページを開こうとしました。",
"checkUpdateFailed": "更新の確認に失敗しました。時間をおいて再試行してください。",
"openReleaseNotesFailed": "リリースノートの表示に失敗しました",
+1
View File
@@ -251,6 +251,7 @@
"aboutHint": "查看版本信息与更新状态。",
"portableMode": "当前为便携版,更新需手动下载。",
"updateAvailable": "检测到新版本:{{version}}",
"updateBadge": "有更新可用",
"updateFailed": "更新安装失败,已尝试打开下载页面。",
"checkUpdateFailed": "检查更新失败,请稍后重试。",
"openReleaseNotesFailed": "打开更新日志失败",