-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor non instruction components
- Loading branch information
Showing
13 changed files
with
186 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React from 'react'; | ||
|
||
const ExamStateContext = React.createContext({}); | ||
export default ExamStateContext; | ||
// import React from 'react'; | ||
// | ||
// const ExamStateContext = React.createContext({}); | ||
// export default ExamStateContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import React, { useMemo } from 'react'; | ||
import { withExamStore } from '../hocs'; | ||
import * as dispatchActions from '../data/thunks'; | ||
import ExamStateContext from '../context'; | ||
import { IS_STARTED_STATUS } from '../constants'; | ||
|
||
/** | ||
* Make exam state available as a context for all library components. | ||
* @param children - sequence content | ||
* @param state - exam state params and actions | ||
* @returns {JSX.Element} | ||
*/ | ||
|
||
// eslint-disable-next-line react/prop-types | ||
const StateProvider = ({ children, ...state }) => { | ||
const contextValue = useMemo(() => ({ | ||
...state, | ||
showTimer: !!(state.activeAttempt && IS_STARTED_STATUS(state.activeAttempt.attempt_status)), | ||
}), [state]); | ||
return ( | ||
<ExamStateContext.Provider value={contextValue}> | ||
{children} | ||
</ExamStateContext.Provider> | ||
); | ||
}; | ||
|
||
const mapStateToProps = (state) => ({ ...state.specialExams }); | ||
|
||
const ExamStateProvider = withExamStore( | ||
StateProvider, | ||
mapStateToProps, | ||
dispatchActions, | ||
); | ||
|
||
export default ExamStateProvider; | ||
// import React, { useMemo } from 'react'; | ||
// import { withExamStore } from '../hocs'; | ||
// import * as dispatchActions from '../data/thunks'; | ||
// import ExamStateContext from '../context'; | ||
// import { IS_STARTED_STATUS } from '../constants'; | ||
// | ||
// /** | ||
// * Make exam state available as a context for all library components. | ||
// * @param children - sequence content | ||
// * @param state - exam state params and actions | ||
// * @returns {JSX.Element} | ||
// */ | ||
// | ||
// // eslint-disable-next-line react/prop-types | ||
// const StateProvider = ({ children, ...state }) => { | ||
// const contextValue = useMemo(() => ({ | ||
// ...state, | ||
// showTimer: !!(state.activeAttempt && IS_STARTED_STATUS(state.activeAttempt.attempt_status)), | ||
// }), [state]); | ||
// return ( | ||
// <ExamStateContext.Provider value={contextValue}> | ||
// {children} | ||
// </ExamStateContext.Provider> | ||
// ); | ||
// }; | ||
// | ||
// const mapStateToProps = (state) => ({ ...state.specialExams }); | ||
// | ||
// const ExamStateProvider = withExamStore( | ||
// StateProvider, | ||
// mapStateToProps, | ||
// dispatchActions, | ||
// ); | ||
// | ||
// export default ExamStateProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { configureStore } from '@reduxjs/toolkit'; | ||
import examReducer from './slice'; | ||
|
||
export default configureStore({ | ||
reducer: { | ||
specialExams: examReducer, | ||
}, | ||
}); | ||
// import { configureStore } from '@reduxjs/toolkit'; | ||
// import examReducer from './slice'; | ||
// | ||
// export default configureStore({ | ||
// reducer: { | ||
// examState: examReducer, | ||
// }, | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.