Skip to content

Commit ea74fdb

Browse files
committed
fix: improve workspace and template icon display in lists
This change makes workspace and template icons more prominent by: - Adding a listView prop to Avatar component for specialized styling - Removing background and border for icon-based avatars - Making icons 30% larger with transform: scale(1.3) - Preserving normal Avatar behavior in other parts of the app - Ensuring proper vertical alignment with the workspace/template name Fixes #17127
1 parent 06e5d9e commit ea74fdb

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

site/src/components/Avatar/Avatar.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,45 @@ export type AvatarProps = AvatarPrimitive.AvatarProps &
5858
VariantProps<typeof avatarVariants> & {
5959
src?: string;
6060
fallback?: string;
61+
/**
62+
* Style overrides specifically for list view avatars.
63+
* When true, applies special styling for workspace/template list views:
64+
* - Removes background and border when an image is present
65+
* - Makes the icon slightly larger
66+
*/
67+
listView?: boolean;
6168
};
6269

6370
const Avatar = React.forwardRef<
6471
React.ElementRef<typeof AvatarPrimitive.Root>,
6572
AvatarProps
66-
>(({ className, size, variant, src, fallback, children, ...props }, ref) => {
73+
>(({ className, size, variant, src, fallback, listView, children, ...props }, ref) => {
6774
const theme = useTheme();
68-
75+
76+
// Process list view styling
77+
const processedCss = {
78+
...(listView && {
79+
width: "42px",
80+
height: "42px",
81+
fontSize: "16px",
82+
...(src && {
83+
background: "transparent !important",
84+
backgroundColor: "transparent !important",
85+
border: "none !important",
86+
boxShadow: "none !important",
87+
padding: 0,
88+
"& img": {
89+
transform: "scale(1.3)", // 30% larger icon
90+
}
91+
})
92+
})
93+
};
94+
6995
return (
7096
<AvatarPrimitive.Root
7197
ref={ref}
7298
className={cn(avatarVariants({ size, variant, className }))}
99+
css={processedCss}
73100
{...props}
74101
>
75102
<AvatarPrimitive.Image
@@ -78,7 +105,7 @@ const Avatar = React.forwardRef<
78105
css={getExternalImageStylesFromUrl(theme.externalImages, src)}
79106
/>
80107
{fallback && (
81-
<AvatarPrimitive.Fallback className="flex h-full w-full items-center justify-center rounded-full">
108+
<AvatarPrimitive.Fallback className="flex h-full w-full items-center justify-center">
82109
{fallback.charAt(0).toUpperCase()}
83110
</AvatarPrimitive.Fallback>
84111
)}

site/src/components/Avatar/AvatarData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const AvatarData: FC<AvatarDataProps> = ({
3737
}
3838

3939
return (
40-
<Stack spacing={1} direction="row" className="w-full">
40+
<Stack spacing={1} direction="row" className="w-full" alignItems="center">
4141
{avatar}
4242

4343
<Stack spacing={0} className="w-full">
@@ -64,4 +64,4 @@ export const AvatarData: FC<AvatarDataProps> = ({
6464
</Stack>
6565
</Stack>
6666
);
67-
};
67+
};

site/src/pages/TemplatesPage/TemplatesPageView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const TemplateRow: FC<TemplateRowProps> = ({ showOrganizations, template }) => {
116116
variant="icon"
117117
src={template.icon}
118118
fallback={template.display_name || template.name}
119+
listView
119120
/>
120121
}
121122
/>
@@ -321,4 +322,4 @@ const styles = {
321322
transition: "none",
322323
color: theme.palette.text.primary,
323324
}),
324-
} satisfies Record<string, Interpolation<Theme>>;
325+
} satisfies Record<string, Interpolation<Theme>>;

site/src/pages/WorkspacesPage/WorkspacesTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({
190190
variant="icon"
191191
src={workspace.template_icon}
192192
fallback={workspace.name}
193+
listView
193194
/>
194195
}
195196
/>
@@ -342,4 +343,4 @@ const TableLoader: FC<TableLoaderProps> = ({ canCheckWorkspaces }) => {
342343

343344
const cantBeChecked = (workspace: Workspace) => {
344345
return ["deleting", "pending"].includes(workspace.latest_build.status);
345-
};
346+
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy