Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1270 enable eslint on all js files (partially fixed) #1331

Merged
merged 8 commits into from
Aug 31, 2022
55 changes: 29 additions & 26 deletions client/components/main/CookieNotice.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import React from 'react';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/core/styles';
Expand All @@ -15,37 +14,37 @@ import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
const useStyles = makeStyles(theme => ({
root: {
width: 325,
backgroundColor: "#29404F",
backgroundColor: '#29404F',
zIndex: 50000,
position: "absolute",
position: 'absolute',
bottom: 0,
right: 0
right: 0,
},
title: {
paddingTop: 16,
paddingLeft: 16,
...theme.typography.h4
...theme.typography.h4,
},
headStyle: {
padding: 8,
backgroundColor: "#87C8BC",
backgroundColor: '#87C8BC',
},
iconStyle: {
verticalAlign: "bottom"
verticalAlign: 'bottom',
},
copyStyle: {
paddingTop: 5,
paddingTop: 5,
fontSize: 12,
"&:last-child": {
paddingBottom: 5
}
'&:last-child': {
paddingBottom: 5,
},
},
linkStyle: {
padding: 0,
color: "#FFB100",
color: '#FFB100',
marginLeft: 3,
textDecoration: "none"
}
textDecoration: 'none',
},
}));

const CookieNotice = ({
Expand All @@ -61,19 +60,24 @@ const CookieNotice = ({
if (showCookieNotice) {
return (
<Card className={classes.root}>
<CardHeader className={classes.headStyle}></CardHeader>
<CardHeader className={classes.headStyle} />
<div className={classes.title}>
<InfoOutlinedIcon className={classes.iconStyle} fontSize="small"/> Cookies and Privacy Policy<br />
<InfoOutlinedIcon className={classes.iconStyle} fontSize="small" />
{' '}
Cookies and Privacy Policy
<br />
</div>
<CardContent className={classes.copyStyle}>
We use cookies and other tracking technologies to improve your browsing experience and to better understand our website traffic. By browsing our website, you consent to our use of cookies and other tracking technologies.
<Link className={classes.linkStyle} to="/privacy">Learn more</Link>
<CardActions style={{ justifyContent: "flex-end" }}>
<Button variant="outlined" onClick={handleClick} >Got it!</Button>
</CardActions>
</CardContent>

</Card>
<CardContent className={classes.copyStyle}>
We use cookies and other tracking technologies to improve your browsing
experience and to better understand our website traffic. By browsing our
website, you consent to our use of cookies and other tracking technologies.
<Link className={classes.linkStyle} to="/privacy">Learn more</Link>
<CardActions style={{ justifyContent: 'flex-end' }}>
<Button variant="outlined" onClick={handleClick}>Got it!</Button>
</CardActions>
</CardContent>

</Card>
);
}
return null;
Expand All @@ -93,4 +97,3 @@ CookieNotice.propTypes = {
};

export default connect(mapStateToProps, mapDispatchToProps)(CookieNotice);

101 changes: 48 additions & 53 deletions client/components/main/Desktop/TypeSelector/index.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
/* eslint-disable */
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { updateRequestTypes,} from '@reducers/filters';
import { updateRequestTypes } from '@reducers/filters';
import { makeStyles } from '@material-ui/core/styles';

import Grid from '@material-ui/core/Grid';
import FormGroup from '@material-ui/core/FormGroup';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Checkbox from '@material-ui/core/Checkbox';
// import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord';
import useToggle from './isToggle.js';
import useToggle from './isToggle';


const useStyles = makeStyles(theme => ({
const useStyles = makeStyles(() => ({
label: {
display: 'flex',
alignItems: 'center',
fontSize: '12px',
},
}));

const useHeaderStyles = makeStyles(theme => ({
const useHeaderStyles = makeStyles(() => ({
header: {
marginBottom: 5,
display: 'inline-block',
fontFamily: 'Roboto',
}
}))



},
}));

const RequestTypeSelector = ({
requestTypes,
Expand All @@ -56,65 +51,66 @@ const RequestTypeSelector = ({
const checkAll = () => {
toggle(!isToggled);
return !isToggled;
}

const updateAll = (value) =>{
requestTypes.map(type => {
if(selectedTypes[type.typeId] !== value){
updateTypesFilter(type.typeId)
}
})
};

function updateAll(value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're here (I know you didn't write this): nit: value -> isSelected

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all set

requestTypes.forEach(type => {
if (selectedTypes[type.typeId] !== value) {
updateTypesFilter(type.typeId);
}
});
}

return (
<>
<div className={headerClass.header}>Request Types</div>
<Grid container style={{
margin: 'auto',
backgroundColor: '#192730',
borderRadius: '5px',
padding: '5px',
paddingTop: '3px',
paddingBottom: '3px',
}}>
<Grid
container
style={{
margin: 'auto',
backgroundColor: '#192730',
borderRadius: '5px',
padding: '5px',
paddingTop: '3px',
paddingBottom: '3px',
}}
>


<Grid item style={{ width: '50%' }}>
<FormGroup>
{leftCol && leftCol.map(type => (
<FormControlLabel
key={type.typeId}
classes={classes}
control={
<Checkbox
control={(
<Checkbox
style={{
transform: 'scale(0.8)',
color: type.color,
padding: '0 0 0 9px',
}}
checked={selectedTypes[type.typeId]}

onChange={() => updateTypesFilter(type.typeId)}
/>
}
)}
label={type.typeName}
/>
/>
))}
<FormControlLabel
key='all'
<FormControlLabel
key="all"
classes={classes}
control={
<Checkbox
style={{
transform: 'scale(0.8)',
color: 'white',
padding: '0 0 0 9px',
}}
checked={Object.values(selectedTypes).every(val => val) }
onChange={()=>updateAll(checkAll())}
/>
}
label='Select All'
control={(
<Checkbox
style={{
transform: 'scale(0.8)',
color: 'white',
padding: '0 0 0 9px',
}}
checked={Object.values(selectedTypes).every(val => val)}
onChange={() => updateAll(checkAll())}
/>
)}
label="Select All"
/>
</FormGroup>
</Grid>
Expand All @@ -124,20 +120,19 @@ const RequestTypeSelector = ({
<FormControlLabel
key={type.typeId}
classes={classes}
control={
<Checkbox
control={(
<Checkbox
style={{
transform: 'scale(0.8)',
color: type.color,
padding: '0 2px 0 9px',
}}
checked={selectedTypes[type.typeId]}

onChange={() => updateTypesFilter(type.typeId)}
/>
}
)}
label={type.typeName}
/>
/>
))}
</FormGroup>
</Grid>
Expand Down Expand Up @@ -168,4 +163,4 @@ RequestTypeSelector.propTypes = {

RequestTypeSelector.defaultProps = {
requestTypes: null,
};
};
9 changes: 5 additions & 4 deletions client/components/main/Reports.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/self-closing-comp */
import React from 'react';
import { useLocation } from 'react-router-dom';
import { makeStyles } from '@material-ui/core/styles';
Expand Down Expand Up @@ -28,7 +27,6 @@ const Reports = () => {
reportPath = location.pathname.slice(8);
const reportRef = React.useRef(reportPath);

/* eslint-disable consistent-return */
React.useEffect(() => {
if (reportPath !== reportRef.current) {
setIsLoading(true);
Expand All @@ -39,6 +37,10 @@ const Reports = () => {
return () => clearTimeout(timer);
}
reportRef.current = reportPath;

return () => {
// componentWillUnmount code goes here...
};
}, [reportPath, isLoading]);

return (
Expand All @@ -59,8 +61,7 @@ const Reports = () => {
frameBorder="0"
allowFullScreen
style={{ width: '100%', height: '100%' }}
>
</iframe>
/>
</div>
);
};
Expand Down
2 changes: 0 additions & 2 deletions client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable react/jsx-filename-extension */

import 'core-js/stable';
import 'regenerator-runtime/runtime';
import React from 'react';
Expand Down
Loading