Skip to content

Commit

Permalink
Merge branch 'eslint-update' into 'master'
Browse files Browse the repository at this point in the history
eslint Update

See merge request inq-seeds/boilerplate!99
  • Loading branch information
benloh committed Oct 12, 2020
2 parents 6ccdf14 + 4a08c08 commit f26d3ba
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 50 deletions.
18 changes: 9 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"es6": true,
"node": true
},
"plugins": ["import", "prettier", "react"],
"extends": ["airbnb", "prettier", "prettier/react"],
"globals": {
"PACKAGE_TITLE": "readonly", // injected by webpack
"PACKAGE_VERSION": "readonly", // injected by webpack
"PACKAGE_DESCRIPTION":"readonly", // injected by webpack
"__static":"readonly" // injected by webpack
},
"parserOptions": {
"ecmaVersion": 2018,
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"globals":{
"PACKAGE_TITLE": "readonly",
"PACKAGE_VERSION": "readonly",
"PACKAGE_DESCRIPTION": "readonly",
"__static": "readonly"
},
"plugins": ["import", "prettier", "react"],
},
"rules": {
"prettier/prettier": ["warn"],
"no-console": "off",
Expand All @@ -32,7 +32,7 @@
"extensions": [".js", ".jsx"]
}
],
"no-unused-vars": "warn",
"no-unused-vars": "off",
"arrow-body-style": "off",
"react/destructuring-assignment": "off",
"react/jsx-one-expression-per-line": "off",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ Thumbs.db

# Ignore JetBrains' IDEs
.idea
data
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.wordWrap": "off"
}
},
"eslint.workingDirectories": [
{
"mode": "auto"
}
]
}
18 changes: 17 additions & 1 deletion src/app-web/components/HelpView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ Evidence Links should describe how a resource supports or contradicts your model
###### Add a Comment
1. Click on the comment icon
---`,
credittext: `###### About MEME:
**About** -- The Model and Evidence Mapping Environment (**MEME**) was developed as part of the Scaffolding Explanations and Epistemic Development for Systems (**SEEDS**) project, a collaborative project that was funded by the National Science Foundation under award [1761019](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1761019&HistoricalAwards=false) to Joshua Danish, Ravit Duncan, Cindy Hmelo-Silver and Clark Chinn.
**Design** -- The software design team included Joshua Danish, Ravit Duncan, Cindy Hmelo-Silver,
Clark Chinn, Zachary Ryan, Na'ama Av-Shalom, Mimi Moreland, Morgan Vickery, Danielle
Murphy and Christina Stiso. Software development was provided by [Inquirium](http://www.inquirium.net).
**Citation** -- Please cite the MEME software as The Modeling and Evidence Mapping Environment
(MEME) Software (2019) Danish, Duncan, Hmelo-Silver, Chinn, Ryan, Av-Shalom,
Moreland, Vickery, Murphy, Stiso.
**Contact** -- For more information, contact Joshua Danish at [[email protected]](mailto:[email protected]?subject=MEME) or [http://www.joshuadanish.com](http://www.joshuadanish.com).
`
};

Expand All @@ -113,7 +128,7 @@ Evidence Links should describe how a resource supports or contradicts your model
}

render() {
const { isOpen, helptext } = this.state;
const { isOpen, helptext, credittext } = this.state;
const { classes } = this.props;
const criteria = ADM.GetCriteriaByModel(); // always use the current model's criteria

Expand All @@ -133,6 +148,7 @@ Evidence Links should describe how a resource supports or contradicts your model
<h6>Criteria</h6>
<CriteriaList Criteria={criteria} IsInEditMode={false} />
<MDReactComponent className={classes.helpViewText} text={helptext} />
<MDReactComponent className={classes.helpViewText} text={credittext} />
</div>
</Paper>
</Draggable>
Expand Down
15 changes: 12 additions & 3 deletions src/app-web/components/MEMEStyles.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { blue, green, grey, indigo, orange, purple, red, teal, yellow } from '@material-ui/core/colors';
import {
blue,
green,
grey,
indigo,
orange,
purple,
red,
teal,
yellow
} from '@material-ui/core/colors';
import { registerMorphableType } from '@svgdotjs/svg.js/src/main';
import { Hidden } from '@material-ui/core';
import DEFAULTS from '../modules/defaults';
Expand Down Expand Up @@ -570,8 +580,7 @@ const styles = theme => {
cursor: 'default'
},
stickynoteCardCriteriaDescription: {
color: m_systemTextColor,
fontStyle: 'italic',
color: '#000',
marginBottom: '0.66em'
},
helpViewPaper: {
Expand Down
19 changes: 14 additions & 5 deletions src/app-web/components/StickyNote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import UR from '../../system/ursys';
import ADM from '../modules/data';
import PMC from '../modules/pmc-data';
import ASET from '../modules/adm-settings';
import MDReactComponent from 'markdown-react-js';

/// CLASS DECLARATION /////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -119,7 +120,8 @@ class StickyNote extends React.Component {
let allowedToEdit = isAuthor && !isDBReadOnly;
let allowedToDelete = (isAuthor || isTeacher) && !isDBReadOnly; // REVIEW: Only teachers are allowed to delete?
if (comment.text === '') {
if (comment.author.toUpperCase() === ADM.GetAuthorId()) { // force UpperCase for backward compatibility
if (comment.author.toUpperCase() === ADM.GetAuthorId()) {
// force UpperCase for backward compatibility
// automatically turn on editing if this is a new empty comment
// AND we are the author
this.DoEditStart();
Expand Down Expand Up @@ -177,7 +179,8 @@ class StickyNote extends React.Component {
} else {
// just mark read
// but first make sure the comment is valid (has been saved and already established an id)
if (comment.id === undefined) throw Error('StickyNote.DoSave trying to mark read a comment with no id', comment.text);
if (comment.id === undefined)
throw Error('StickyNote.DoSave trying to mark read a comment with no id', comment.text);
PMC.DB_MarkRead(comment.id, author);
}
}
Expand Down Expand Up @@ -349,7 +352,9 @@ class StickyNote extends React.Component {
<Grid container>
<Grid item xs={3}>
<Typography variant="subtitle2" className={classes.stickynoteCardAuthor}>
{`${ADM.GetStudentName(comment.author)} ${ADM.GetGroupNameByStudent(comment.author)}`}
{`${ADM.GetStudentName(comment.author)} ${ADM.GetGroupNameByStudent(
comment.author
)}`}
</Typography>
<Typography variant="caption" className={classes.stickynoteCardLabel}>
{`${timestring}`}
Expand All @@ -363,8 +368,12 @@ class StickyNote extends React.Component {
<div className={classes.stickynoteCardCriteria} title={criteriaDescription}>
{criteriaDisplay}
</div>
<div hidden={!isBeingEdited} className={classes.stickynoteCardCriteriaDescription}>
{criteriaDescription}
<div hidden={!isBeingEdited}>
<MDReactComponent
className={classes.stickynoteCardCriteriaDescription}
text={criteriaDescription}
markdownOptions={{ html: true, typographer: true, linkify: true, breaks: true }}
/>
</div>
</div>
<MuiThemeProvider theme={theme}>
Expand Down
21 changes: 17 additions & 4 deletions src/app-web/modules/adm-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * //////////////////////////////////////*/

import DEFAULTS from './defaults';
import UR from '../../system/ursys';
import SESSION from '../../system/common-session';

/// DECLARATIONS //////////////////////////////////////////////////////////////
Expand All @@ -20,6 +18,7 @@ class ADMSettings {
constructor() {
this.clear();
}

// utility
clear() {
this.sTeacherId = ''; // an id
Expand All @@ -30,40 +29,51 @@ class ADMSettings {
this.sClassroomId = ''; // set from login token
this.sStudentGroupId = ''; // set from login token
}
// getters

/// GETTERS /////////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
get selectedTeacherId() {
if (DBG) console.log('get teacherId', this.sTeacherId, typeof this.sTeacherId);
return this.sTeacherId;
}

get selectedClassroomId() {
if (DBG) console.log('get classroomId', this.sClassroomId, typeof this.sClassroomId);
return this.sClassroomId;
}

get selectedStudentId() {
if (DBG) console.error('get sStudentId', this.sStudentId, typeof this.sStudentId);
return this.sStudentId;
}

get selectedModelId() {
if (DBG) console.log('sModelId', this.sModelId, typeof this.sModelId);
return this.sModelId;
}

get selectedPMCDataId() {
if (DBG) console.log('sPMCDataId', this.sPMCDataId, typeof this.sPMCDataId);
return this.sPMCDataId;
}

get selectedGroupId() {
if (DBG) console.log('get sStudentGroupId', this.sStudentGroupId, typeof this.sStudentGroupId);
return this.sStudentGroupId;
}
// setters

/// SETTERS /////////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set selectedTeacherId(id) {
// use SESSION.LoggedInProps() to pull specific data
this.sTeacherId = id;
// teacherId is set to '' to log out.
}

set selectedClassroomId(id) {
this.sClassroomId = id;
}

set selectedStudentId(id) {
this.sStudentId = id;
// studentId is set to '' to log out.
Expand All @@ -74,12 +84,15 @@ class ADMSettings {
this.sStudentGroupId = groupId;
}
}

set selectedModelId(id) {
this.sModelId = id;
}

set selectedPMCDataId(id) {
this.sPMCDataId = id;
}

} // class

/// CREATE INSTANCE ///////////////////////////////////////////////////////////
Expand Down
10 changes: 3 additions & 7 deletions src/app-web/modules/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import PMC from './pmc-data';
import VM from './vm-data';
import UR from '../../system/ursys';
import DATAMAP from '../../system/common-datamap';
import SESSION from '../../system/common-session';
import ASET from './adm-settings';

/// CONSTANTS /////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -55,9 +54,8 @@ UR.Hook(__dirname, 'INITIALIZE', () => {

/// DECLARATIONS //////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/// clone ADMData, PMC, VM into $ object
const $$$ = Object.assign({}, { ...ADM }, { ...PMC }, { ...VM });
const NEW = {};
/// clone ADMData, PMC, VM into $ object

/// NEW METHOD PROTOTYPING AREA ///////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -73,13 +71,11 @@ $$$.PMC_IsDifferentPropParent = (propId, newParentId) => {
O V E R R I D E
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
O T H E R
O V E R R I D E S
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


/// DEBUG /////////////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (!window.ur) window.ur = {};
Expand Down Expand Up @@ -156,14 +152,14 @@ window.ur.tpropa = name => {
// test login
window.ur.Login = token => {
$$$.Login(token).then(rdata => {
ur.clientinfo();
window.ur.clientinfo();
});
return 'logging in...';
};
// test logout
window.ur.Logout = () => {
$$$.Logout().then(rdata => {
ur.clientinfo();
window.ur.clientinfo();
});
return 'logging out...';
};
Expand Down
10 changes: 9 additions & 1 deletion src/app-web/views/ViewAdmin/components/AdmCriteriaList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { withStyles } from '@material-ui/core/styles';
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import MEMEStyles from '../../../components/MEMEStyles';
import UR from '../../../../system/ursys';
import MDReactComponent from 'markdown-react-js';

/// DECLARATIONS //////////////////////////////////////////////////////////////
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -73,6 +74,8 @@ class CriteriaList extends React.Component {
<TextField
value={crit.description}
placeholder="Description"
multiline
rows={2}
style={{ width: '20em' }}
onChange={e => UpdateField(crit.id, 'description', e.target.value)}
/>
Expand All @@ -86,7 +89,12 @@ class CriteriaList extends React.Component {
) : (
<TableRow key={crit.id}>
<SmTableCell>{crit.label}</SmTableCell>
<SmTableCell>{crit.description}</SmTableCell>
<SmTableCell>
<MDReactComponent
text={crit.description}
markdownOptions={{ html: true, typographer: true, linkify: true, breaks: true }}
/>
</SmTableCell>
</TableRow>
)
)}
Expand Down
Loading

0 comments on commit f26d3ba

Please sign in to comment.