Skip to content
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

Projects: Add subject index pages #1875

Merged
merged 3 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getDefaultPageProps from '@helpers/getDefaultPageProps'
export { default } from '@screens/ClassifyPage'

export async function getServerSideProps({ params, query, req, res }) {
const { props: defaultProps } = await getDefaultPageProps({ params, query, req, res })
const { subjectID, subjectSetID, workflowID } = params
const props = { ...defaultProps, subjectID, subjectSetID, workflowID }
return ({ props })
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import getDefaultPageProps from '@helpers/getDefaultPageProps'
export { default } from '@screens/ClassifyPage'

export async function getServerSideProps({ params, query, req, res }) {
const { props: defaultProps } = await getDefaultPageProps({ params, query, req, res })
const { subjectID, workflowID } = params
const props = { ...defaultProps, subjectID, workflowID }
return ({ props })
}
16 changes: 10 additions & 6 deletions packages/app-project/src/screens/ClassifyPage/ClassifyPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ const ClassifierWrapper = dynamic(() =>
import('./components/ClassifierWrapper'), { ssr: false }
)

function ClassifyPage (props) {
const { addToCollection, screenSize, subjectSetID, workflowID, workflows } = props
function ClassifyPage ({
addToCollection,
screenSize,
subjectID,
subjectSetID,
workflowID,
workflows = []
}) {
const responsiveColumns = (screenSize === 'small')
? ['auto']
: ['1em', 'auto', '1em']
Expand All @@ -47,6 +53,7 @@ function ClassifyPage (props) {
<ProjectName />
<ClassifierWrapper
onAddToCollection={addToCollection}
subjectID={subjectID}
subjectSetID={subjectSetID}
workflowID={workflowID}
/>
Expand Down Expand Up @@ -75,13 +82,10 @@ function ClassifyPage (props) {
)
}

ClassifyPage.defaultProps = {
workflows: []
}

ClassifyPage.propTypes = {
addToCollection: func,
screenSize: string,
subjectID: string,
subjectSetID: string,
workflowID: string,
workflows: arrayOf(shape({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ClassifierWrapperContainer extends Component {
}

render () {
const { onAddToCollection, authClient, mode, project, subjectSetID, user, workflowID } = this.props
const { onAddToCollection, authClient, mode, project, subjectID, subjectSetID, user, workflowID } = this.props
const somethingWentWrong = this.state.error || project.loadingState === asyncStates.error

if (somethingWentWrong) {
Expand Down Expand Up @@ -91,6 +91,7 @@ class ClassifierWrapperContainer extends Component {
onCompleteClassification={this.onCompleteClassification}
onToggleFavourite={this.onToggleFavourite}
project={project}
subjectID={subjectID}
subjectSetID={subjectSetID}
workflowID={workflowID}
/>
Expand Down