Skip to content

Commit

Permalink
Fixed npm lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepika Gonuguntla committed Nov 8, 2022
1 parent d67e78f commit ec86bfa
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 131 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
// disabling this bc it is checked by typescript so it is
// redundant and doesn't function properly
"react/prop-types": 0,
"no-unused-vars": "off",
"prettier/prettier": "error",
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-use-before-define": [
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/components/AccessDigitalResources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from "react";
import {
Accordion,
Link,
List,
Heading,
Text,
} from "@nypl/design-system-react-components";

export default function AccessDigitalResources(props) {
export default function AccessDigitalResources() {
return (
<>
<Heading
Expand Down
20 changes: 5 additions & 15 deletions app/javascript/components/AccountDetailsSubMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
import React, { useState } from "react";
import {
Link as ReactRouterLink,
useParams,
useNavigate,
} from "react-router-dom";
import { Link as ReactRouterLink, useNavigate } from "react-router-dom";
import axios from "axios";
import {
List,
Icon,
Button,
Link,
Box,
} from "@nypl/design-system-react-components";
import { List, Icon, Link, Box } from "@nypl/design-system-react-components";

function AccountDetailsSubMenu(props) {
const navigate = useNavigate();
const [user_signed_in, setUserSignedIn] = useState(props.userSignedIn);
//const [user_signed_in, setUserSignedIn] = useState(props.userSignedIn);
const [showAboutMenu, setShowAboutMenu] = useState(false);

const handleHover = () => {
Expand Down Expand Up @@ -92,7 +82,7 @@ function AccountDetailsSubMenu(props) {
}
};

const signOut = (event) => {
const signOut = () => {
axios
.delete("/users/logout", {
headers: {
Expand All @@ -105,7 +95,7 @@ function AccountDetailsSubMenu(props) {
.then((res) => {
if (res.data.status === 200 && res.data.logged_out === true) {
props.handleLogout(false);
setUserSignedIn(false);
// setUserSignedIn(false);
setShowAboutMenu(false);
props.handleSignOutMsg(res.data.sign_out_msg, false);
props.hideSignUpMessage(false);
Expand Down
78 changes: 39 additions & 39 deletions app/javascript/components/Accounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {

export default function Accounts() {
const [currentUser, setCurrentUser] = useState("");
const [school, setSchool] = useState("");
//const [school, setSchool] = useState("");
const [altEmail, setAltEmail] = useState("");
const [email, setEmail] = useState("");
const [schools, setSchools] = useState("");
Expand Down Expand Up @@ -52,7 +52,7 @@ export default function Accounts() {
return false;
} else {
let accountDetails = res.data.accountdetails;
setSchool(accountDetails.school);
//setSchool(accountDetails.school);
setEmail(accountDetails.email);
setAltEmail(accountDetails.alt_email);
setSchools(accountDetails.schools);
Expand Down Expand Up @@ -98,12 +98,12 @@ export default function Accounts() {
};

const handleSchool = (event) => {
setSchool(event.target.value);
//setSchool(event.target.value);
setSchoolId(event.target.value);
};

const Schools = () => {
return Object.entries(schools).map((school, i) => {
return Object.entries(schools).map((school, _i) => {
return (
<option key={school[1]} value={school[1]}>
{school[0]}
Expand Down Expand Up @@ -155,40 +155,40 @@ export default function Accounts() {
}
};

const cancelOrder = (value, access_key, cancel_button_index) => {
axios.defaults.headers.common["X-CSRF-TOKEN"] = document
.querySelector("meta[name='csrf-token']")
.getAttribute("content");
axios
.put("/holds/" + access_key, { hold_change: { status: "cancelled" } })
.then((res) => {
if (
res.request.responseURL ===
"https://" + process.env.MLN_INFO_SITE_HOSTNAME + "/signin"
) {
window.location = res.request.responseURL;
return false;
} else {
if (res.data.hold.status === "cancelled") {
let updatedHolds = holds.map((obj, index) => {
if (index === cancel_button_index) {
return Object.assign({}, obj, {
status: "cancelled",
status_label: "Cancelled",
});
}
return obj;
});
setHolds(updatedHolds);
}
}
})
.catch(function (error) {
console.log(error);
});
};
// const cancelOrder = (value, access_key, cancel_button_index) => {
// axios.defaults.headers.common["X-CSRF-TOKEN"] = document
// .querySelector("meta[name='csrf-token']")
// .getAttribute("content");
// axios
// .put("/holds/" + access_key, { hold_change: { status: "cancelled" } })
// .then((res) => {
// if (
// res.request.responseURL ===
// "https://" + process.env.MLN_INFO_SITE_HOSTNAME + "/signin"
// ) {
// window.location = res.request.responseURL;
// return false;
// } else {
// if (res.data.hold.status === "cancelled") {
// let updatedHolds = holds.map((obj, index) => {
// if (index === cancel_button_index) {
// return Object.assign({}, obj, {
// status: "cancelled",
// status_label: "Cancelled",
// });
// }
// return obj;
// });
// setHolds(updatedHolds);
// }
// }
// })
// .catch(function (error) {
// console.log(error);
// });
// };

const orderCancelConfirmation = (hold, index) => {
const orderCancelConfirmation = (hold) => {
return (
<div id={"cancel_" + hold["access_key"]}>
<ButtonGroup buttonWidth="full">
Expand All @@ -206,7 +206,7 @@ export default function Accounts() {
);
};

const orderTeacherSet = (hold, index) => {
const orderTeacherSet = (hold) => {
return (
<div id={"cancel_" + hold["access_key"]}>
<ButtonGroup buttonWidth="full">
Expand Down Expand Up @@ -313,7 +313,7 @@ export default function Accounts() {
return false;
} else {
let accountDetails = res.data.accountdetails;
setSchool(accountDetails.school);
//setSchool(accountDetails.school);
setEmail(accountDetails.email);
setAltEmail(accountDetails.alt_email);
setSchools(accountDetails.schools);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function App() {
loginStatus();
}, []);

const handleLogin = (data) => {
const handleLogin = () => {
setIsLoggedIn(true);
};

Expand Down
5 changes: 2 additions & 3 deletions app/javascript/components/CalendarEventError.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { useContext, useState, useEffect } from "react";
import React, { useState, useEffect } from "react";
import AppBreadcrumbs from "./AppBreadcrumbs";
import axios from "axios";
import {
TemplateAppContainer,
Text,
Heading,
} from "@nypl/design-system-react-components";

const CalendarEventError = (props) => {
const CalendarEventError = () => {
const [mlnCalendarEvent, setMlnCalendarEvent] = useState("");

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion app/javascript/components/CalendarOfEvents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Link,
ButtonGroup,
} from "@nypl/design-system-react-components";
import { BrowserRouter as Router } from "react-router-dom";

function CalendarOfEvents() {
const [calendarFileName, setCalendarFileName] = useState("");
Expand Down
41 changes: 33 additions & 8 deletions app/javascript/components/Contacts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ function Contacts() {
</Link>,
],
[
<Text noSpace>Delivery Questions</Text>,
<Text key="delivery-questions" noSpace>
Delivery Questions
</Text>,
<Link
key="delivery-questions-link"
id="mln-delivery-email"
href="mailto:delivery@mylibrarynyc.org"
>
Expand All @@ -74,14 +77,23 @@ function Contacts() {
useRowHeaders
tableData={[
[
<Text noSpace>The Bronx, Manhattan and Staten Island</Text>,
<Link id="mln-nypl-email" href="mailto:mylibrarynyc@nypl.org">
<Text key="mln-nypl-email-text" noSpace>
The Bronx, Manhattan and Staten Island
</Text>,
<Link
key="mln-nypl-email-link"
id="mln-nypl-email"
href="mailto:mylibrarynyc@nypl.org"
>
mylibrarynyc@nypl.org
</Link>,
],
[
<Text noSpace>Brooklyn</Text>,
<Text key="brooklyn-text" noSpace>
Brooklyn
</Text>,
<Link
key="mln-brooklyn-link"
id="mln-brooklyn-email"
href="mailto:mylibrarynyc@bklynlibrary.org"
>
Expand All @@ -90,8 +102,11 @@ function Contacts() {
],

[
<Text noSpace>Queens</Text>,
<Text key="mln-queens-email-text" noSpace>
Queens
</Text>,
<Link
key="mln-queens-email-link"
id="mln-queens-email"
href="mailto:mylibrarynyc@queenslibrary.org"
>
Expand Down Expand Up @@ -146,10 +161,20 @@ function Contacts() {
className="contactInfo"
useRowHeaders
tableData={[
[<Text noSpace>Phone</Text>, <Text>917-521-3734</Text>],
[
<Text noSpace>Website</Text>,
<Link href="http://nycdoe.libguides.com/home">
<Text key="phone-text" noSpace>
Phone
</Text>,
<Text key="phone-number">917-521-3734</Text>,
],
[
<Text key="website-text" noSpace>
Website
</Text>,
<Link
key="doe-ofc-link"
href="http://nycdoe.libguides.com/home"
>
DOE Office of Library Services
</Link>,
],
Expand Down
Loading

0 comments on commit ec86bfa

Please sign in to comment.