Skip to content

Commit

Permalink
feat: 온보딩 Activity에서 희망 학점 선택 Activity로 이동할 수 있도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
2wndrhs committed Feb 2, 2025
1 parent 92476f0 commit 7981445
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pages/OnboardingActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ChapelInput from '../components/ChapelInput';
import DepartmentInput from '../components/DepartmentInput';
import GradeInput from '../components/GradeInput';
import studentMachine from '../machines/studentMachine';
import { useFlow } from '../stackflow';

const OnboardingActivity: ActivityComponentType = () => {
// localStorage에 저장된 state를 가져옴
Expand All @@ -22,6 +23,7 @@ const OnboardingActivity: ActivityComponentType = () => {
snapshot: restoredState,
});
const [progress, setProgress] = useState(0);
const { push } = useFlow();

useEffect(() => {
const stateProgressMap = {
Expand All @@ -40,6 +42,11 @@ const OnboardingActivity: ActivityComponentType = () => {
// localStorage에 state를 저장
localStorage.setItem('student', JSON.stringify(persistedState));
console.log(state.context);
push('DesiredCreditActivity', {
majorRequired: 6,
majorElective: 5,
generalRequired: 4,
});
};

return (
Expand Down
2 changes: 2 additions & 0 deletions src/stackflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { basicUIPlugin } from '@stackflow/plugin-basic-ui';
import { basicRendererPlugin } from '@stackflow/plugin-renderer-basic';
import { stackflow } from '@stackflow/react';
import CourseSelectionActivity from './pages/CourseSelectionActivity';
import DesiredCreditActivity from './pages/DesiredCreditActivity';
import OnboardingActivity from './pages/OnboardingActivity';

export const { Stack, useFlow } = stackflow({
Expand All @@ -15,6 +16,7 @@ export const { Stack, useFlow } = stackflow({
activities: {
OnboardingActivity,
CourseSelectionActivity,
DesiredCreditActivity,
},
initialActivity: () => 'OnboardingActivity',
});

0 comments on commit 7981445

Please sign in to comment.