refactor: unify modal overlay system with shadcn/ui Dialog
Fix inconsistent modal overlays by migrating all custom implementations to the unified shadcn/ui Dialog component with proper z-index layering. Changes: - Update Dialog component to support three z-index levels: - base (z-40): First-level dialogs - nested (z-50): Nested dialogs - alert (z-[60]): Alert/confirmation dialogs (using Tailwind arbitrary value) - Refactor all custom modal implementations to use Dialog: - EndpointSpeedTest: API endpoint speed testing panel - ClaudeConfigEditor: Claude common config editor - CodexQuickWizardModal: Codex quick setup wizard - CodexCommonConfigModal: Codex common config editor - SettingsDialog: Restart confirmation prompt - Remove custom backdrop implementations and manual z-index - Leverage Radix UI Portal for automatic DOM order management - Ensure consistent overlay behavior and keyboard interactions This eliminates the "background residue" issue where overlays from different layers would conflict, providing a unified and professional user experience across all modal interactions.
This commit is contained in:
@@ -275,31 +275,26 @@ export function SettingsDialog({
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
{showRestartPrompt ? (
|
||||
<div className="fixed inset-0 z-[60] flex items-center justify-center">
|
||||
<div className="absolute inset-0 bg-background/80 backdrop-blur-sm" />
|
||||
<div className="relative z-10 w-full max-w-md space-y-4 rounded-lg border border-border bg-background p-6 shadow-xl">
|
||||
<div className="space-y-1">
|
||||
<h2 className="text-lg font-semibold">
|
||||
{t("settings.restartRequired")}
|
||||
</h2>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("settings.restartRequiredMessage", {
|
||||
defaultValue: "配置目录已变更,需要重启应用生效。",
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={handleRestartLater}>
|
||||
{t("settings.restartLater")}
|
||||
</Button>
|
||||
<Button onClick={handleRestartNow}>
|
||||
{t("settings.restartNow")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<Dialog open={showRestartPrompt} onOpenChange={(open) => !open && handleRestartLater()}>
|
||||
<DialogContent zIndex="alert" className="max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{t("settings.restartRequired")}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("settings.restartRequiredMessage", {
|
||||
defaultValue: "配置目录已变更,需要重启应用生效。",
|
||||
})}
|
||||
</p>
|
||||
<DialogFooter className="gap-2">
|
||||
<Button variant="outline" onClick={handleRestartLater}>
|
||||
{t("settings.restartLater")}
|
||||
</Button>
|
||||
<Button onClick={handleRestartNow}>
|
||||
{t("settings.restartNow")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user