Skip to content

Commit

Permalink
feat: Add taxonomies tab in home page
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuf-musleh committed Mar 28, 2024
1 parent 80bf869 commit 9f0f99e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/studio-home/tabs-section/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import { Tab, Tabs } from '@openedx/paragon';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { useNavigate } from 'react-router-dom';

import { getLoadingStatuses, getStudioHomeData } from '../data/selectors';
import messages from './messages';
import LibrariesTab from './libraries-tab';
import ArchivedTab from './archived-tab';
import CoursesTab from './courses-tab';
import { TaxonomyListPage } from '../../taxonomy';

Check failure on line 13 in src/studio-home/tabs-section/index.jsx

View workflow job for this annotation

GitHub Actions / tests

'TaxonomyListPage' is defined but never used
import { RequestStatus } from '../../data/constants';
import { fetchLibraryData } from '../data/thunks';

const TabsSection = ({
intl, showNewCourseContainer, onClickNewCourse, isShowProcessing, dispatch,
}) => {
const navigate = useNavigate();
const TABS_LIST = {
courses: 'courses',
libraries: 'libraries',
archived: 'archived',
taxonomies: 'taxonomies',
};
const [tabKey, setTabKey] = useState(TABS_LIST.courses);
const {
Expand Down Expand Up @@ -90,6 +94,14 @@ const TabsSection = ({
);
}

tabs.push(
<Tab
key={TABS_LIST.taxonomies}
eventKey={TABS_LIST.taxonomies}
title={intl.formatMessage(messages.taxonomiesTabTitle)}
/>,
);

return tabs;
}, [archivedCourses, librariesEnabled, showNewCourseContainer, isLoadingCourses, isLoadingLibraries]);

Expand All @@ -98,6 +110,8 @@ const TabsSection = ({
window.location.assign(libraryAuthoringMfeUrl);
} else if (tab === TABS_LIST.libraries && !redirectToLibraryAuthoringMfe) {
dispatch(fetchLibraryData());
} else if (tab === TABS_LIST.taxonomies) {
navigate('/taxonomies');
}
setTabKey(tab);
};
Expand Down
4 changes: 4 additions & 0 deletions src/studio-home/tabs-section/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const messages = defineMessages({
id: 'course-authoring.studio-home.archived.tab.error.message',
defaultMessage: 'Failed to fetch archived courses. Please try again later.',
},
taxonomiesTabTitle: {
id: 'course-authoring.studio-home.taxonomies.tab.title',
defaultMessage: 'Taxonomies',
},
});

export default messages;

0 comments on commit 9f0f99e

Please sign in to comment.