Skip to content

Commit e73d30a

Browse files
committed
feat(ui-rewrite): show the view icon beside the home state title
Render each non-default view's icon (brand-cyan, matching the status headline) next to its title, per the Figma mockups. A getViewIcon helper sources it from MINI_CARDS so the title and nav icons stay in sync. Signed-off-by: a-effort <anna.effort@ibm.com>
1 parent 28717f1 commit e73d30a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

client/src/components/dashboard/homeStates.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ export const MINI_CARDS: Record<MiniCardId, MiniCardMeta> = {
7878
grpc: { id: "grpc", labelId: "dashboard.home.card.grpc", view: "grpc", icon: Unplug },
7979
};
8080

81+
/**
82+
* Icon for a view's title row and mini card. Single source of truth (MINI_CARDS)
83+
* so the title icon and the nav icon can never drift. The `default` (resting)
84+
* state has no title, so no icon.
85+
*/
86+
export function getViewIcon(view: HomeViewId): ComponentType<{ className?: string }> | undefined {
87+
return view === "default" ? undefined : MINI_CARDS[view].icon;
88+
}
89+
8190
// ---------------------------------------------------------------------------
8291
// Per-state configuration
8392
// ---------------------------------------------------------------------------

client/src/pages/Dashboard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useAuth } from "@/auth/useAuth";
2222
import {
2323
HOME_STATES,
2424
getRightColumnCards,
25+
getViewIcon,
2526
readActiveView,
2627
type HomeViewId,
2728
type MiniCardId,
@@ -181,6 +182,7 @@ function NonDefaultState({
181182
const { hasPermission, permissionsLoading } = useAuth();
182183
const state = HOME_STATES[active];
183184
const rightColumnCards = getRightColumnCards(active);
185+
const TitleIcon = getViewIcon(active);
184186

185187
const gated = Boolean(state.requiredPermission);
186188
const allowed = !state.requiredPermission || hasPermission(state.requiredPermission);
@@ -189,7 +191,8 @@ function NonDefaultState({
189191
<div className="mx-auto grid max-w-5xl grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_260px]">
190192
<div className="min-w-0 space-y-4">
191193
<div className="flex items-center justify-between gap-4">
192-
<h1 className="font-heading text-lg font-medium text-foreground">
194+
<h1 className="flex items-center gap-2 font-heading text-lg font-medium text-foreground">
195+
{TitleIcon && <TitleIcon className="size-5 shrink-0 text-status-icon" />}
193196
{state.titleId ? intl.formatMessage({ id: state.titleId }) : null}
194197
</h1>
195198
<ClearControl />

0 commit comments

Comments
 (0)