fix(webui): keep node dialog actions visible

Separate the node editor into fixed header and footer rows with an independently scrollable form body, so short viewports cannot push the save action out of reach.
This commit is contained in:
DrSmoothl committed 2026-07-22 00:02:48 +08:00
1 parent 622c90d418
commit 7fb8aa1d42
2 files changed
+19 -7

No files matched your search

@@ -92,8 +92,11 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="max-w-xl">
<DialogHeader>
<DialogContent
className="max-w-xl"
viewportClassName="grid max-h-[calc(100dvh_-_2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0"
>
<DialogHeader className="px-4 pb-4 pr-14 pt-5 sm:px-6 sm:pr-16 sm:pt-6">
<div className="flex items-center gap-3">
<div className="flex size-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary">
<Icon className="size-5" />
@@ -105,6 +108,7 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
</div>
</DialogHeader>
<div className="min-h-0 overflow-y-auto overscroll-contain px-4 pb-5 sm:px-6">
<div className="flex flex-col gap-5">
<motion.div
initial={{ opacity: 0, y: 8 }}
@@ -183,12 +187,14 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
</div>
</Section>
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={() => onOpenChange(false)}>
<DialogFooter className="flex-row justify-end border-t border-border/60 bg-card px-4 py-3 sm:px-6 sm:py-4">
<Button className="flex-1 sm:flex-none" variant="outline" onClick={() => onOpenChange(false)}>
取消
</Button>
<Button
className="flex-1 sm:flex-none"
disabled={!canSave}
onClick={() => {
const cleaned = { ...draft, name: trimmedName } as AnyAdapter<K>;
+9 -3
View File
@@ -26,8 +26,11 @@ DialogOverlay.displayName = 'DialogOverlay';
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { showClose?: boolean }
>(({ className, children, showClose = true, ...props }, ref) => (
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
showClose?: boolean;
viewportClassName?: string;
}
>(({ className, children, showClose = true, viewportClassName, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
@@ -44,7 +47,10 @@ const DialogContent = React.forwardRef<
)}
{...props}
>
<div className="grid max-h-[calc(100dvh_-_2rem)] gap-4 overflow-y-auto overscroll-contain p-6">
<div className={cn(
'grid max-h-[calc(100dvh_-_2rem)] gap-4 overflow-y-auto overscroll-contain p-6',
viewportClassName,
)}>
{children}
</div>
{showClose && (