From 7e973e0ee711c299da6f22e19c4ee35c504c2708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Jim=C3=A9nez?= Date: Tue, 10 Dec 2024 14:36:10 -0500 Subject: [PATCH] feat: site setting to control the toggle visibility in courses --- src/features/Courses/CoursesFilters/index.jsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/features/Courses/CoursesFilters/index.jsx b/src/features/Courses/CoursesFilters/index.jsx index d9e395a..a79de21 100644 --- a/src/features/Courses/CoursesFilters/index.jsx +++ b/src/features/Courses/CoursesFilters/index.jsx @@ -3,6 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { Col, Form } from '@edx/paragon'; import { Select } from 'react-paragon-topaz'; +import { getConfig } from '@edx/frontend-platform'; import { updateFilters, updateCurrentPage, updateShowAllCourses } from 'features/Courses/data/slice'; import { fetchCoursesData, fetchCoursesOptionsData } from 'features/Courses/data/thunks'; @@ -22,6 +23,8 @@ const CoursesFilters = () => { const [inputCourse, setInputCourse] = useState(''); const [defaultOption, setDefaultOption] = useState(allResultsOption); + const showCoursesToggle = getConfig().enable_toggle_courses || false; + const filterOptions = (option, input) => { if (input) { return option.label.toLowerCase().includes(input) || option.value === defaultOption.value; @@ -106,16 +109,20 @@ const CoursesFilters = () => { /> - - - Show my courses - - + { + showCoursesToggle && ( + + + Show my courses + + + ) + }