mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 08:14:33 +08:00
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:
@@ -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) => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user