Skip to content

Ux feedback 2 and some improvments#186

Open
Sobyt483 wants to merge 5 commits into
mainfrom
ux-feedback-2
Open

Ux feedback 2 and some improvments#186
Sobyt483 wants to merge 5 commits into
mainfrom
ux-feedback-2

Conversation

@Sobyt483

@Sobyt483 Sobyt483 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Addressed issue from UX feedback #183
Fix bug with resize saving #175
Fix background issues #177

Additionally fix cards flickering when user save or discard changes

Summary by CodeRabbit

  • New Features

    • Dashboard cards now preserve their saved size and layout more reliably when editing.
    • Background images are now sized more accurately, improving dashboard appearance.
    • Removing loose cards now keeps the grid layout neatly compacted.
  • Bug Fixes

    • Improved save/discard behavior in edit mode so changes persist correctly.
    • Updated dashboard editing visuals and spacing for a smoother experience.
  • Tests

    • Added coverage for card size persistence after saving and cancelling edits.

Sobyt483 added 5 commits July 1, 2026 00:01
Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
…ux-feedback-2

Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
@Sobyt483 Sobyt483 self-assigned this Jul 1, 2026
@Sobyt483 Sobyt483 requested review from a team as code owners July 1, 2026 14:23
@Sobyt483 Sobyt483 added the enhancement New feature or request label Jul 1, 2026
@Sobyt483 Sobyt483 requested a review from a team as a code owner July 1, 2026 14:23
@Sobyt483 Sobyt483 changed the title Ux feedback 2 Ux feedback 2 and some improvments Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Introduces a MountCfg type derived from CardConfig and adopts it across mount helper functions and a new computed mountCfg signal in DashboardCard. Also fixes dashboard edit-bar template/positioning, adds background-image-based sizing, adjusts save/remove card logic, and updates edit-cards-dialog markup/styling with a regression test.

Changes

Mount Configuration Type Refactor

Layer / File(s) Summary
MountCfg type definition
projects/ngx/declarative-ui/dashboard/models/dashboard.model.ts
Adds exported MountCfg type picking type, component, componentInputs from CardConfig.
DashboardCard mountCfg computed signal
projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts
Reorders imports; adds mountCfg computed signal with custom equality (JSON.stringify on componentInputs); mount effect now reads mountCfg() instead of card().
Mount helper signature updates
projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.ts, mount-sap-card.ts, mount-wc-card.ts
Changes cfg parameter type from CardConfig to MountCfg in all three mount helpers and adjusts imports.

Dashboard Edit Mode and Layout Fixes

Layer / File(s) Summary
Edit bar template and positioning fix
dashboard.component.html, dashboard.component.scss
Moves closing wrapper div before the editMode conditional; changes edit bar position from sticky to fixed; adds grid-stack placeholder and resize-cursor styling.
Background image height sizing
dashboard.component.ts
Adds backgroundImageHeight signal populated via an effect loading the background image, and a background-size host style binding.
Save and remove card logic fixes
dashboard.component.ts, dashboard.component.spec.ts
Reorders saveEdit() to compute savedCards before state updates/emit; extends removeCard() to trigger gridstack compaction for loose cards; adds regression test for save/re-edit/cancel dimension persistence.
Edit cards dialog markup and styling
edit-cards-dialog.component.html, edit-cards-dialog.component.scss
Adds data-testid and list-item container class; updates container sizing, header padding, and list-item border/spacing styles.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: gkrajniak, lpgarzonr

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and generic; it hints at UX work but doesn’t describe the specific dashboard fixes in this change. Use a concise title that names the main change, such as fixing dashboard resize persistence, background sizing, and card flicker issues.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ux-feedback-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
projects/ngx/declarative-ui/dashboard/edit-cards-dialog/edit-cards-dialog.component.scss (1)

30-32: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer a theme-aware divider color.
rgb(229, 229, 229) hard-codes the separator to one palette and won't track UI5 theme or contrast-mode changes. Please switch this to the supported theme token/selector after verifying the styling hook.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@projects/ngx/declarative-ui/dashboard/edit-cards-dialog/edit-cards-dialog.component.scss`
around lines 30 - 32, The separator color in __list-item-container is
hard-coded, so update the style to use the supported UI5 theme-aware divider
token or selector instead of the fixed rgb value. Verify the existing styling
hook in edit-cards-dialog.component.scss and adjust the nested rule for
&__list-item-container so it follows theme and contrast-mode changes.
projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts (1)

49-64: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Equality via JSON.stringify on componentInputs is fragile.

componentInputs is typed as Record<string, unknown>, so it can contain non-JSON-safe values (circular references, Date, functions returning inconsistent stringification, Map/Set). A circular reference will throw inside the equal callback, which runs during Angular's computed recomputation — this would surface as an uncaught error breaking card rendering rather than a caught, recoverable failure. JSON.stringify equality is also order-sensitive for object keys, so two logically-equal objects built with keys in different order would be treated as different.

Consider a small, safe structural-equality helper (or a well-known deep-equal utility) instead, guarded so it can't throw.

♻️ Proposed safer equality
-    {
-      equal: (a, b) =>
-        a.type === b.type &&
-        a.component === b.component &&
-        JSON.stringify(a.componentInputs) === JSON.stringify(b.componentInputs),
-    },
+    {
+      equal: (a, b) => {
+        if (a.type !== b.type || a.component !== b.component) {
+          return false;
+        }
+        try {
+          return JSON.stringify(a.componentInputs) === JSON.stringify(b.componentInputs);
+        } catch {
+          return false;
+        }
+      },
+    },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts`
around lines 49 - 64, The `mountCfg` computed in `dashboard-card.component.ts`
uses `JSON.stringify` inside the `equal` callback for `componentInputs`, which
can throw on circular or non-JSON-safe values and is order-sensitive. Replace
that comparison with a safe structural/deep-equality helper that tolerates
`Record<string, unknown>` inputs without throwing, and keep the `type` and
`component` checks in the same `mountCfg` equality logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts`:
- Around line 226-238: The background-image effect in dashboard.component.ts is
depending on the full config signal, so unrelated config reference changes are
resetting backgroundImageHeight and reloading the image. Update the effect to
react only to backgroundImageUrl changes by reading just that field (or
otherwise guarding against unchanged URLs) in the effect that uses this.config()
and sets backgroundImageHeight, so the image load and height reset only happen
when the URL actually changes.

---

Nitpick comments:
In `@projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts`:
- Around line 49-64: The `mountCfg` computed in `dashboard-card.component.ts`
uses `JSON.stringify` inside the `equal` callback for `componentInputs`, which
can throw on circular or non-JSON-safe values and is order-sensitive. Replace
that comparison with a safe structural/deep-equality helper that tolerates
`Record<string, unknown>` inputs without throwing, and keep the `type` and
`component` checks in the same `mountCfg` equality logic.

In
`@projects/ngx/declarative-ui/dashboard/edit-cards-dialog/edit-cards-dialog.component.scss`:
- Around line 30-32: The separator color in __list-item-container is hard-coded,
so update the style to use the supported UI5 theme-aware divider token or
selector instead of the fixed rgb value. Verify the existing styling hook in
edit-cards-dialog.component.scss and adjust the nested rule for
&__list-item-container so it follows theme and contrast-mode changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91512bf4-143e-4481-b727-25dcf6367807

📥 Commits

Reviewing files that changed from the base of the PR and between 511ae2c and 4096e80.

📒 Files selected for processing (11)
  • projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts
  • projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.ts
  • projects/ngx/declarative-ui/dashboard/card/utils/mount-sap-card.ts
  • projects/ngx/declarative-ui/dashboard/card/utils/mount-wc-card.ts
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.html
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.scss
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.spec.ts
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts
  • projects/ngx/declarative-ui/dashboard/edit-cards-dialog/edit-cards-dialog.component.html
  • projects/ngx/declarative-ui/dashboard/edit-cards-dialog/edit-cards-dialog.component.scss
  • projects/ngx/declarative-ui/dashboard/models/dashboard.model.ts

Comment on lines +226 to +238
effect((onCleanup) => {
const url = this.config().backgroundImageUrl;
this.backgroundImageHeight.set(null);
if (!url) return;
const img = new Image();
img.onload = () => {
this.backgroundImageHeight.set(img.naturalHeight);
};
img.src = url;
onCleanup(() => {
img.onload = null;
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Background-image effect re-triggers (and can flicker) on any config reference change, not just backgroundImageUrl changes.

The effect depends on the whole config() signal read, so any new config object reference — even one with the same backgroundImageUrl — resets backgroundImageHeight to null (temporarily falling back to background-size: auto) and reloads the image. This can reintroduce the kind of visual flicker this PR is meant to eliminate, and causes an unnecessary image reload.

♻️ Guard against unrelated config changes
+  private lastBackgroundImageUrl?: string;
+
   constructor() {
     ...
     effect((onCleanup) => {
       const url = this.config().backgroundImageUrl;
+      if (url === this.lastBackgroundImageUrl) return;
+      this.lastBackgroundImageUrl = url;
       this.backgroundImageHeight.set(null);
       if (!url) return;
       const img = new Image();
       img.onload = () => {
         this.backgroundImageHeight.set(img.naturalHeight);
       };
       img.src = url;
       onCleanup(() => {
         img.onload = null;
       });
     });
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts`
around lines 226 - 238, The background-image effect in dashboard.component.ts is
depending on the full config signal, so unrelated config reference changes are
resetting backgroundImageHeight and reloading the image. Update the effect to
react only to backgroundImageUrl changes by reading just that field (or
otherwise guarding against unchanged URLs) in the effect that uses this.config()
and sets backgroundImageHeight, so the image load and height reset only happen
when the URL actually changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Dashboard UX feedback(second round) The background gets cut in the portal while resizing to the small resolution Resize not saved

1 participant