Skip to content

fix(ui): stack name above PIN in lock-codes-card chip; reduce name weight#1122

Merged
raman325 merged 2 commits intomainfrom
fix/lock-card-slot-stack
May 3, 2026
Merged

fix(ui): stack name above PIN in lock-codes-card chip; reduce name weight#1122
raman325 merged 2 commits intomainfrom
fix/lock-card-slot-stack

Conversation

@raman325
Copy link
Copy Markdown
Owner

@raman325 raman325 commented May 3, 2026

Proposed change

Per a screenshot showing slot names truncated to a single character (`Raman` → `R.`) in the lock-codes-card chip on a narrow column, splits the chip's content area into two stacked rows:

  • Top: the slot name (gets the full chip width — no more aggressive truncation for realistic names).
  • Bottom: the PIN bullets + reveal-eye icon, with `justify-content: space-between` keeping the eye right-anchored.

The chip isn't wide enough to hold both fields on one line, especially on portrait sidebars and narrow sections-grid columns.

While in there, also tones down the slot-name typography:

  • `font-weight`: 500 → 400
  • `font-size`: 15px → 14px

This intentionally diverges from the slot-card hero, which uses a prominent single-line bold name because it's the focal point of a single-slot view. In the lock-codes-card chip the name is a label — the badges (Active / Disabled / Managed) and the PIN value carry the real signal — so a lighter, smaller treatment lets six tiled chips read calmer together. Comment in the styles file calls out the deliberate divergence so future maintainers don't try to "fix" the inconsistency.

Before / after

  • Before: one row with `[name (truncated)] [PIN bullets] [eye]`. Names ellipsized at single characters.
  • After: row 1 = full-width name, row 2 = PIN bullets + eye anchored right. Lighter weight + slightly smaller name.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: n/a (visual feedback in chat)
  • This PR is related to issue: n/a

Verification: 148/148 lock-codes-card tests pass (`yarn test --run ts/lock-codes-card.{,integration.}test.ts`); `yarn build` clean; `prek` clean. Pure CSS change — no test surface impact since tests only assert on `slot-name-pending-icon` (preserved), not on the layout-level classes that were edited.

I have not opened a live HA dev server to eyeball this — please verify in your dashboard before merging. The change is small enough that the regenerated `www/generated/lock-code-manager.js` should drop in without any manual cache-bust beyond what HACS normally does.

Checklist

  • The code change is tested and works locally (unit tests + build).
  • There is no commented out code in this PR.
  • No new behavior, so no new tests required.

…ight

Long slot names were getting truncated to a single character in the
lock-codes-card slot chip because the name had to share one row with
the PIN bullets and reveal-eye icon (e.g. "Raman" → "R."). The chip
isn't wide enough — especially on portrait sidebars and narrow grid
columns — for both fields to coexist on one line.

Switch the chip's content area to a stacked layout: name on its own
line above, PIN bullets + eye on the line below. The name now gets the
full chip width, so realistic names fit without aggressive truncation.
The PIN row keeps its own justify-content rules so the eye icon stays
right-anchored.

While here, drop the slot-name from font-weight 500 → 400 and 15px →
14px. The slot card uses a prominent hero name because it's the
focal point of a single-slot view, but in the lock-codes card chip the
name is a label, not the focal point — the badges and PIN value carry
the real signal. Lighter weight and smaller size make the chip read
calmer, especially when six chips are tiled together.

Tests: all 148 lock-codes-card tests pass; the change is purely CSS
and doesn't affect any class names that tests assert on.

Entire-Checkpoint: ac70a2e54aa4
Copilot AI review requested due to automatic review settings May 3, 2026 18:01
@github-actions github-actions Bot added javascript Pull requests that update javascript code bug Something isn't working labels May 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.69%. Comparing base (7fc061c) to head (9f5a3cd).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1122   +/-   ##
=======================================
  Coverage   96.69%   96.69%           
=======================================
  Files          47       47           
  Lines        5515     5515           
  Branches      475      475           
=======================================
  Hits         5333     5333           
  Misses        182      182           
Flag Coverage Δ
typescript 95.07% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ts/lock-codes-card.styles.ts 100.00% <ø> (ø)
ts/lock-codes-card.ts 89.83% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the lock-codes card chip layout so slot names and PINs no longer compete for the same horizontal space on narrow dashboards. It updates the source stylesheet and regenerates the frontend bundle that Home Assistant serves.

Changes:

  • Stack chip content into two rows so the slot name sits above the PIN/reveal controls.
  • Reduce slot-name typography prominence in the lock-codes card chip.
  • Regenerate the shipped frontend bundle to include the stylesheet change.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
ts/lock-codes-card.styles.ts Updates chip layout and slot-name typography for the lock-codes card.
custom_components/lock_code_manager/www/generated/lock-code-manager.js Regenerated frontend bundle reflecting the stylesheet update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 193 to +196
.slot-content-row {
align-items: center;
display: flex;
gap: 12px;
justify-content: space-between;
flex-direction: column;
gap: 4px;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good catch — fixed in 9f5a3cd. Replaced the empty <span class="slot-name-row"></span> fallback with nothing so the row doesn't render at all in the unnamed-unmanaged case. The empty span was a leftover from the horizontal layout where it acted as a left-side flex placeholder; in the column layout it was producing a blank row above the PIN exactly as described.

Caught by Copilot in PR review: in the previous horizontal layout,
emitting an empty <span class="slot-name-row"></span> when showName was
false was harmless — it gave the row a left-side flex child so the PIN
stayed right-aligned consistently across named and unnamed chips.

Now that .slot-content-row stacks vertically, that empty span occupies
its own row above the PIN, leaving an extra gap above the PIN on
unnamed unmanaged chips. Replace the empty span with `nothing` so the
row simply doesn't render in that case.

showName is false only when the slot is *both* unnamed AND explicitly
unmanaged (managed === false), which is the exact case the empty
placeholder was masking.

Entire-Checkpoint: c4e657654b55
@raman325 raman325 merged commit ddda221 into main May 3, 2026
16 checks passed
@raman325 raman325 deleted the fix/lock-card-slot-stack branch May 3, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants