Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-10604.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- hub dashboard: NPS section header matches sibling section styling (#10604)
1 change: 1 addition & 0 deletions src/changelog.d/fixed-hub-nps-header-size-10600.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed the hub admin NPS feedback header so it matched sibling section sizing and summary weight. (#10600)
22 changes: 11 additions & 11 deletions src/pkg/hub/assets/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,12 @@
}
.admin-collapsible-section { margin-top: 48px; }
.admin-collapsible-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-6); }
.admin-collapsible-title { color: var(--hub-dashboard-accent); margin: var(--sp-0); cursor: pointer; user-select: none; display: flex; align-items: center; gap: var(--sp-4); }
.admin-collapsible-title { font-size: 1.3rem; color: var(--hub-dashboard-accent); margin: var(--sp-0); cursor: pointer; user-select: none; display: flex; align-items: center; gap: var(--sp-4); }
.admin-collapsible-toggle { font-size: 0.7rem; }
.admin-collapsible-summary { font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }
/* NPS feedback card (#9610). Admin-only; every value is set with
textContent, so this block only lays out plain text nodes. Tokens only,
per the style ratchet. */
.nps-admin-title { font-size: var(--fs-md); color: var(--hub-dashboard-accent); font-weight: 600; margin-bottom: var(--sp-4); }
.nps-admin-summary { font-size: var(--fs-sm); color: var(--text); margin-bottom: var(--sp-2); }
.nps-admin-sub { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-4) 0 var(--sp-2); text-transform: uppercase; letter-spacing: 0.04em; }
.nps-admin-row { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-2); font-size: var(--fs-xs); }
Expand Down Expand Up @@ -639,8 +640,8 @@ <h2 style="font-size:1.3rem;color:var(--hub-dashboard-accent);margin-bottom:var(
<div class="admin-collapsible-head">
<h2 id="nps-header" class="admin-collapsible-title" role="button" tabindex="0" aria-expanded="false" aria-controls="nps-body"
onclick="toggleAdminNPSSection()" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleAdminNPSSection();}">
<span id="nps-toggle" aria-hidden="true">&#9656;</span><span>Hub Admin &mdash; NPS feedback</span>
<span id="nps-summary" class="fs-sm text-muted"></span>
<span id="nps-toggle" class="admin-collapsible-toggle" aria-hidden="true">&#9656;</span><span>Hub Admin &mdash; NPS feedback</span>
<span id="nps-summary" class="admin-collapsible-summary"></span>
</h2>
</div>
<div id="nps-body" hidden>
Expand All @@ -653,13 +654,12 @@ <h2 style="font-size:1.3rem;color:var(--hub-dashboard-accent);margin-bottom:var(
</div>
</div>

<div id="admin-section" style="display:none;margin-top:48px">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--sp-6)">
<h2 id="admin-users-header" role="button" tabindex="0" aria-expanded="false" aria-controls="admin-users-body"
onclick="toggleAdminUsers()" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleAdminUsers();}"
style="font-size:1.3rem;color:var(--hub-dashboard-accent);margin:var(--sp-0);cursor:pointer;user-select:none;display:flex;align-items:center;gap:var(--sp-4)">
<span id="admin-users-toggle" aria-hidden="true" style="font-size:0.7rem">&#9656;</span><span>Hub Admin &mdash; Users</span>
<span id="admin-users-count" style="font-size:var(--fs-sm);color:var(--muted);font-weight:400"></span>
<div id="admin-section" class="admin-collapsible-section" style="display:none">
<div class="admin-collapsible-head">
<h2 id="admin-users-header" class="admin-collapsible-title" role="button" tabindex="0" aria-expanded="false" aria-controls="admin-users-body"
onclick="toggleAdminUsers()" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleAdminUsers();}">
<span id="admin-users-toggle" class="admin-collapsible-toggle" aria-hidden="true">&#9656;</span><span>Hub Admin &mdash; Users</span>
<span id="admin-users-count" class="admin-collapsible-summary"></span>
</h2>
<input type="text" id="user-search" placeholder="Search users..." oninput="filterUsers()" style="padding:8px 14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);color:var(--text);font-size:0.85rem;width:250px">
</div>
Expand Down
45 changes: 45 additions & 0 deletions src/pkg/hub/nps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,51 @@ func TestNPSAdminSectionPrecedesUsersAndIsSeparate(t *testing.T) {
if npsContainerAt > usersBodyAt && npsContainerAt < usersEndAt {
t.Fatalf("nps-container must not be inside the Users section (nps=%d usersBody=%d usersEnd=%d)", npsContainerAt, usersBodyAt, usersEndAt)
}

npsTag, npsClass := dashboardElementTagAndClass(t, html, "nps-header")
usersTag, usersClass := dashboardElementTagAndClass(t, html, "admin-users-header")
if npsTag != usersTag || npsClass != usersClass {
t.Fatalf("NPS header must match Users header structure: NPS <%s class=%q>, Users <%s class=%q>", npsTag, npsClass, usersTag, usersClass)
}

_, npsSummaryClass := dashboardElementTagAndClass(t, html, "nps-summary")
_, usersSummaryClass := dashboardElementTagAndClass(t, html, "admin-users-count")
if npsSummaryClass != usersSummaryClass {
t.Fatalf("NPS summary class = %q, Users summary class = %q", npsSummaryClass, usersSummaryClass)
}
}

func dashboardElementTagAndClass(t *testing.T, html, id string) (string, string) {
t.Helper()
idAt := strings.Index(html, `id="`+id+`"`)
if idAt < 0 {
t.Fatalf("dashboardHTML is missing element id %q", id)
}
start := strings.LastIndex(html[:idAt], "<")
end := strings.Index(html[idAt:], ">")
if start < 0 || end < 0 {
t.Fatalf("could not extract opening tag for element id %q", id)
}
open := html[start : idAt+end+1]
tagEnd := strings.IndexAny(open[1:], " \t\n>")
if tagEnd < 0 {
t.Fatalf("could not extract tag name for element id %q", id)
}
return open[1 : 1+tagEnd], dashboardAttr(open, "class")
}

func dashboardAttr(openTag, name string) string {
needle := name + `="`
start := strings.Index(openTag, needle)
if start < 0 {
return ""
}
start += len(needle)
end := strings.Index(openTag[start:], `"`)
if end < 0 {
return ""
}
return openTag[start : start+end]
}

// npsHubJSFunc extracts a top-level `function name(` from the hub dashboard.
Expand Down
Loading