-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
…now - we cannot change properties directly -> react-router doesn’t work because of that. Will implement react-router-redux, which is working through dispatching redux actions.
…ux and redux-router)
…re (not the router as before) Added separate story for router as an example of how it can be used
…n to use app button component (plus added some logic to it)
Exercise navigation
src/index.stories.js
Outdated
|
||
// router demonstration | ||
const reducer = combineReducers(reducers); | ||
const store = createStore(reducer); |
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.
I think this should be done in the story itself, otherwise the store is not reset when one switches between stories (and then you wonder why the forward button does not work)
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.
I've ended up making a completely different story for router, which is much simpler and better represents the router functionality (and doesn't use store at all)
But yes, I agree - initialisation should've been in the story itself.
app.json
Outdated
@@ -1,5 +1,13 @@ | |||
{ | |||
"expo": { | |||
"sdkVersion": "15.0.0" | |||
"sdkVersion": "15.0.0", | |||
"name": "Serlo-ABC", |
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.
If I read the commit messages correctly, then this is used for the production build? Didn't look into how to do that yet. So if possible, could you add a npm
task for that?
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.
Andrej said, that he sent you the instructions already for how to build a production version of the app, I will attach it here just for history purposes - basically it just uses Expo utility for that.
But if you'll decide that it's worth to put it in separate npm
task - we can always do it :)
I’ve added a configuration file to our repository to build a production version of application using Expo: first one needs to install exp (either globally with
-g
param or locally):
npm install exp
The run some command with it in order for it to propose to create an account (If you’ve installed it globally ./node_modules/.bin part shouldn’t be there):
./node_modules/.bin/exp start
Go through the process of creating an account, and then run:
./node_modules/.bin/exp build:android
(ios
)
It will take about 10-15 minutes to build an .apk file, you can check the process with:
./node_modules/.bin/exp build:status
-> in the end it will write url to the newly generated application file.
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.
Thanks :)
package.json
Outdated
@@ -35,6 +35,8 @@ | |||
"expo": "^15.1.3", | |||
"ramda": "^0.23.0", | |||
"react": "~15.4.2", | |||
"react-native": "^0.42.0" | |||
"react-native": "^0.42.0", | |||
"react-native-router-flux": "^3.38.0", |
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.
To get it run on OS X, I needed to downgrade react-native-router-flux, i.e. "react-native-router-flux": "3.38.0",
instead of "react-native-router-flux": "^3.38.0",
src/components/ExerciseLayout.js
Outdated
} | ||
|
||
render () { | ||
const { course, changeExercise, nextExercise, currentExercise } = this.props; |
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.
changeExercise
gets passed down from connect
I suppose? Could we do that in this file directly so that one knows where changeExercises
comes from?
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.
For the ExerciseLayout component - these functions are just the props passed from parent (/containers/ExerciseApp.js
), which is in fact connected to the Redux Store.
I've used this structure as it is proposed by Redux documentation (in this case ExerciseLayout
is a presentational component and ExerciseApp
is a container), but we can change the structure any way you want :)
src/components/ExerciseLayout.js
Outdated
<View key={`s_${sectionIndex}_c_${chapterIndex}`}> | ||
<Text style={styles.chapterText}>Chapter {chapter.title}</Text> | ||
{chapter.exercises.map((exercise) => { | ||
const eIndex = exerciseIndex; |
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.
Is there a reason why this can't be the index from map
?
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.
note /self: yes, basically it generates a global id
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.
Yes, you're right - here it's like a global id across all sections/chapters for the exercise, today I will work more on the exercises queue - so I may end up changing it a bit.
src/reducers/exercise.js
Outdated
}; | ||
|
||
// init current exercise from storage | ||
AsyncStorage |
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.
Maybe we could use redux-persist
for that since this info will be part of the store, anyway?
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.
Good Idea, will implement it instead
…ncies - changed the version to match exactly. For router demonstration story - I’ve completely changed the story (made it easier to understand, plus it shows the functionality better)
Added some logic to one of the exercises (DifferFromSymbol) to be able to select answer and change button colour based on the selected answer and submission status (success/fail). Added actions to exercise-reducer to: select an answer, submit an answer for current exercise. Now instead of generating separate queue of exercises we preserve a course tree.
This reverts commit ba1bdb3.
I have checked the errors from Ignore code with issue-references:
Should I put it into And another quick question: I've worked today in a separate branch with exercise logic - do you want me to keep all branches separate or merge everything into master in our forked repository to see the changes here? |
Feel free to put that into .flowconfig since we aren't using flow for most parts anyway
What you prefer. If you have something that is mostly done and could be merged into serlo-org/master, feel free to create another PR for that. But we can also make one big PR for that since it doesn't affect the other stuff we are working on. Your call :) |
Exercise logic
Added some logic to one of the exercises (DifferFromSymbol) to be able to select answer and change button colour based on the selected answer and submission status (success/fail). Added actions to exercise-reducer to: select an answer, submit an answer for current exercise. Now instead of generating separate queue of exercises we preserve a course tree.
…n issues for these problems)
All right, I have merged all changes to master, so they were visible here. (It's basically all related to redux store and general app structure)
|
Hey @igorzamyslov. Thanks for the work. I will look into that this weekend. |
Hey @igorzamyslov. Sorry for the late response.
Depends. There are exercises that provide feedback (like your DifferFromSymbol example) after one submits a wrong answer. Those should just be queued again.
My initial design idea was that the logic is done by a higher-order component, see #41, so that the underlying exercise can pass the correct answer to its wrapper (that also keeps track of the state instead of the Redux store). IMHO, it's fine to use the redux store, too (although it's not needed since the "exercise state" is probably only used locally. So go with what you prefer :) ). For example, you could dispatch an action on Other than that, it looks pretty good and it seems like minimal change to the exercises is needed 👍 |
Hey @igorzamyslov. Just wanted to check if there are any updates? |
* serlo_org_master: chore: remove `yarn flow` from README chore: update dependencies, standalone build, run prettier on precommit RoundText: transparent background for Text exercises: LetterRotated (serlo#99) exercise: VideoQuestion (serlo#105) # Conflicts: # .flowconfig # app.json # flow-typed/npm/expo_vx.x.x.js # flow-typed/npm/ramda_vx.x.x.js # flow-typed/npm/react-test-renderer_vx.x.x.js # package.json # yarn.lock
…ure. Merged with the latest version of serlo/master
…icate with parent component (calling changeAnswer) or in this case - redux store
# Conflicts: # flow-typed/npm/expo_vx.x.x.js # flow-typed/npm/ramda_vx.x.x.js # flow-typed/npm/react-native-router-flux_vx.x.x.js # flow-typed/npm/react-test-renderer_vx.x.x.js # package.json # src/actions/exerciseActions.js # src/assets/courses/course.json # src/components/ExerciseLayout.js # src/components/NavigationMenu.js # src/components/NavigationMenu.stories.js # src/components/exercises/DifferFromSymbol.js # src/components/exercises/index.js # src/constants/actionTypes.js # src/containers/ExerciseApp.js # src/containers/ExerciseApp.stories.js # src/index.stories.js # src/reducers/exercise.js # storybook/stories.js
Hello @inyono, The modified exercises are:
The full example could be checked in the It would be great if you could check these components and see if this approach fits you or maybe you have something different in mind :) In due time I will check "Schreiben Sie den Buchstaben" exercise one more time. As far as I remember - it's working in principle, but had a low perfomance. Please write if you will have any questions |
Hey @igorzamyslov. Looks good to me, we can work with that 👍. Is there some stuff left to do for this PR, or are you done from your side? (If so, I'd start integrating this into our current master) |
@inyono, I think that most things are already implemented, let's just recap what was done here:
That's what I've remembered :) Please tell if there is anything that should be implemented / changed here. |
Hey @igorzamyslov. Looks good from my side. The merge with master isn't pushed yet I guess, since GitHub still shows conflicting files? |
hey @inyono, I've checked the history - these files were changed after my last push, so I guess that's the reason of the conflicts, but the thing is - after I've merged them just now I can't start the project anymore, I get: As far as I understand the error occurs on the step, when the app tries to connect to Storybook - any idea why it can be happening? P.S. this error happens on iOS emulator and the hostname it tries to run Storybook on is localhost, on Android emulator it tries to run Storybook on my local network address (192.168...) but after 10 seconds it gives pretty much the same error |
@igorzamyslov Yeah, |
# Conflicts: # package.json # src/components/exercises/DifferFromSymbol.js # src/components/exercises/DifferFromSymbol.stories.js # src/components/exercises/MissingText.js # src/components/exercises/VideoQuestion.js
@inyono, yep, that was the step I was missing, thank you! I'll wait for check to finish and will fix anything that will come up |
@igorzamyslov Thank you very much for your work 🎉 I'll ping you if we run into any issues, but your solutions looks rather solid to me 👍 |
Was glad to help!
Please do :) |
Work by @igorzamyslov and @cognostics 🎉 (ping #77)