const purposes update

This commit is contained in:
Niqui O'Neill 2020-12-04 09:04:35 -08:00
parent c6d4ba8c45
commit 6aa488690c
2 changed files with 4 additions and 4 deletions

View File

@ -2,16 +2,16 @@ import React from 'preact/compat';
import Comment from './Comment'; import Comment from './Comment';
import TextEntryField from './TextEntryField'; import TextEntryField from './TextEntryField';
import i18n from '../../../i18n'; import i18n from '../../../i18n';
import PurposeDropdown from './PurposeDropdown'; import PurposeDropdown, {purposes} from './PurposeDropdown';
const purposes = ['assessing', 'bookmarking', 'classifying', 'commenting', 'describing', 'editing', 'highlighting', 'identifying', 'linking', 'moderating', 'questioning'] const purposeValues = purposes.map(p => p.value);
/** /**
* Comments are TextualBodies where the purpose field is either * Comments are TextualBodies where the purpose field is either
* blank or 'commenting' or 'replying' * blank or 'commenting' or 'replying'
*/ */
const isComment = body => const isComment = body =>
body.type === 'TextualBody' && ( body.type === 'TextualBody' && (
!body.hasOwnProperty('purpose') || purposes.indexOf(body.purpose) > -1 !body.hasOwnProperty('purpose') || purposeValues.indexOf(body.purpose) > -1
); );
/** /**

View File

@ -1,7 +1,7 @@
import React, { Component } from 'preact/compat'; import React, { Component } from 'preact/compat';
import Select from 'react-select'; import Select from 'react-select';
const purposes = [{'value': 'assessing', 'label': 'Assessing'}, {'value': 'bookmarking', 'label': 'Bookmarking'}, {'value': 'classifying', 'label': 'Classifying'}, {'value': 'commenting', 'label': 'Commenting'}, {'value': 'describing', 'label': 'Describing'},{'value': 'editing', 'label': 'Editing'}, {'value': 'highlighting', 'label': 'Highlighting'},{'value': 'identifying', 'label': 'Identifying'},{'value': 'linking', 'label': 'Linking'},{'value': 'moderating', 'label': 'Moderating'},{'value': 'questioning', 'label': 'Questioning'}] export const purposes = [{'value': 'assessing', 'label': 'Assessing'}, {'value': 'bookmarking', 'label': 'Bookmarking'}, {'value': 'classifying', 'label': 'Classifying'}, {'value': 'commenting', 'label': 'Commenting'}, {'value': 'describing', 'label': 'Describing'},{'value': 'editing', 'label': 'Editing'}, {'value': 'highlighting', 'label': 'Highlighting'},{'value': 'identifying', 'label': 'Identifying'},{'value': 'linking', 'label': 'Linking'},{'value': 'moderating', 'label': 'Moderating'},{'value': 'questioning', 'label': 'Questioning'}]
export default class PurposeDropdown extends Component { export default class PurposeDropdown extends Component {
render() { render() {