@@ -11,7 +11,7 @@ import FlowNav, { FlowTabId } from '../components/FlowNav';
1111import ActivityCard from '../components/ActivityCard' ;
1212import ChooseActivitySkeleton from '../components/ChooseActivitySkeleton' ;
1313import { ScreenSize } from '../lib/MicroCoachModels' ;
14- import { PlanProps } from '../hooks/usePlanItems ' ;
14+ import { IPlanItem } from '../lib/PipelineModels ' ;
1515import {
1616 BackButton ,
1717 ContextBanner ,
@@ -23,26 +23,30 @@ import {
2323 ScreenSizeProps ,
2424} from '../lib/styledcomponents/ReviewStyledComponents' ;
2525import { useAllReady , useI18nReady } from '../hooks/readiness' ;
26- import { useMisconceptions } from '../hooks/useMisconceptions ' ;
26+ import { useMicroCoachDataState } from '../hooks/context/useMicroCoachDataContext ' ;
2727import { IMicroCoachActivity } from '../api/Models/IMicroCoachActivity' ;
2828import { IMicroCoachMisconception } from '../api/Models/IMicroCoachMisconception' ;
2929
30- interface ChooseActivityViewProps extends ScreenSizeProps , PlanProps {
30+ interface ChooseActivityProps extends ScreenSizeProps {
31+ saveActivity : ( item : IPlanItem ) => void ;
32+ }
33+
34+ interface ChooseActivityViewProps extends ChooseActivityProps {
3135 misconception : IMicroCoachMisconception ;
36+ planItems : IPlanItem [ ] ;
3237}
3338
3439function ChooseActivityView ( {
3540 misconception,
3641 screenSize,
37- plan,
42+ planItems,
43+ saveActivity,
3844} : ChooseActivityViewProps ) {
3945 const { t } = useTranslation ( ) ;
4046 const theme = useTheme ( ) ;
4147 const navigate = useNavigate ( ) ;
4248 const isLarge = screenSize === ScreenSize . LARGE ;
4349
44- const { planItems, saveActivity } = plan ;
45-
4650 // Selection lives in the plan, so choosing here is what populates My Plan.
4751 const selectedActivityId =
4852 planItems . find (
@@ -168,9 +172,14 @@ function ChooseActivityView({
168172 ) ;
169173}
170174
171- export default function ChooseActivity ( { screenSize, plan } : ScreenSizeProps & PlanProps ) {
175+ export default function ChooseActivity ( {
176+ screenSize,
177+ saveActivity,
178+ } : ChooseActivityProps ) {
172179 const { misconceptionId } = useParams ( ) ;
173- const { misconceptions, isReady : dataReady } = useMisconceptions ( ) ;
180+ const { misconceptions, misconceptionsStatus, planItems } =
181+ useMicroCoachDataState ( ) ;
182+ const dataReady = misconceptionsStatus === 'ready' ;
174183 const isReady = useAllReady ( useI18nReady ( ) , dataReady ) ;
175184
176185 if ( ! isReady ) {
@@ -188,7 +197,8 @@ export default function ChooseActivity({ screenSize, plan }: ScreenSizeProps & P
188197 < ChooseActivityView
189198 misconception = { misconception }
190199 screenSize = { screenSize }
191- plan = { plan }
200+ planItems = { planItems }
201+ saveActivity = { saveActivity }
192202 />
193203 ) ;
194204}
0 commit comments