This repository has been archived by the owner on Apr 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f60bae
commit 3d0cec3
Showing
11 changed files
with
136 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,24 +1,53 @@ | ||
import React from 'react'; | ||
import faker from 'faker'; | ||
import sample from 'lodash/sample'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import TextAnswers from './text-answers'; | ||
import { QUESTIONS } from '../constants'; | ||
import { StoresProvider } from '../contexts/store-context'; | ||
import { RoleStore } from '../stores/user-stores'; | ||
|
||
export default { title: 'TextAnswers' }; | ||
|
||
export function Random() { | ||
const roleIds = ['role:role1', 'role:role2']; | ||
const roleStore = new RoleStore(); | ||
|
||
const answers = QUESTIONS.filter(({ type }) => { | ||
return type === 'Question'; | ||
}).map(({ question, identifier }) => { | ||
return { | ||
questionId: `question:${identifier}`, | ||
question, | ||
answers: roleIds.map(roleId => { | ||
return { roleId, text: faker.lorem.paragraph() }; | ||
}) | ||
}; | ||
}); | ||
export function Random() { | ||
const actions = ['role:roleId1', 'role:roleId2', 'role:roleId3'].map( | ||
roleId => { | ||
return { | ||
'@type': 'RapidPREreviewAction', | ||
agent: roleId, | ||
actionStatus: 'CompletedActionStatus', | ||
object: 'doi:doi', | ||
resultReview: { | ||
'@type': 'RapidPREreview', | ||
about: [ | ||
{ | ||
'@type': 'OutbreakScienceEntity', | ||
name: sample(['Influenza', 'Dengue', 'Zika']) | ||
} | ||
], | ||
reviewAnswer: QUESTIONS.map(question => { | ||
return { | ||
'@type': | ||
question.type === 'YesNoQuestion' ? 'YesNoAnswer' : 'Answer', | ||
parentItem: `question:${question.identifier}`, | ||
text: | ||
question.type === 'YesNoQuestion' | ||
? sample(['yes', 'no', 'n.a.', 'unsure']) | ||
: faker.lorem.paragraph() | ||
}; | ||
}) | ||
} | ||
}; | ||
} | ||
); | ||
|
||
return <TextAnswers answers={answers} />; | ||
return ( | ||
<Router> | ||
<StoresProvider roleStore={roleStore}> | ||
<TextAnswers actions={actions} /> | ||
</StoresProvider> | ||
</Router> | ||
); | ||
} |
This file contains 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 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 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 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 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