Skip to content

Commit 643d2fe

Browse files
committed
frontend: ClusterBadge: remove default icon, clusters appearance defaults to no icon
1 parent 6739344 commit 643d2fe

13 files changed

+72
-186
lines changed

frontend/src/components/App/Home/__snapshots__/index.Base.stories.storyshot

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,8 @@
618618
href="/c/cluster0/"
619619
>
620620
<div
621-
class="MuiBox-root css-1or8la4"
621+
class="MuiBox-root css-172hjuw"
622622
>
623-
<div
624-
class="MuiBox-root css-iyhyxy"
625-
/>
626623
<span
627624
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
628625
>
@@ -729,11 +726,8 @@
729726
href="/c/cluster1/"
730727
>
731728
<div
732-
class="MuiBox-root css-1or8la4"
729+
class="MuiBox-root css-172hjuw"
733730
>
734-
<div
735-
class="MuiBox-root css-iyhyxy"
736-
/>
737731
<span
738732
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
739733
>
@@ -840,11 +834,8 @@
840834
href="/c/cluster2/"
841835
>
842836
<div
843-
class="MuiBox-root css-1or8la4"
837+
class="MuiBox-root css-172hjuw"
844838
>
845-
<div
846-
class="MuiBox-root css-iyhyxy"
847-
/>
848839
<span
849840
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
850841
>

frontend/src/components/App/__snapshots__/TopBar.TwoCluster.stories.storyshot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,8 @@
125125
type="button"
126126
>
127127
<div
128-
class="MuiBox-root css-1or8la4"
128+
class="MuiBox-root css-172hjuw"
129129
>
130-
<div
131-
class="MuiBox-root css-iyhyxy"
132-
/>
133130
<span
134131
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
135132
>

frontend/src/components/Sidebar/ClusterBadge.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ describe('ClusterBadge', () => {
5050
expect(container).toBeInTheDocument();
5151
});
5252

53-
it('renders with default icon when no icon provided', () => {
54-
const { container } = render(
53+
it('renders no icon when no icon provided', () => {
54+
render(
5555
<TestContext>
5656
<ClusterBadge name="test-cluster" />
5757
</TestContext>
5858
);
5959

60-
expect(container).toBeInTheDocument();
60+
// Should not render the icon element
61+
expect(screen.queryByTestId('cluster-badge-icon')).toBeNull();
62+
// Still renders the cluster name
63+
expect(screen.getByText('test-cluster')).toBeInTheDocument();
6164
});
6265

6366
it('renders with all props', () => {

frontend/src/components/Sidebar/ClusterBadge.tsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export interface ClusterBadgeProps {
3535
*/
3636
export default function ClusterBadge({ name, accentColor, icon }: ClusterBadgeProps) {
3737
const theme = useTheme();
38-
const defaultIcon = 'mdi:hexagon-multiple-outline';
39-
4038
const iconColor = theme.palette.primary.main;
4139
const backgroundColor = theme.palette.secondary.main;
4240

@@ -46,25 +44,32 @@ export default function ClusterBadge({ name, accentColor, icon }: ClusterBadgePr
4644
display: 'flex',
4745
alignItems: 'center',
4846
gap: 0.75,
49-
paddingY: 0.5,
5047
}}
5148
>
52-
{/* Colored circle with icon */}
53-
<Box
54-
sx={{
55-
display: 'flex',
56-
alignItems: 'center',
57-
justifyContent: 'center',
58-
width: 28,
59-
height: 28,
60-
borderRadius: '50%',
61-
backgroundColor,
62-
border: `2px solid ${accentColor}`,
63-
flexShrink: 0,
64-
}}
65-
>
66-
<Icon icon={icon || defaultIcon} color={iconColor} width={20} height={20} />
67-
</Box>
49+
{/* Colored circle with icon, only if icon is provided */}
50+
{icon && (
51+
<Box
52+
sx={{
53+
display: 'flex',
54+
alignItems: 'center',
55+
justifyContent: 'center',
56+
width: 28,
57+
height: 28,
58+
borderRadius: '50%',
59+
backgroundColor,
60+
border: `2px solid ${accentColor}`,
61+
flexShrink: 0,
62+
}}
63+
>
64+
<Icon
65+
icon={icon}
66+
color={iconColor}
67+
width={20}
68+
height={20}
69+
data-testid="cluster-badge-icon"
70+
/>
71+
</Box>
72+
)}
6873

6974
{/* Cluster name */}
7075
<Typography

frontend/src/components/cluster/__snapshots__/ClusterChooser.LongClusterName.stories.storyshot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
type="button"
77
>
88
<div
9-
class="MuiBox-root css-1or8la4"
9+
class="MuiBox-root css-172hjuw"
1010
>
11-
<div
12-
class="MuiBox-root css-iyhyxy"
13-
/>
1411
<span
1512
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
1613
>

frontend/src/components/cluster/__snapshots__/ClusterChooser.NoCluster.stories.storyshot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
type="button"
77
>
88
<div
9-
class="MuiBox-root css-1or8la4"
9+
class="MuiBox-root css-172hjuw"
1010
>
11-
<div
12-
class="MuiBox-root css-iyhyxy"
13-
/>
1411
<span
1512
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
1613
>

frontend/src/components/cluster/__snapshots__/ClusterChooser.Normal.stories.storyshot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
type="button"
77
>
88
<div
9-
class="MuiBox-root css-1or8la4"
9+
class="MuiBox-root css-172hjuw"
1010
>
11-
<div
12-
class="MuiBox-root css-iyhyxy"
13-
/>
1411
<span
1512
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
1613
>

frontend/src/components/cluster/__snapshots__/ClusterChooser.SpecialCharacters.stories.storyshot

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
type="button"
77
>
88
<div
9-
class="MuiBox-root css-1or8la4"
9+
class="MuiBox-root css-172hjuw"
1010
>
11-
<div
12-
class="MuiBox-root css-iyhyxy"
13-
/>
1411
<span
1512
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
1613
>

frontend/src/components/cluster/__snapshots__/ClusterChooserPopup.NoClustersButRecent.stories.storyshot

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@
7878
tabindex="-1"
7979
>
8080
<div
81-
class="MuiBox-root css-1or8la4"
81+
class="MuiBox-root css-172hjuw"
8282
>
83-
<div
84-
class="MuiBox-root css-iyhyxy"
85-
/>
8683
<span
8784
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
8885
>
@@ -109,11 +106,8 @@
109106
tabindex="-1"
110107
>
111108
<div
112-
class="MuiBox-root css-1or8la4"
109+
class="MuiBox-root css-172hjuw"
113110
>
114-
<div
115-
class="MuiBox-root css-iyhyxy"
116-
/>
117111
<span
118112
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
119113
>
@@ -131,11 +125,8 @@
131125
tabindex="-1"
132126
>
133127
<div
134-
class="MuiBox-root css-1or8la4"
128+
class="MuiBox-root css-172hjuw"
135129
>
136-
<div
137-
class="MuiBox-root css-iyhyxy"
138-
/>
139130
<span
140131
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
141132
>

frontend/src/components/cluster/__snapshots__/ClusterChooserPopup.NoRecentClusters.stories.storyshot

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@
7878
tabindex="-1"
7979
>
8080
<div
81-
class="MuiBox-root css-1or8la4"
81+
class="MuiBox-root css-172hjuw"
8282
>
83-
<div
84-
class="MuiBox-root css-iyhyxy"
85-
/>
8683
<span
8784
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
8885
>
@@ -109,11 +106,8 @@
109106
tabindex="-1"
110107
>
111108
<div
112-
class="MuiBox-root css-1or8la4"
109+
class="MuiBox-root css-172hjuw"
113110
>
114-
<div
115-
class="MuiBox-root css-iyhyxy"
116-
/>
117111
<span
118112
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
119113
>
@@ -131,11 +125,8 @@
131125
tabindex="-1"
132126
>
133127
<div
134-
class="MuiBox-root css-1or8la4"
128+
class="MuiBox-root css-172hjuw"
135129
>
136-
<div
137-
class="MuiBox-root css-iyhyxy"
138-
/>
139130
<span
140131
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
141132
>
@@ -153,11 +144,8 @@
153144
tabindex="-1"
154145
>
155146
<div
156-
class="MuiBox-root css-1or8la4"
147+
class="MuiBox-root css-172hjuw"
157148
>
158-
<div
159-
class="MuiBox-root css-iyhyxy"
160-
/>
161149
<span
162150
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
163151
>
@@ -175,11 +163,8 @@
175163
tabindex="-1"
176164
>
177165
<div
178-
class="MuiBox-root css-1or8la4"
166+
class="MuiBox-root css-172hjuw"
179167
>
180-
<div
181-
class="MuiBox-root css-iyhyxy"
182-
/>
183168
<span
184169
class="MuiTypography-root MuiTypography-caption css-chqac-MuiTypography-root"
185170
>

0 commit comments

Comments
 (0)