fix(ui): keep dashboard configuration exit available and align heading help
Verified with the coordinated workspace changes by devkit full run 2026-09-08T225814-186389-0000-3e3ed7cd (all seven phases passed). This shared UI pass does not mark the individual module reviews complete.
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
type DragEvent as ReactDragEvent
|
||||
} from "react";
|
||||
import {
|
||||
RefreshCw,
|
||||
Save,
|
||||
SlidersHorizontal,
|
||||
X
|
||||
@@ -24,6 +23,7 @@ import {
|
||||
isApiError,
|
||||
useEffectiveView,
|
||||
usePlatformModules,
|
||||
useUnsavedChanges,
|
||||
useUnsavedDraftGuard,
|
||||
type ApiSettings,
|
||||
type AuthInfo,
|
||||
@@ -185,6 +185,7 @@ export default function DashboardPage({
|
||||
]);
|
||||
|
||||
const dirty = configuring && !layoutsEqual(savedLayout, draftLayout);
|
||||
const { requestDiscard } = useUnsavedChanges();
|
||||
useUnsavedDraftGuard({
|
||||
dirty,
|
||||
onSave: persistLayout,
|
||||
@@ -253,12 +254,21 @@ export default function DashboardPage({
|
||||
|
||||
function discardChanges() {
|
||||
setDraftLayout(savedLayout);
|
||||
exitConfiguration();
|
||||
}
|
||||
|
||||
function exitConfiguration() {
|
||||
setConfiguring(false);
|
||||
setEditingInstanceId(null);
|
||||
setDragItem(null);
|
||||
setDropTarget(null);
|
||||
}
|
||||
|
||||
function cancelConfiguration() {
|
||||
if (dirty) requestDiscard(exitConfiguration);
|
||||
else exitConfiguration();
|
||||
}
|
||||
|
||||
function beginConfiguration() {
|
||||
setDraftLayout(savedLayout);
|
||||
setConfiguring(true);
|
||||
@@ -447,6 +457,7 @@ export default function DashboardPage({
|
||||
archetype={configuring ? "editor" : "overview"}
|
||||
className="dashboard-page"
|
||||
title="i18n:govoplan-dashboard.dashboard.3f8b4df2"
|
||||
titleHelp={<DocumentationHelpLink reference={DASHBOARD_DOCUMENTATION} />}
|
||||
description="Personal workspace assembled from installed module widgets."
|
||||
error={error}
|
||||
success={error ? "" : notice}
|
||||
@@ -454,8 +465,7 @@ export default function DashboardPage({
|
||||
<PageActionBar
|
||||
variant="editor"
|
||||
state={saving ? "saving" : dirty ? "dirty" : "clean"}
|
||||
helpAction={<DocumentationHelpLink reference={DASHBOARD_DOCUMENTATION} />}
|
||||
discardAction={{ label: <><X size={16} /> Cancel</>, onClick: discardChanges }}
|
||||
discardAction={{ label: <><X size={16} /> Cancel</>, behavior: "exit", onClick: cancelConfiguration }}
|
||||
saveAction={{ label: <><Save size={16} /> Save layout</>, onClick: () => void persistLayout() }}
|
||||
/>
|
||||
) : (
|
||||
@@ -467,7 +477,6 @@ export default function DashboardPage({
|
||||
loading,
|
||||
disabledReason: loading ? DASHBOARD_I18N.loading : undefined
|
||||
}}
|
||||
helpAction={<DocumentationHelpLink reference={DASHBOARD_DOCUMENTATION} />}
|
||||
primaryActions={(
|
||||
<Button
|
||||
onClick={beginConfiguration}
|
||||
|
||||
Reference in New Issue
Block a user