Skip to content

Commit

Permalink
debug lesson library
Browse files Browse the repository at this point in the history
  • Loading branch information
hj940709 committed Jul 31, 2024
1 parent 73440dd commit 3e03b92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions client/components/Lessons/LessonLibrary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ const LessonList = () => {
libraries.private && savedLibrarySelection === 'group')) setLibrary(savedLibrarySelection)
}, [savedLibrarySelection])

useEffect(() => {
if (teacherView) handleLibraryChange('group')
}, [teacherView])

useEffect(() => {
// Filter lessons based on search query
if (searchQuery){
Expand Down
17 changes: 12 additions & 5 deletions client/components/Tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import JoyRide, { ACTIONS, EVENTS, STATUS } from 'react-joyride'
import { sidebarSetOpen } from 'Utilities/redux/sidebarReducer'
import { useSelector, useDispatch } from 'react-redux'
import { handleNextTourStep, startTour, stopTour } from 'Utilities/redux/tourReducer'
import { getLessonInstance, setLessonInstance, setLessonStep } from 'Utilities/redux/lessonInstanceReducer'
import {
getLessonInstance,
setLessonInstance,
setLessonStep,
clearLessonInstanceState
} from 'Utilities/redux/lessonInstanceReducer'
import { updateLibrarySelect, saveSelfIntermediate } from 'Utilities/redux/userReducer'
import { FormattedMessage } from 'react-intl'
import useWindowDimensions from 'Utilities/windowDimensions'
Expand Down Expand Up @@ -105,16 +110,17 @@ const Tour = () => {
}
// lessons tour steps
if (tourState.steps === lessonsTourSteps) {
console.log('lessons tour steps')
if (!metaPending && !lessonPending && lesson.topic_ids.length === 0) {
const newTopics = [lesson_topics.filter(topic=>topic.target?.length>0)[0].topic_id]
dispatch(setLessonInstance({ topic_ids: newTopics}))
}
switch (index) {
case 0:
if (!teacherView) {
if (!teacherView && user.last_selected_library !== 'private') {
dispatch(updateLibrarySelect('private'))
dispatch(saveSelfIntermediate({ last_selected_library: 'private' }))
dispatch(clearLessonInstanceState())
dispatch(getLessonInstance(null))
}
dispatch(setLessonStep(0))
break
Expand Down Expand Up @@ -221,16 +227,17 @@ const Tour = () => {
}
// lessons tour control
if (tourState.steps === lessonsTourSteps) {
console.log('lessons tour steps')
if (!metaPending && lesson.topic_ids.length === 0) {
const newTopics = [lesson_topics.filter(topic=>topic.target?.length>0)[0].topic_id]
dispatch(setLessonInstance({ topic_ids: newTopics}))
}
switch (index) {
case 0:
if (!teacherView) {
if (!teacherView && user.last_selected_library !== 'private') {
dispatch(updateLibrarySelect('private'))
dispatch(saveSelfIntermediate({ last_selected_library: 'private' }))
dispatch(clearLessonInstanceState())
dispatch(getLessonInstance(null))
}
dispatch(setLessonStep(0))
break
Expand Down

0 comments on commit 3e03b92

Please sign in to comment.