-
Notifications
You must be signed in to change notification settings - Fork 4
cp-159: Add more steps to the survey#159 #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
BrianSammit
wants to merge
21
commits into
development
Choose a base branch
from
task/cp-159-add-more-steps-survey
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
46dd53c
cp-159: + survey navigation parameter and survey screen enum
BrianSammit 3a88d5b
cp-159: + add pages with more steps to the survey
BrianSammit d9b25bc
cp-159: + fix bug of white background color in nested stack and fix p…
BrianSammit 1f313f8
cp-159: + get the journaling step data and send it to the back-end
BrianSammit c9f40e5
cp-159: + get the feeling steps data and send it to the back-end
BrianSammit 4fe01dd
cp-159: + get the goals steps data and send it to the back-end
BrianSammit 1b29104
cp-159: + get the worries steps data and send it to the back-end
BrianSammit 9224ce5
cp-159: + get the worries steps data and send it to the back-end
BrianSammit 1c4e8d7
cp-159: + get the meditation steps data and send it to the back-end
BrianSammit 3ac21bd
Merge branch 'development' into task/cp-159-add-more-steps-survey
iamAlinaaa 6538027
cp-159: + add a component for reuse in screens and move the stack sur…
BrianSammit 011cec8
cp-159: + redux slice to manage the state of the survey
BrianSammit 8bc5bb9
cp-159: + the data receive from each step and update the slice
BrianSammit a7fb50c
cp-159: + collect the data from steps and send it
BrianSammit f94cc12
Merge branch 'task/cp-159-add-more-steps-survey' of https://github.co…
BrianSammit f686892
Merge branch 'development' of https://github.com/BinaryStudioAcademy/…
BrianSammit 2c3c0b3
cp-159: + all steps to survey and fix styles
BrianSammit a502750
cp-159: * fix misspelling that generate bug sending data to back end
BrianSammit b872bfc
cp-159: + form for one option and and validation
BrianSammit 3758042
cp-159: * merge conflicts
BrianSammit 3e9d897
Merge branch 'development' into task/cp-159-add-more-steps-survey
BrianSammit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
10 changes: 10 additions & 0 deletions
10
mobile/src/libs/enums/navigation/survey-screen-name.enum.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| const SurveyScreenName = { | ||
| PREFERENCES: 'preferences', | ||
| FEELINGS: 'feelings', | ||
| GOALS: 'goals', | ||
| WORRIES: 'worries', | ||
| MEDITATION_EXPERIENCE: 'meditationExperience', | ||
| JOURNALING_EXPERIENCE: 'journalingExperience', | ||
| } as const; | ||
|
|
||
| export { SurveyScreenName }; |
This file contains hidden or 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 hidden or 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
8 changes: 8 additions & 0 deletions
8
mobile/src/libs/types/navigation/survey-navigation-item.type.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { type SurveyNavigationParameterList } from './survey-navigation-parameter-list.type'; | ||
|
|
||
| type SurveyNavigationItem = { | ||
| name: keyof SurveyNavigationParameterList; | ||
| component: React.ComponentType; | ||
| }; | ||
|
|
||
| export { type SurveyNavigationItem }; |
12 changes: 12 additions & 0 deletions
12
mobile/src/libs/types/navigation/survey-navigation-parameter-list.type.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { type SurveyScreenName } from '#libs/enums/enums'; | ||
|
|
||
| type SurveyNavigationParameterList = { | ||
| [SurveyScreenName.PREFERENCES]: undefined | object; | ||
| [SurveyScreenName.FEELINGS]: undefined | object; | ||
| [SurveyScreenName.GOALS]: undefined | object; | ||
| [SurveyScreenName.WORRIES]: undefined | object; | ||
| [SurveyScreenName.MEDITATION_EXPERIENCE]: undefined | object; | ||
| [SurveyScreenName.JOURNALING_EXPERIENCE]: undefined | object; | ||
| }; | ||
|
|
||
| export { type SurveyNavigationParameterList }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { SurveyScreenName } from '#libs/enums/enums'; | ||
| import { type SurveyNavigationItem } from '#libs/types/types'; | ||
| import { | ||
| FeelingsStep, | ||
| GoalsStep, | ||
| JournalingStep, | ||
| MeditationStep, | ||
| PreferencesStep, | ||
| WorriesStep, | ||
| } from '#screens/survey/components/components'; | ||
|
|
||
| const SURVEY_NAVIGATION_ITEMS: SurveyNavigationItem[] = [ | ||
| { | ||
| name: SurveyScreenName.PREFERENCES, | ||
| component: PreferencesStep, | ||
| }, | ||
| { | ||
| name: SurveyScreenName.FEELINGS, | ||
| component: FeelingsStep, | ||
| }, | ||
| { | ||
| name: SurveyScreenName.GOALS, | ||
| component: GoalsStep, | ||
| }, | ||
| { | ||
| name: SurveyScreenName.WORRIES, | ||
| component: WorriesStep, | ||
| }, | ||
| { | ||
| name: SurveyScreenName.MEDITATION_EXPERIENCE, | ||
| component: MeditationStep, | ||
| }, | ||
| { | ||
| name: SurveyScreenName.JOURNALING_EXPERIENCE, | ||
| component: JournalingStep, | ||
| }, | ||
| ]; | ||
|
|
||
| export { SURVEY_NAVIGATION_ITEMS }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { | ||
| createNativeStackNavigator, | ||
| type NativeStackNavigationOptions, | ||
| } from '@react-navigation/native-stack'; | ||
| import React from 'react'; | ||
|
|
||
| import { SignBackground } from '#libs/components/components'; | ||
| import { useAppDispatch, useEffect } from '#libs/hooks/hooks'; | ||
| import { type SurveyNavigationParameterList } from '#libs/types/types'; | ||
| import { actions as authActions } from '#slices/auth/auth'; | ||
|
|
||
| import { SURVEY_NAVIGATION_ITEMS } from './libs/constants'; | ||
|
|
||
| const NativeStack = createNativeStackNavigator<SurveyNavigationParameterList>(); | ||
|
|
||
| const screenOptions: NativeStackNavigationOptions = { | ||
| headerShown: false, | ||
| }; | ||
|
|
||
| const Survey: React.FC = () => { | ||
| const dispatch = useAppDispatch(); | ||
|
|
||
| useEffect(() => { | ||
| void dispatch(authActions.getAuthenticatedUser()); | ||
| }, [dispatch]); | ||
|
|
||
| return ( | ||
| <SignBackground> | ||
| <NativeStack.Navigator screenOptions={screenOptions}> | ||
| {SURVEY_NAVIGATION_ITEMS.map((screen) => { | ||
| return ( | ||
| <NativeStack.Screen | ||
| name={screen.name} | ||
| component={screen.component} | ||
| key={screen.name} | ||
| /> | ||
| ); | ||
| })} | ||
| </NativeStack.Navigator> | ||
| </SignBackground> | ||
| ); | ||
| }; | ||
|
|
||
| export { Survey }; |
This file contains hidden or 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,5 +1,6 @@ | ||
| export { | ||
| type SurveyGetAllItemResponseDto, | ||
| type SurveyInputDto, | ||
| type SurveyMultipleInputDto, | ||
| type SurveyOneInputDto, | ||
| type SurveyRequestDto, | ||
| } from 'shared/build/index.js'; |
2 changes: 1 addition & 1 deletion
2
mobile/src/packages/survey/libs/validation-shemas/validation-schemas.ts
This file contains hidden or 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 +1 @@ | ||
| export { surveyInputValidationSchema } from 'shared/build/index.js'; | ||
| export { surveyInputValidationSchemaMultiple } from 'shared/build/index.js'; |
This file contains hidden or 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 hidden or 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,2 +1,9 @@ | ||
| export { FeelingsStep } from './feelings-step/feelings-step'; | ||
| export { GoalsStep } from './goals-step/goals-step'; | ||
| export { JournalingStep } from './journaling-step/journaling-step'; | ||
| export { MeditationStep } from './meditation-step/meditation-step'; | ||
| export { PreferencesStep } from './preferences-step/preferences-step'; | ||
| export { SurveyCategory } from './survey-category/survey-category'; | ||
| export { SurveyStepMultiple } from './survey-step/survey-step-multiple'; | ||
| export { SurveyStepOne } from './survey-step/survey-step-one'; | ||
| export { WorriesStep } from './worries-step/worries-step'; |
27 changes: 27 additions & 0 deletions
27
mobile/src/screens/survey/components/feelings-step/feelings-step.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { type NavigationProp } from '@react-navigation/native'; | ||
| import { useNavigation } from '@react-navigation/native'; | ||
| import React from 'react'; | ||
|
|
||
| import { SurveyScreenName } from '#libs/enums/enums'; | ||
| import { type SurveyNavigationParameterList } from '#libs/types/types'; | ||
| import { FEELING_CATEGORIES } from '#screens/survey/libs/constants/constants'; | ||
|
|
||
| import { SurveyStepMultiple } from '../components'; | ||
|
|
||
| const FeelingsStep: React.FC = () => { | ||
| const navigation = | ||
| useNavigation<NavigationProp<SurveyNavigationParameterList>>(); | ||
|
|
||
| return ( | ||
| <SurveyStepMultiple | ||
| stepSurvey={SurveyScreenName.FEELINGS} | ||
| navigation={navigation} | ||
| stepTitle="How have you been feeling lately?" | ||
| categories={FEELING_CATEGORIES} | ||
| nextScreen={SurveyScreenName.GOALS} | ||
| previousScreen={SurveyScreenName.PREFERENCES} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export { FeelingsStep }; |
27 changes: 27 additions & 0 deletions
27
mobile/src/screens/survey/components/goals-step/goals-step.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { type NavigationProp } from '@react-navigation/native'; | ||
| import { useNavigation } from '@react-navigation/native'; | ||
| import React from 'react'; | ||
|
|
||
| import { SurveyScreenName } from '#libs/enums/enums'; | ||
| import { type SurveyNavigationParameterList } from '#libs/types/types'; | ||
| import { GOALS_CATEGORIES } from '#screens/survey/libs/constants/constants'; | ||
|
|
||
| import { SurveyStepMultiple } from '../components'; | ||
|
|
||
| const GoalsStep: React.FC = () => { | ||
| const navigation = | ||
| useNavigation<NavigationProp<SurveyNavigationParameterList>>(); | ||
|
|
||
| return ( | ||
| <SurveyStepMultiple | ||
| stepSurvey={SurveyScreenName.GOALS} | ||
| navigation={navigation} | ||
| stepTitle="What do you want to achieve with Calmpal?" | ||
| categories={GOALS_CATEGORIES} | ||
| nextScreen={SurveyScreenName.WORRIES} | ||
| previousScreen={SurveyScreenName.FEELINGS} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export { GoalsStep }; |
29 changes: 29 additions & 0 deletions
29
mobile/src/screens/survey/components/journaling-step/journaling-step.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { type NavigationProp } from '@react-navigation/native'; | ||
| import { useNavigation } from '@react-navigation/native'; | ||
| import React from 'react'; | ||
|
|
||
| import { SurveyScreenName } from '#libs/enums/enums'; | ||
| import { type SurveyNavigationParameterList } from '#libs/types/types'; | ||
| import { JOURNALING_EXPERIENCE_CATEGORIES } from '#screens/survey/libs/constants/constants'; | ||
|
|
||
| import { SurveyStepOne } from '../components'; | ||
|
|
||
| const JournalingStep: React.FC = () => { | ||
| const navigation = | ||
| useNavigation<NavigationProp<SurveyNavigationParameterList>>(); | ||
|
|
||
| return ( | ||
| <SurveyStepOne | ||
| stepSurvey={SurveyScreenName.JOURNALING_EXPERIENCE} | ||
| navigation={navigation} | ||
| stepTitle="What's your experience with journaling?" | ||
| categories={JOURNALING_EXPERIENCE_CATEGORIES} | ||
| nextScreen={SurveyScreenName.JOURNALING_EXPERIENCE} | ||
| previousScreen={SurveyScreenName.MEDITATION_EXPERIENCE} | ||
| isLastStep | ||
| isOneOption | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export { JournalingStep }; |
28 changes: 28 additions & 0 deletions
28
mobile/src/screens/survey/components/meditation-step/meditation-step.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { type NavigationProp } from '@react-navigation/native'; | ||
| import { useNavigation } from '@react-navigation/native'; | ||
| import React from 'react'; | ||
|
|
||
| import { SurveyScreenName } from '#libs/enums/enums'; | ||
| import { type SurveyNavigationParameterList } from '#libs/types/types'; | ||
| import { MEDITATION_EXPERIENCE_CATEGORIES } from '#screens/survey/libs/constants/constants'; | ||
|
|
||
| import { SurveyStepOne } from '../components'; | ||
|
|
||
| const MeditationStep: React.FC = () => { | ||
| const navigation = | ||
| useNavigation<NavigationProp<SurveyNavigationParameterList>>(); | ||
|
|
||
| return ( | ||
| <SurveyStepOne | ||
| stepSurvey={SurveyScreenName.MEDITATION_EXPERIENCE} | ||
| navigation={navigation} | ||
| stepTitle="What's your experince with meditation?" | ||
| categories={MEDITATION_EXPERIENCE_CATEGORIES} | ||
| nextScreen={SurveyScreenName.JOURNALING_EXPERIENCE} | ||
| previousScreen={SurveyScreenName.WORRIES} | ||
| isOneOption | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export { MeditationStep }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide more specific types