From c04f636bbed53618c27a20191dcccf81836d5341 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 17 Oct 2025 23:09:21 +0800 Subject: [PATCH] fix: redesign settings dialog layout to prevent content overflow and visual jitter Fixed multiple layout issues in the settings dialog: 1. Dialog structure: Changed from grid to flexbox layout - Removed global padding from DialogContent - Added individual padding to DialogHeader (px-6 pt-6) and DialogFooter (px-6 pb-6 pt-4) - Added max-h-[90vh] constraint to prevent dialog from exceeding viewport 2. Content area improvements: - Replaced max-h-[70vh] with flex-1 for better space utilization - Set min-h-[480px] on content wrapper to maintain consistent dialog height - Applied min-h-[400px] to all TabsContent components to prevent height jumps 3. Scrollbar optimization: - Changed overflow-y-auto to overflow-y-scroll to force scrollbar gutter - Eliminates horizontal shift when switching between tabs with different content heights - Consistent with main app layout approach (App.tsx) 4. Footer enhancement: - Added border-t and bg-muted/20 for visual separation - Fixed footer overlapping content in advanced tab Result: Settings dialog now displays all content properly without requiring fullscreen, maintains consistent height across tabs, and eliminates layout shift when switching tabs. --- src/components/settings/SettingsDialog.tsx | 126 ++++++++++----------- src/components/ui/dialog.tsx | 6 +- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/components/settings/SettingsDialog.tsx b/src/components/settings/SettingsDialog.tsx index 540e34e..44d4dcd 100644 --- a/src/components/settings/SettingsDialog.tsx +++ b/src/components/settings/SettingsDialog.tsx @@ -171,21 +171,21 @@ export function SettingsDialog({ return ( - + {t("settings.title")} {isBusy ? ( -
+
) : ( -
+
@@ -197,65 +197,63 @@ export function SettingsDialog({ {t("common.about")} -
- - {settings ? ( - <> - updateSettings({ language: lang })} - /> - - - - ) : null} - + + {settings ? ( + <> + updateSettings({ language: lang })} + /> + + + + ) : null} + - - {settings ? ( - <> - - - - ) : null} - + + {settings ? ( + <> + + + + ) : null} + - - - -
+ + +
)} - + @@ -280,12 +278,14 @@ export function SettingsDialog({ {t("settings.restartRequired")} -

- {t("settings.restartRequiredMessage", { - defaultValue: "配置目录已变更,需要重启应用生效。", - })} -

- +
+

+ {t("settings.restartRequiredMessage", { + defaultValue: "配置目录已变更,需要重启应用生效。", + })} +

+
+ diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 8c90de3..88d2405 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -55,7 +55,7 @@ const DialogContent = React.forwardRef< ) => (
) => (