Skip to content

Commit

Permalink
refactor: Extract tag count component as generic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Mar 11, 2024
1 parent 139e978 commit 14fd7cd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
3 changes: 0 additions & 3 deletions src/content-tags-drawer/data/apiHooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,9 @@ export const useContentTaxonomyTagsUpdater = (contentId, taxonomyId) => {
mutationFn: ({ tags }) => updateContentTaxonomyTags(contentId, taxonomyId, tags),
onSettled: /* istanbul ignore next */ () => {
queryClient.invalidateQueries({ queryKey: ['contentTaxonomyTags', contentId] });
<<<<<<< HEAD
/// Invalidate query with pattern on course outline
queryClient.invalidateQueries({ queryKey: ['unitTagsCount'] });
=======
queryClient.invalidateQueries({ queryKey: ['contentTaxonomyTagsCount', contentId] });
>>>>>>> 92a9f4d9 (feat: Add count on TagsSidebarHeader)
},
});
};
4 changes: 0 additions & 4 deletions src/content-tags-drawer/tags-sidebar/TagsSidebar.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.tags-sidebar {
.course-unit-sidebar-header {
padding-bottom: .25rem !important;

.course-unit-sidebar-header-count.zero-count {
opacity: .4;
}
}

.tags-sidebar-body {
Expand Down
18 changes: 3 additions & 15 deletions src/content-tags-drawer/tags-sidebar/TagsSidebarHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Icon, Stack } from '@openedx/paragon';
import { Tag } from '@openedx/paragon/icons';
import { Stack } from '@openedx/paragon';
import { useParams } from 'react-router-dom';
import { useIntl } from '@edx/frontend-platform/i18n';
import classNames from 'classnames';

import messages from '../messages';
import { useContentTaxonomyTagsCount } from '../data/apiHooks';
import TagCount from '../../generic/tag-count';

const TagsSidebarHeader = () => {
const intl = useIntl();
Expand All @@ -22,18 +21,7 @@ const TagsSidebarHeader = () => {
{intl.formatMessage(messages.tagsSidebarTitle)}
</h3>
{ isContentTaxonomyTagsCountLoaded
&& (
<div className={
classNames('course-unit-sidebar-header-count d-flex', { 'zero-count': contentTaxonomyTagsCount === 0 })
}
>
<Icon
className="mr-1 pt-1"
src={Tag}
/>
{contentTaxonomyTagsCount}
</div>
)}
&& <TagCount count={contentTaxonomyTagsCount} />}
</Stack>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/generic/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
@import "./create-or-rerun-course/CreateOrRerunCourseForm";
@import "./WysiwygEditor";
@import "./course-stepper/CouseStepper";
@import "./tag-count/TagCount";

0 comments on commit 14fd7cd

Please sign in to comment.