Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
required and layout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sballesteros committed Nov 6, 2019
1 parent bcc4846 commit db0a55b
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 27 deletions.
8 changes: 7 additions & 1 deletion deploy-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ zip -r app.zip *.json *.js dist/* src/* public/* views/* scripts/* test/*

az webapp config appsettings set --resource-group "rapid-prereview" --name "rapid-prereview" --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true

az webapp config set --resource-group "rapid-prereview" --name "rapid-prereview" --startup-file "npm run start:prod"

## https://docs.microsoft.com/en-us/azure/app-service/containers/configure-language-nodejs#run-with-pm2

# az webapp config set --resource-group "rapid-prereview" --name "rapid-prereview" --startup-file "npm run start:prod"

# Azure App service will start the file with pm2
az webapp config set --resource-group "rapid-prereview" --name "rapid-prereview" --startup-file "./dist/server.js"

az webapp deployment source config-zip --resource-group "rapid-prereview" --name "rapid-prereview" --src app.zip

Expand Down
2 changes: 1 addition & 1 deletion src/components/extension-splash.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
margin: 0 auto;
background-color: white;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.15);
min-height: 100vh;
min-height: calc(100vh - var(--header-bar-height) - 2*var(--lgrd));
padding: var(--mgrd) var(--xlgrd);
box-sizing: border-box;
position: relative;
Expand Down
6 changes: 5 additions & 1 deletion src/components/header-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ export default function HeaderBar({ onClickMenuButton }) {
<div className="header-bar__left">
{!!onClickMenuButton && (
<IconButton
data-noclickoutside="true"
onClick={onClickMenuButton}
className="header-bar__menu-button"
>
<MdMenu className="header-bar__menu-button-icon" />
<MdMenu
className="header-bar__menu-button-icon"
data-noclickoutside="true"
/>
</IconButton>
)}
<RapidPreReviewLogo />
Expand Down
2 changes: 1 addition & 1 deletion src/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Home() {
/>
)}
<HeaderBar
onClickMenuButton={() => {
onClickMenuButton={e => {
setShowLeftPanel(!showLeftPanel);
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
height: var(--lgrd);
width: var(--lgrd);
cursor: pointer;
flex: 0 0 var(--lgrd);
/*flex: 0 0 var(--lgrd);*/

&:focus {
outline: none;
Expand Down
7 changes: 5 additions & 2 deletions src/components/left-side-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ export default function LeftSidePanel({
// inside click
return;
}
// outside click
onClickOutside();

if (!e.target.hasAttribute('data-noclickoutside')) {
// outside click
onClickOutside();
}
}

if (visible) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/profile.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
margin: 0 auto;
background-color: white;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.15);
min-height: 100vh;
min-height: calc(100vh - var(--header-bar-height) - 2*var(--lgrd));
}

& .profile__header {
Expand Down
12 changes: 9 additions & 3 deletions src/components/rapid-form-fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
);

const [isOpenedMap, setIsOpenedMap] = useState(
yesNoQuestions.map((map, q) => {
yesNoQuestions.reduce((map, q) => {
map[q.identifier] = false;
return map;
}, {})
Expand All @@ -28,7 +28,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
return (
<div className="rapid-form-fragment">
<fieldset className="rapid-form-fragment__multi-choice-questions">
{yesNoQuestions.map(({ identifier, question, help }, i) => {
{yesNoQuestions.map(({ identifier, question, help, required }, i) => {
const answer = answerMap[identifier];

return (
Expand All @@ -41,6 +41,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
<IconButton
className="radid-form-fragment__help"
onClick={e => {
e.preventDefault();
setIsOpenedMap(
Object.assign({}, isOpenedMap, {
[identifier]: !isOpenedMap[identifier]
Expand All @@ -55,6 +56,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {

<div className="rapid-form-fragment__radio-group">
<RadioButton
required={required}
inputId={`question-${identifier}-yes`}
name={identifier}
value="yes"
Expand All @@ -66,6 +68,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
/>

<RadioButton
required={required}
inputId={`question-${identifier}-no`}
name={identifier}
value="no"
Expand All @@ -77,6 +80,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
/>

<RadioButton
required={required}
inputId={`question-${identifier}-na`}
name={identifier}
value="n.a."
Expand All @@ -88,6 +92,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
/>

<RadioButton
required={required}
inputId={`question-${identifier}-unsure`}
name={identifier}
value="unsure"
Expand Down Expand Up @@ -118,7 +123,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
<hr className="rapid-form-fragment__divider" />

<fieldset className="rapid-form-fragment__text-response-questions">
{freeFormQuestions.map(({ identifier, question }) => {
{freeFormQuestions.map(({ identifier, question, required }) => {
const answer = answerMap[identifier];

return (
Expand All @@ -135,6 +140,7 @@ export default function RapidFormFragment({ answerMap = {}, onChange }) {
</Value>

<textarea
required={required}
className="radid-form-fragment__text-answer"
id={`question-${identifier}`}
name={identifier}
Expand Down
5 changes: 3 additions & 2 deletions src/components/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
box-sizing: border-box;
font: var(--ui-basic-font);
margin: 0;
min-height: 100vh;
min-height: calc(100vh);
padding: calc(var(--header-bar-height) + var(--lgrd)) 0 var(--lgrd);
box-sizing: border-box;

Expand All @@ -14,8 +14,9 @@
margin: 0 auto;
background-color: white;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.15);
min-height: 100vh;
min-height: calc(100vh - var(--header-bar-height) - 2*var(--lgrd));
}

& .settings__title {
margin: 0 0 var(--mgrd) 0;
font: var(--ui-header-1-font);
Expand Down
40 changes: 27 additions & 13 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// See https://github.com/PREreview/rapid-prereview/issues/6
// When possible questions are written so that yes means "the preprint is good"
export const QUESTIONS = [
{
identifier: 'ynNovel',
question: 'Are the findings novel?',
help:
'In your judgement, does the manuscript have information that has not been previously known or published?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
Expand All @@ -14,37 +16,42 @@ export const QUESTIONS = [
'Are the principal conclusions supported by the data and analysis?',
help:
'Is there sufficient evidence to support the key findings of the manuscript?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynFuture',
question: 'Are the results likely to lead to future research?',
help:
'Do the data, findings, or analysis point to clear directions for additional research?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynEthics',
question: 'Have the authors adequately discussed ethical concerns',
help:
'For example, if a human study, is Institutional Review Board (IRB) approval presented?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynLimitations',
question: 'Does the manuscript discuss limitations?',
help: 'Are the most important limitations clearly presented?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynNewData',
question: 'Does the manuscript include new data?',
help: 'Were data collected or made available specifically for this study?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

//
Expand All @@ -54,44 +61,51 @@ export const QUESTIONS = [
question: 'Are the data used in the manuscript available?',
help:
'In the paper, supplement, on a public repository, or from a cited source?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},
{
identifier: 'ynAvailableCode', // DO NOT CHANGE THIS IS USED IN THE INDEX (or update everywhere)
indexed: true,
question: 'Is the code used in the manuscript available?',
help:
'In the paper, supplement, on a public repository, or from a cited source?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

//
{
identifier: 'ynReproducibility',
question: 'Is sufficient detail provided allow reproduction of the study?',
type: 'YesNoQuestion'
question:
'Is sufficient detail provided to allow reproduction of the study?',
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynMethods',
question: 'Are the methods and statistics appropriate for the analysis?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynRecommend',
question: 'Would you recommend this manuscript to others?',
help:
'Consider any possible audience: scientists in the same field or others, policy makers, the public, etc.',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

{
identifier: 'ynPeerReview',
question: 'Do you recommend this manuscript for peer review?',
help:
'Would you recommend this manuscript to a journal editor for formal peer review?',
type: 'YesNoQuestion'
type: 'YesNoQuestion',
required: true
},

//
Expand Down
4 changes: 3 additions & 1 deletion src/utils/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export function getReviewAnswers(answerMap = {}) {
}

export function checkIfAllAnswered(answerMap = {}) {
return QUESTIONS.every(({ identifier }) => answerMap[identifier]);
return QUESTIONS.every(
({ identifier, required }) => !required || answerMap[identifier]
);
}

export function checkIfHasReviewed(
Expand Down

0 comments on commit db0a55b

Please sign in to comment.