no-unused-vars and egegeg for these files

This commit is contained in:
Kent Brockman 2022-07-12 21:14:23 -06:00
parent b61a34eef8
commit 0476df3388
9 changed files with 27 additions and 38 deletions

View File

@ -1,12 +1,11 @@
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom';
import { useHistory } from 'react-router-dom';
import * as loadImage from 'blueimp-load-image';
import ReactCrop from 'react-image-crop';
import 'react-image-crop/dist/ReactCrop.css';
import './light.css';
import { Button, Container, Checkbox, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { BasicTable, staticUrl, requester, randomString } from './utils.js';
import { LoginForm, SignupForm } from './LoginSignup.js';
import { Button, Container, Form, Grid, Header, Message, Segment } from 'semantic-ui-react';
import { requester, randomString } from './utils.js';
function LogoutEverywhere(props) {
const { token } = props;
@ -59,7 +58,6 @@ function ChangePasswordForm(props) {
const history = useHistory();
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
const handleUpload = (e, v) => setInput({ ...input, [v.name]: e.target.files[0] });
const handleChange = (e) => handleValues(e, e.currentTarget);
const handleSubmit = (e) => {

View File

@ -1,12 +1,11 @@
import React, { useState, useEffect, useReducer } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom';
import { Link, useHistory } from 'react-router-dom';
import './light.css';
import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { Button, Container, Checkbox, Form, Header, Icon, Table } from 'semantic-ui-react';
import * as Datetime from 'react-datetime';
import moment from 'moment-timezone';
import download from 'downloadjs';
import { apiUrl, statusColor, BasicTable, staticUrl, requester } from './utils.js';
import { NotFound } from './Misc.js';
import { apiUrl, statusColor, requester } from './utils.js';
let vettingCache = false;
let historyCache = false;
@ -15,7 +14,7 @@ let focusCache = false;
export function AdminVet(props) {
const { token, user, member, refreshVetting } = props;
const { token, member, refreshVetting } = props;
const [loading, setLoading] = useState(false);
const [yousure, setYousure] = useState(false);
@ -49,7 +48,7 @@ export function AdminVet(props) {
}
export function AdminVetting(props) {
const { token, user } = props;
const { token } = props;
const [vetting, setVetting] = useState(vettingCache);
const [refreshCount, refreshVetting] = useReducer(x => x + 1, 0);
const [error, setError] = useState(false);

View File

@ -1,11 +1,10 @@
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
import './light.css';
import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { Button, Checkbox, Dimmer, Form, Header, Icon, Image, Segment, Table } from 'semantic-ui-react';
import moment from 'moment-timezone';
import { statusColor, BasicTable, staticUrl, requester } from './utils.js';
import { TrainingList } from './Training.js';
import { NotFound } from './Misc.js';
function AdminCardDetail(props) {
const { token, result, card } = props;
@ -17,9 +16,7 @@ function AdminCardDetail(props) {
const id = card.id;
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
const handleUpload = (e, v) => setInput({ ...input, [v.name]: e.target.files[0] });
const handleChange = (e) => handleValues(e, e.currentTarget);
const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked });
const handleSubmit = (e) => {
if (loading) return;
@ -142,7 +139,6 @@ export function AdminMemberCards(props) {
}, [result.member]);
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
const handleUpload = (e, v) => setInput({ ...input, [v.name]: e.target.files[0] });
const handleChange = (e) => handleValues(e, e.currentTarget);
const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked });
@ -177,7 +173,7 @@ export function AdminMemberCards(props) {
const checkAutoscan = () => {
getAutoscan().then(newScan => {
if (newScan != prevAutoscan) {
if (newScan !== prevAutoscan) {
prevAutoscan = newScan;
setInput({ ...input, card_number: newScan });
}
@ -416,7 +412,6 @@ export function AdminMemberForm(props) {
}, [result.member]);
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
const handleUpload = (e, v) => setInput({ ...input, [v.name]: e.target.files[0] });
const handleChange = (e) => handleValues(e, e.currentTarget);
const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked });

View File

@ -1,10 +1,10 @@
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
import './light.css';
import { Button, Label, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { Button, Label, Container, Header, Segment, Table } from 'semantic-ui-react';
import moment from 'moment-timezone';
import { isInstructor, getInstructor, requester } from './utils.js';
import { NotFound, PleaseLogin } from './Misc.js';
import { NotFound } from './Misc.js';
import { InstructorCourseList, InstructorCourseDetail } from './InstructorCourses.js';
import { InstructorClassList } from './InstructorClasses.js';

View File

@ -1,5 +1,5 @@
import React, { useRef, useEffect } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useLocation } from 'react-router-dom';
import { BrowserRouter as Link } from 'react-router-dom';
import { Container, Icon } from 'semantic-ui-react';
import { scene } from './spaceport/scene';

View File

@ -1,12 +1,12 @@
import React, { useState, useEffect, useRef } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
import ReactToPrint from 'react-to-print';
import * as Datetime from 'react-datetime';
import 'react-datetime/css/react-datetime.css';
import moment from 'moment-timezone';
import './light.css';
import { Button, Container, Checkbox, Divider, Dropdown, Form, Grid, Header, Icon, Image, Label, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { BasicTable, staticUrl, requester } from './utils.js';
import { Button, Checkbox, Form, Grid, Header, Icon, Label, Message, Table } from 'semantic-ui-react';
import { requester } from './utils.js';
import { MembersDropdown } from './Members.js';
class AttendanceSheet extends React.Component {
@ -72,7 +72,7 @@ function AttendanceRow(props) {
const handleMark = (newStatus) => {
if (loading) return;
if (student.attendance_status == newStatus) return;
if (student.attendance_status === newStatus) return;
setLoading(newStatus);
const data = { ...student, attendance_status: newStatus };
requester('/training/'+student.id+'/', 'PATCH', token, data)
@ -232,7 +232,6 @@ function InstructorClassEditor(props) {
const [editInstructor, setEditInstructor] = useState(false);
const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value });
const handleUpload = (e, v) => setInput({ ...input, [v.name]: e.target.files[0] });
const handleChange = (e) => handleValues(e, e.currentTarget);
const handleCheck = (e, v) => setInput({ ...input, [v.name]: v.checked });
const handleDatetime = (v) => setInput({ ...input, datetime: v.utc().format() });

View File

@ -1,12 +1,11 @@
import React, { useState, useEffect, useReducer } from 'react';
import { BrowserRouter as Router, Switch, Route, Link, useParams, useLocation, useHistory } from 'react-router-dom';
import { Link, useParams } from 'react-router-dom';
import './light.css';
import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Input, Item, Menu, Message, Segment, Table } from 'semantic-ui-react';
import { Button, Container, Dropdown, Grid, Header, Icon, Image, Input, Item, Segment, Table } from 'semantic-ui-react';
import { statusColor, isAdmin, isInstructor, BasicTable, staticUrl, requester } from './utils.js';
import { NotFound, PleaseLogin } from './Misc.js';
import { NotFound } from './Misc.js';
import { AdminMemberInfo, AdminMemberPause, AdminMemberForm, AdminMemberCards, AdminMemberTraining, AdminMemberCertifications } from './AdminMembers.js';
import { AdminMemberTransactions } from './AdminTransactions.js';
import queryString from 'query-string';
import AbortController from 'abort-controller';
const memberSorts = {

View File

@ -55,7 +55,6 @@ export const scene = ({ ref }) => {
//star_circle.rotation.y = Math.PI / 2;
const u = Math.random() - 0.5;
const v = Math.random() - 0.5;
const w = Math.random() - 0.5;
star_circle.position.set(-100000*Math.sin(v*Math.PI+Math.PI/2), 300000*u, 100000*Math.cos(v*Math.PI+Math.PI/2));
star_circle.lookAt(camera.position);
stars.push(star_circle);

View File

@ -46,7 +46,7 @@ export const requester = (route, method, token, data, signal=null) => {
options.headers.Authorization = 'Token ' + token;
}
if (method == 'GET') {
if (method === 'GET') {
// pass
} else if (['POST', 'PUT', 'PATCH'].includes(method)) {
const formData = new FormData();
@ -59,7 +59,7 @@ export const requester = (route, method, token, data, signal=null) => {
method: method,
body: formData,
};
} else if (method == 'DELETE') {
} else if (method === 'DELETE') {
options = {
...options,
method: method,
@ -99,12 +99,12 @@ export const requester = (route, method, token, data, signal=null) => {
})
.catch(error => {
const code = error.data ? error.data.status : null;
if (code == 413) {
if (code === 413) {
throw customError({non_field_errors: ['File too big']});
} else if (code >= 400 && code < 500) {
return error.data.json()
.then(result => {
if (result.detail == 'Invalid token.') {
if (result.detail === 'Invalid token.') {
localStorage.clear();
window.location = '/';
}
@ -143,6 +143,6 @@ function useWindowSize() {
}
export const useIsMobile = () => {
const {width, height} = useWindowSize();
const {width} = useWindowSize();
return width <= 767;
}