Fix: dialog scroll, isDirty false positive, mobile edit btn, widget copy
Five fixes:
1. Dialog mobile scroll: DialogContent now has max-h-[calc(100dvh-2rem)]
overflow-y-auto so dialogs that don't fit on screen can scroll
instead of clipping their footer (and Cancel button) off-screen.
2. isDirty false positive: WidgetConfigDialog's SheetForm used
isDirty={draft !== null} which was true the moment you opened edit
mode, even with no changes. Now stores a draftBaseline at startEdit
time and compares JSON.stringify(draft) !== JSON.stringify(baseline).
The discard-confirmation only appears when something actually changed.
3. Mobile edit button always visible: the widget card's edit button was
opacity-0 group-hover:opacity-100 (hover-only). Changed to
md:opacity-0 md:group-hover:opacity-100 — always visible below md,
hover-reveal at md+.
4. Copy button for referenced widgets: WidgetInstanceCard gains an onCopy
prop. On the Dashboard, referenced widgets get a Copy icon button that
triggers detachRef (creates an independent clone). The edit button on
referenced widgets edits the original (shared config).
5. ConfirmDialog Cancel: fixed by #1 (the Cancel button was off-screen
on mobile dialogs that couldn't scroll).
128 tests pass; lint/build green.
This commit is contained in:
@@ -49,7 +49,14 @@ export function OverviewTab({ instance }: { instance: ServiceInstance }) {
|
||||
{visibleWidgets.length > 0 ? (
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
{visibleWidgets.map((widget) => (
|
||||
<WidgetInstanceCard key={widget.id} widget={widget} onEdit={(id) => { setEditWidgetId(id); setConfigOpen(true); }} />
|
||||
<WidgetInstanceCard
|
||||
key={widget.id}
|
||||
widget={widget}
|
||||
onEdit={(id) => {
|
||||
setEditWidgetId(id);
|
||||
setConfigOpen(true);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
@@ -72,7 +79,10 @@ export function OverviewTab({ instance }: { instance: ServiceInstance }) {
|
||||
|
||||
<WidgetConfigDialog
|
||||
open={configOpen}
|
||||
onClose={() => { setConfigOpen(false); setEditWidgetId(undefined); }}
|
||||
onClose={() => {
|
||||
setConfigOpen(false);
|
||||
setEditWidgetId(undefined);
|
||||
}}
|
||||
serviceId={instance.id}
|
||||
editWidgetId={editWidgetId}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user