Fix: sheet scroll, direct-edit close, mobile copy btn, service badge
Four fixes: 1. Mobile edit fullscreen scroll: the Sheet primitive's data-[side=bottom]:h-auto was overriding our h-[100dvh] on SheetForm, preventing scroll. Added data-[side=bottom]:h-[100dvh] to the SheetForm className to win the specificity battle. 2. Direct-edit close showed list view: when opened via editWidgetId (the hover edit button), saving or canceling called reset() which showed the widget list instead of closing the dialog. Now derives directEdit from editWidgetId — when true, reset() calls onClose() to close entirely. 3. Copy button missing on mobile: MobileWidgetSections didn't pass onCopy to its WidgetInstanceCard instances. Now accepts and wires onCopyWidget, so referenced widgets show the copy/detach button on mobile too. 4. Service enabled badge stale: ServiceConfigEditor showed instance.enabled (the initial prop) instead of the local enabled state. Now reads the local enabled variable so the badge updates when the user toggles the switch. 128 tests pass; 0 lint errors; build clean.
This commit is contained in:
@@ -228,6 +228,9 @@ export function WidgetConfigDialog({
|
||||
|
||||
const [draft, setDraft] = useState<Draft | null>(null);
|
||||
const [draftBaseline, setDraftBaseline] = useState<Draft | null>(null);
|
||||
// When opened via editWidgetId, closing the edit should close the dialog
|
||||
// entirely (not fall back to the list view).
|
||||
const directEdit = Boolean(editWidgetId);
|
||||
|
||||
// When editWidgetId is set and the dialog opens, auto-enter edit mode for
|
||||
// that widget (instead of showing the list view).
|
||||
@@ -281,6 +284,12 @@ export function WidgetConfigDialog({
|
||||
}
|
||||
|
||||
function reset() {
|
||||
// If we were opened via direct edit, closing should close the dialog
|
||||
// entirely, not fall back to the list view.
|
||||
if (directEdit) {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
setDraft(null);
|
||||
setDraftBaseline(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user