Skip to content

chore(site): refactor filter component to be more extendable #13688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix search icons
  • Loading branch information
BrunoQuaresma committed Jun 26, 2024
commit 60aa0169be962f4c1612a19e2da01fe2bc972a11
28 changes: 25 additions & 3 deletions site/src/components/Filter/UserFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ export const useUserFilterMenu = ({
const addMeAsFirstOption = (options: SelectFilterOption[]) => {
options = options.filter((option) => option.value !== me.username);
return [
{ label: me.username, value: me.username, avatarUrl: me.avatar_url },
{
label: me.username,
value: me.username,
startIcon: (
<UserAvatar
username={me.username}
avatarURL={me.avatar_url}
size="xs"
/>
),
},
...options,
];
};
Expand All @@ -34,7 +44,13 @@ export const useUserFilterMenu = ({
return {
label: me.username,
value: me.username,
avatarUrl: me.avatar_url,
startIcon: (
<UserAvatar
username={me.username}
avatarURL={me.avatar_url}
size="xs"
/>
),
};
}

Expand All @@ -44,7 +60,13 @@ export const useUserFilterMenu = ({
return {
label: firstUser.username,
value: firstUser.username,
avatarUrl: firstUser.avatar_url,
startIcon: (
<UserAvatar
username={firstUser.username}
avatarURL={firstUser.avatar_url}
size="xs"
/>
),
};
}
return null;
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacesPage/filter/menus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const useTemplateFilterMenu = ({
label:
template.display_name !== "" ? template.display_name : template.name,
value: template.name,
icon: template.icon,
startIcon: <TemplateAvatar size="xs" template={template} />,
}));
},
});
Expand Down