Skip to content
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

fix(webapp): Tags are not being displayed #1784

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 0 additions & 4 deletions webapp/javascript/components/TagsBar.module.css

This file was deleted.

6 changes: 6 additions & 0 deletions webapp/javascript/components/TagsBar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.loadingWrapper {
display: flex;
height: 80px;
align-items: center;
justify-content: center;
}
28 changes: 20 additions & 8 deletions webapp/javascript/components/TagsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { Query, brandQuery } from '@webapp/models/query';
import Input from '@webapp/ui/Input';
import { appendLabelToQuery } from '@webapp/util/query';
import QueryInput from '@webapp/components/QueryInput/QueryInput';

import LoadingSpinner from '@webapp/ui/LoadingSpinner';
import styles from './TagsBar.module.scss';
interface TagsBarProps {
/** callback for when a label is selected */
onSelectedLabel: (label: string, query: Query) => void;
Expand Down Expand Up @@ -185,17 +186,28 @@ function LabelsSubmenu({
};

const Items = Object.entries(tags).map(([tag, tagValues]) => {
const onChange = (open: boolean) => {
if (open && tagValues.type !== 'loaded') {
onSelectedLabel(tag);
}
};

const values =
tagValues.type === 'loaded' ? (
<MenuGroup takeOverflow>{GetTagValues(tag, tagValues)}</MenuGroup>
) : (
<div className={styles.loadingWrapper}>
<LoadingSpinner />
</div>
);

return (
<SubMenu
key={tag}
overflow="auto"
position="initial"
onChange={(open) => {
// we are opening the menu for the first time
if (open && tagValues.type !== 'loaded') {
onSelectedLabel(tag);
}
}}
onChange={() => onChange(true)}
onMenuChange={({ open }) => onChange(open)}
label={() => (
<span
className="tag-content"
Expand All @@ -207,7 +219,7 @@ function LabelsSubmenu({
)}
>
{GetFilter(tag)}
<MenuGroup takeOverflow>{GetTagValues(tag, tagValues)}</MenuGroup>
{values}
</SubMenu>
);
});
Expand Down