From 6aa488690ce7d33d06723af818210212c5c1178c Mon Sep 17 00:00:00 2001 From: Niqui O'Neill Date: Fri, 4 Dec 2020 09:04:35 -0800 Subject: [PATCH] const purposes update --- src/editor/widgets/comment/CommentWidget.jsx | 6 +++--- src/editor/widgets/comment/PurposeDropdown.jsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/editor/widgets/comment/CommentWidget.jsx b/src/editor/widgets/comment/CommentWidget.jsx index f6e168d..5103bc8 100644 --- a/src/editor/widgets/comment/CommentWidget.jsx +++ b/src/editor/widgets/comment/CommentWidget.jsx @@ -2,16 +2,16 @@ import React from 'preact/compat'; import Comment from './Comment'; import TextEntryField from './TextEntryField'; 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 * blank or 'commenting' or 'replying' */ const isComment = body => body.type === 'TextualBody' && ( - !body.hasOwnProperty('purpose') || purposes.indexOf(body.purpose) > -1 + !body.hasOwnProperty('purpose') || purposeValues.indexOf(body.purpose) > -1 ); /** diff --git a/src/editor/widgets/comment/PurposeDropdown.jsx b/src/editor/widgets/comment/PurposeDropdown.jsx index 2258283..1821301 100644 --- a/src/editor/widgets/comment/PurposeDropdown.jsx +++ b/src/editor/widgets/comment/PurposeDropdown.jsx @@ -1,7 +1,7 @@ import React, { Component } from 'preact/compat'; 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 { render() {