Skip to content

Commit b217f2c

Browse files
refactor: Refactor resources colors and avatars (#4751)
1 parent 3c5e292 commit b217f2c

File tree

5 files changed

+47
-32
lines changed

5 files changed

+47
-32
lines changed

site/src/components/BuildsTable/BuildAvatar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ const StyledBadge = withStyles((theme) => ({
2727

2828
const StyledAvatar = withStyles((theme) => ({
2929
root: {
30-
background: theme.palette.background.paperLight,
30+
background: theme.palette.divider,
3131
color: theme.palette.text.primary,
3232
border: `2px solid ${theme.palette.divider}`,
3333

3434
"& svg": {
35-
width: 24,
36-
height: 24,
35+
width: 18,
36+
height: 18,
3737
},
3838
},
3939
}))(Avatar)

site/src/components/Resources/AgentStatus.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const useStyles = makeStyles((theme) => ({
7575

7676
connected: {
7777
backgroundColor: theme.palette.success.light,
78+
boxShadow: `0 0 12px 0 ${theme.palette.success.light}`,
7879
},
7980

8081
disconnected: {

site/src/components/Resources/ResourceAvatar.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ export const ResourceAvatar: React.FC<ResourceAvatarProps> = ({ resource }) => {
4242

4343
const useStyles = makeStyles((theme) => ({
4444
resourceAvatar: {
45-
color: theme.palette.info.contrastText,
46-
backgroundColor: theme.palette.info.main,
45+
backgroundColor: theme.palette.divider,
4746

4847
"& img": {
49-
width: 20,
50-
height: 20,
48+
width: 18,
49+
height: 18,
5150
},
5251
},
5352
}))

site/src/components/Resources/ResourceCard.tsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ export const ResourceCard: FC<ResourceCardProps> = ({
124124
className={styles.agentRow}
125125
>
126126
<Stack direction="row" alignItems="baseline">
127-
<AgentStatus agent={agent} />
127+
<div className={styles.agentStatusWrapper}>
128+
<AgentStatus agent={agent} />
129+
</div>
128130
<div>
129131
<div className={styles.agentName}>{agent.name}</div>
130132
<Stack
@@ -158,26 +160,6 @@ export const ResourceCard: FC<ResourceCardProps> = ({
158160
>
159161
{showApps && agent.status === "connected" && (
160162
<>
161-
{applicationsHost !== undefined && (
162-
<PortForwardButton
163-
host={applicationsHost}
164-
workspaceName={workspace.name}
165-
agentId={agent.id}
166-
agentName={agent.name}
167-
username={workspace.owner_name}
168-
/>
169-
)}
170-
{!hideSSHButton && (
171-
<SSHButton
172-
workspaceName={workspace.name}
173-
agentName={agent.name}
174-
/>
175-
)}
176-
<TerminalLink
177-
workspaceName={workspace.name}
178-
agentName={agent.name}
179-
userName={workspace.owner_name}
180-
/>
181163
{agent.apps.map((app) => (
182164
<AppLink
183165
key={app.name}
@@ -193,6 +175,27 @@ export const ResourceCard: FC<ResourceCardProps> = ({
193175
appSharingLevel={app.sharing_level}
194176
/>
195177
))}
178+
179+
<TerminalLink
180+
workspaceName={workspace.name}
181+
agentName={agent.name}
182+
userName={workspace.owner_name}
183+
/>
184+
{!hideSSHButton && (
185+
<SSHButton
186+
workspaceName={workspace.name}
187+
agentName={agent.name}
188+
/>
189+
)}
190+
{applicationsHost !== undefined && (
191+
<PortForwardButton
192+
host={applicationsHost}
193+
workspaceName={workspace.name}
194+
agentId={agent.id}
195+
agentName={agent.name}
196+
username={workspace.owner_name}
197+
/>
198+
)}
196199
</>
197200
)}
198201
{showApps && agent.status === "connecting" && (
@@ -278,6 +281,12 @@ const useStyles = makeStyles((theme) => ({
278281
},
279282
},
280283

284+
agentStatusWrapper: {
285+
width: theme.spacing(4.5),
286+
display: "flex",
287+
justifyContent: "center",
288+
},
289+
281290
agentName: {
282291
fontWeight: 600,
283292
},

site/src/theme/overrides.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,21 @@ export const getOverrides = ({ palette, breakpoints }: Theme): Overrides => {
5858
},
5959
},
6060
sizeSmall: {
61-
padding: `0 12px`,
61+
padding: `0 16px`,
6262
fontSize: 14,
6363
minHeight: 36,
64+
borderRadius: 6,
6465
},
6566
iconSizeSmall: {
66-
width: 16,
67-
height: 16,
67+
width: 14,
68+
height: 14,
6869
marginLeft: "0 !important",
69-
marginRight: 12,
70+
marginRight: 8,
71+
72+
"& svg": {
73+
width: 14,
74+
height: 14,
75+
},
7076
},
7177
outlined: {
7278
border: `1px solid ${palette.divider}`,

0 commit comments

Comments
 (0)