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

WIP: Chipping away at enabling users to add tags when requesting a review #108

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 6 additions & 0 deletions src/components/diseases.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,10 @@
position: absolute;
z-index: 10000000;
}

& .diseases__featured {
border: 1px solid var(--ruling-color);

}
}

2 changes: 1 addition & 1 deletion src/components/diseases.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Diseases({ onSubmit, blacklist = [] }) {
>
<ComboboxList persistSelection={true}>
{sorted.map(subject => (
<ComboboxOption key={subject.name} value={format(subject)} />
<ComboboxOption className={subject.featured ? "diseases__featured" : ""} key={subject.name} value={format(subject)} />
))}
</ComboboxList>
</ComboboxPopover>
Expand Down
5 changes: 5 additions & 0 deletions src/components/facets.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
& input {
width: 2em;
}

&-featured {
color: var(--prereview-red);
font-weight: bold;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/facets.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default function Facets({ counts = {}, ranges = {}, isFetching }) {
isFetching || !(counts.subjectName || {})[subject.name]
}
label={
<span className="facets__facet-label">
<span className={`facets__facet-label ${subject.featured ? "facets__facet-label-featured" : ""}`}>
{subject.alternateName ? (
<abbr title={subject.name}>{subject.alternateName}</abbr>
) : (
Expand Down
37 changes: 35 additions & 2 deletions src/components/new-preprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export default function NewPreprint({
onCancel={onCancel}
onStep={setStep}
onIdentifier={(identifier, url = null) => {
console.log({ identifier, url });
setIdentifierAndUrl({ identifier, url });
}}
identifier={identifier}
Expand Down Expand Up @@ -339,6 +338,9 @@ function StepReview({
createPreprintId(preprint),
[]
);
console.log(subjects)


const [answerMap, setAnswerMap] = useLocalState(
'answerMap',
user.defaultRole,
Expand Down Expand Up @@ -457,13 +459,37 @@ function StepRequest({
}) {
const [user] = useUser();
const [post, postData] = usePostAction();
const [subjects, setSubjects] = useLocalState(
'subjects',
user.defaultRole,
createPreprintId(preprint),
[]
);

return (
<div className="new-preprint__step-request">
<header className="new-preprint__title">Confirm Review Request</header>

<PreprintPreview preprint={preprint} />

<SubjectEditor
subjects={subjects}
onAdd={subject => {
setSubjects(
subjects.concat(subject).sort((a, b) => {
return (a.alternateName || a.name).localeCompare(
b.alternateName || b.name
);
})
);
}}
onDelete={subject => {
setSubjects(
subjects.filter(_subject => _subject.name !== subject.name)
);
}}
/>

<Controls error={postData.error} className="new-preprint__button-bar">
<Button
onClick={e => {
Expand Down Expand Up @@ -493,7 +519,14 @@ function StepRequest({
agent: user.defaultRole,
object: Object.assign({}, nodeify(preprint), {
'@id': createPreprintIdentifierCurie(preprint)
})
}),
resultReview: cleanup(
{
'@type': 'RapidPREreview',
about: subjects,
},
{ removeEmptyArray: true }
)
},
onSuccess
);
Expand Down
12 changes: 6 additions & 6 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export const INDEXED_PREPRINT_PROPS = [

// See https://github.com/PREreview/rapid-prereview/issues/10
export const DISEASES = [
{
name: '2019 novel coronavirus',
alternateName: 'COVID-19',
priority: 'red',
featured: true
},
{
name: 'Chikungunya',
priority: 'orange'
Expand Down Expand Up @@ -201,12 +207,6 @@ export const DISEASES = [
priority: 'red'
},

{
name: '2019 novel coronavirus',
alternateName: '2019-nCoV',
priority: 'red'
},

{
name: 'Plague',
priority: 'yellow'
Expand Down
37 changes: 36 additions & 1 deletion src/schemas/request-for-rapid-prereview-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,45 @@ const schema = {
required: ['@id']
}
]
},
resultRequest: {
type: 'object',
properties: {
'@id': {
type: 'string',
pattern: '^node:|^_:'
},
'@type': {
type: 'string',
const: 'RequestForRapidPREreview'
},
dateCreated: {
type: 'string',
format: 'date-time'
},
about: {
type: 'array',
description: 'subjects from list of infectious diseases',
items: {
type: 'object',
properties: {
'@type': {
type: 'string',
const: 'OutbreakScienceEntity'
},
name: {
type: 'string'
}
}
}
},
},
additionalProperties: false,
required: ['@type']
}
},
additionalProperties: false,
required: ['@type', 'actionStatus', 'agent', 'object']
required: ['@type', 'actionStatus', 'agent', 'object', 'resultRequest']
};

export default schema;