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:
2 files changed
+19
-7
No files matched your search
@@ -92,8 +92,11 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
<DialogContent className="max-w-xl">
|
<DialogContent
|
||||||
<DialogHeader>
|
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 items-center gap-3">
|
||||||
<div className="flex size-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary">
|
<div className="flex size-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary">
|
||||||
<Icon className="size-5" />
|
<Icon className="size-5" />
|
||||||
@@ -105,6 +108,7 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
|
|||||||
</div>
|
</div>
|
||||||
</DialogHeader>
|
</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">
|
<div className="flex flex-col gap-5">
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, y: 8 }}
|
initial={{ opacity: 0, y: 8 }}
|
||||||
@@ -183,12 +187,14 @@ export function NodeEditDialog<K extends NetworkKind>(props: NodeEditDialogProps
|
|||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter className="flex-row justify-end border-t border-border/60 bg-card px-4 py-3 sm:px-6 sm:py-4">
|
||||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
<Button className="flex-1 sm:flex-none" variant="outline" onClick={() => onOpenChange(false)}>
|
||||||
取消
|
取消
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
className="flex-1 sm:flex-none"
|
||||||
disabled={!canSave}
|
disabled={!canSave}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const cleaned = { ...draft, name: trimmedName } as AnyAdapter<K>;
|
const cleaned = { ...draft, name: trimmedName } as AnyAdapter<K>;
|
||||||
|
|||||||
@@ -26,8 +26,11 @@ DialogOverlay.displayName = 'DialogOverlay';
|
|||||||
|
|
||||||
const DialogContent = React.forwardRef<
|
const DialogContent = React.forwardRef<
|
||||||
React.ElementRef<typeof DialogPrimitive.Content>,
|
React.ElementRef<typeof DialogPrimitive.Content>,
|
||||||
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { showClose?: boolean }
|
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
|
||||||
>(({ className, children, showClose = true, ...props }, ref) => (
|
showClose?: boolean;
|
||||||
|
viewportClassName?: string;
|
||||||
|
}
|
||||||
|
>(({ className, children, showClose = true, viewportClassName, ...props }, ref) => (
|
||||||
<DialogPortal>
|
<DialogPortal>
|
||||||
<DialogOverlay />
|
<DialogOverlay />
|
||||||
<DialogPrimitive.Content
|
<DialogPrimitive.Content
|
||||||
@@ -44,7 +47,10 @@ const DialogContent = React.forwardRef<
|
|||||||
)}
|
)}
|
||||||
{...props}
|
{...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}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
{showClose && (
|
{showClose && (
|
||||||
|
|||||||
Reference in new issue
Block a user