Skip to content

Segregate Playground and Assessment Workspaces #137

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

Merged
merged 46 commits into from
Jun 28, 2018
Merged

Conversation

remo5000
Copy link
Contributor

@remo5000 remo5000 commented Jun 26, 2018

Features

  • Playground and Assessment have separate Workspaces in the redux state
  • Workspace is now stateless (not connected)

TODO

  • The display function needs to pass in a location argument, to be kept in the Context
  • The Assessments Workspace does not allow editing of the Editor code (forced to be the solution template)
  • The slice of the state for the Assessment's workspace must get reset every time one switches away from the question (e.g when they go to the menu, or when they go to the next question)

remo5000 added 26 commits June 25, 2018 15:05
I will add this back as an OwnProps property, passed by either Assessment or
Playground
Added an additional parameter to denote the location of the action call.
Due to the workspace's input and dispatch being determined by the
context, they can be passed in as props by Assessment or Playground.
Also fixed some errors picked up at compilation time.
For some reason the member-ordering linting does not pass despite
proper(?) ordering. I'll open an issue for this.
This holds the 2 instances of IWorkspaceState, playground and
assessment. I've also added a scaffold of how the reducer function would
work, given a location. The location (type WorkspaceLocation) is now
specified to correspond to the key of the IWorkspaceState within the
IWorkspaceManagerState.
Also made some interpreter actions to include location
- Removed cached editorValue
- Renamed IState.workspace into workspaces
- Fixed a typo
Also added a missing handleChangeActiveTab
For some reason, the spread and rest operators did not work with the
varying argument lengths. I proceeded to change them to a manual
currying. Also fixed a bug with the argument type for
handleEditorWidthChange.
@remo5000 remo5000 requested a review from ning-y June 26, 2018 11:38
type: actionTypes.HANDLE_CONSOLE_LOG,
payload: log
payload: { log, workspaceLocation }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logString is more descriptive imo

* Note that the names must correspond with the name of the
* object in IWorkspaceManagerState.
*/
export type WorkspaceLocation = 'assessment' | 'playground'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use values from the enum instead of string literals?

editorWidth: string
output: InterpreterOutput[]
replValue: string
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a lot of properties here, I think they could be alphabeticalised

@remo5000
Copy link
Contributor Author

Thanks for the quick review, have applied the changes 👍. I'll start on the other features now.

remo5000 added 10 commits June 27, 2018 11:17
This allows the "presetting" of values like in the case of a
solutionTemplate. However, it also forces any component to provide such
a value, thus I have added a template string for playground.
- For IStateProps, the properties I was assigning to were optional,
meaning that the linting did not catch the error. I overcame this by
storing and casting the return value.
- Made a mistake in using es6 object literal notation in the reducer, as
the property name was not as expected.
@remo5000
Copy link
Contributor Author

@ningyuansg I've added the "reset" feature. Do you think I could afford to keep currentAssessmentId and currentQuestionId in a tuple instead of separate properties?

editorWidth: '50%',
isRunning: false,
output: [],
replValue: '',
sideContentActiveTab: 0,
sideContentHeight: undefined,
sideContentHeight: 60,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause overflow? A fresh workspace should render such that the side content takes up a size that is just big enough to prevent overflow of its contents.

@@ -15,7 +16,7 @@ function* mainSaga() {
yield* apiFetchSaga()
yield* interpreterSaga()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider renaming as workspaceSaga

@ning-y
Copy link
Member

ning-y commented Jun 27, 2018

Properties are more readable imo. Not sure about efficiency.

@remo5000
Copy link
Contributor Author

Changes made! @ningyuansg

@ning-y ning-y merged commit de365d8 into master Jun 28, 2018
@ning-y
Copy link
Member

ning-y commented Jun 28, 2018

Really big PR, gonna merge this in first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants