From 9f0f99e8ddecf8c31c31d50667754c7d668cb182 Mon Sep 17 00:00:00 2001 From: Yusuf Musleh Date: Thu, 28 Mar 2024 12:24:08 +0300 Subject: [PATCH] feat: Add taxonomies tab in home page --- src/studio-home/tabs-section/index.jsx | 14 ++++++++++++++ src/studio-home/tabs-section/messages.js | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/studio-home/tabs-section/index.jsx b/src/studio-home/tabs-section/index.jsx index c3afa83bb0..c0133a0bea 100644 --- a/src/studio-home/tabs-section/index.jsx +++ b/src/studio-home/tabs-section/index.jsx @@ -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'; 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 { @@ -90,6 +94,14 @@ const TabsSection = ({ ); } + tabs.push( + , + ); + return tabs; }, [archivedCourses, librariesEnabled, showNewCourseContainer, isLoadingCourses, isLoadingLibraries]); @@ -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); }; diff --git a/src/studio-home/tabs-section/messages.js b/src/studio-home/tabs-section/messages.js index 75e945cef8..aa2bdb1756 100644 --- a/src/studio-home/tabs-section/messages.js +++ b/src/studio-home/tabs-section/messages.js @@ -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;