Skip to content

Commit

Permalink
Code ran through the linter for submission.
Browse files Browse the repository at this point in the history
  • Loading branch information
SootballJonks committed Mar 25, 2021
1 parent b14cef4 commit 033639a
Show file tree
Hide file tree
Showing 24 changed files with 139 additions and 169 deletions.
5 changes: 3 additions & 2 deletions cypress/integration/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe("Navigation", () => {
cy.visit("/");

cy.contains("[data-testid=day]", "Tuesday")
.click()
.should("have.class", "day-list__item--selected");
.click()
.should("have.class", "day-list__item--selected")
;
});
})
12 changes: 8 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/components/Application.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from "react";

import "components/Application.scss";
import DayList from "./DayList";
import Appointment from "./Appointment/index";
import useApplicationData from "hooks/useApplicationData";
import { getAppointmentsForDay, getInterview, getInterviewersForDay } from "helpers/selectors";



export default function Application(props) {
const {
state,
Expand Down Expand Up @@ -35,8 +33,6 @@ export default function Application(props) {
);
});



return (
<main className="layout">
<section className="sidebar">
Expand Down Expand Up @@ -66,4 +62,4 @@ export default function Application(props) {
</section>
</main>
);
}
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import Button from "components/Button";

export default function Confirm(props) {

return (
<main className="appointment__card appointment__card--confirm">
<h1 className="text--semi-bold">{props.message}</h1>
Expand All @@ -11,5 +10,5 @@ export default function Confirm(props) {
<Button onClick={props.onConfirm} danger>Confirm</Button>
</section>
</main>
)
}
);
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Empty.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

export default function Empty(props) {

return (
<main className="appointment__add">
<img
Expand All @@ -11,5 +10,5 @@ export default function Empty(props) {
onClick={props.onAdd}
/>
</main>
)
}
);
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Error.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

export default function Error(props) {

return (
<main className="appointment__card appointment__card--error">
<section className="appointment__error-message">
Expand All @@ -15,5 +14,5 @@ export default function Error(props) {
onClick={props.onClose}
/>
</main>
)
}
);
};
17 changes: 8 additions & 9 deletions src/components/Appointment/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@ import Button from "components/Button";
import InterviewerList from "components/InterviewerList";



export default function Form(props) {

const [name, setName] = useState(props.name || "");
const [error, setError] = useState("");
const valueChange = (event) => {
return setName(event.target.value);
}
};

const [interviewer, setInterviewer] = useState(props.interviewer || null);

const reset = (event) => {
setName("");
setInterviewer(null);
}
};

const cancel = (event) => {
reset();
props.onCancel()
}
};

const validate = () => {
if (name === "") {
setError("Student name cannot be blank");
return;
}
};
setError("")
props.onSave(name, interviewer);
}
};

return (
<main className="appointment__card appointment__card--create">
Expand Down Expand Up @@ -61,5 +60,5 @@ export default function Form(props) {
</section>
</section>
</main>
)
}
);
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Header.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from "react";

export default function Header(props) {

return (
<header className="appointment__time">
<h4 className="text--semi-bold">{props.time}</h4>
<hr className="appointment__separator" />
</header>
)
}
);
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Show.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

export default function Show(props) {

return (
<main className="appointment__card appointment__card--show">
<section className="appointment__card-left">
Expand All @@ -26,5 +25,5 @@ export default function Show(props) {
</section>
</section>
</main>
)
}
);
};
5 changes: 2 additions & 3 deletions src/components/Appointment/Status.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";

export default function Status(props) {

return (
<main className="appointment__card appointment__card--status">
<img
Expand All @@ -11,5 +10,5 @@ export default function Status(props) {
/>
<h1 className="text--semi-bold">{props.message}</h1>
</main>
)
}
);
};
12 changes: 6 additions & 6 deletions src/components/Appointment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export default function Appointment(props) {

const onAdd = () => {
transition(CREATE);
}
};

const onCancel = () => {
back();
}
};

const onDelete = () => {
transition(DELETING, true);
props.cancelInterview(props.id)
.then(() => transition(EMPTY))
.catch((error) => transition(ERROR_DELETE, true))
}
};

const onSave = (name, interviewer) => {
const interview = {
Expand All @@ -51,7 +51,7 @@ export default function Appointment(props) {
.bookInterview(props.id, interview)
.then(() => transition(SHOW))
.catch((error) => transition(ERROR_SAVE, true))
}
};

return (
<article className="appointment" data-testid="appointment">
Expand Down Expand Up @@ -103,5 +103,5 @@ export default function Appointment(props) {
/>
)}
</article>
)
}
);
};
3 changes: 1 addition & 2 deletions src/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";

import "components/Button.scss";
import classNames from "classnames";

Expand All @@ -22,4 +21,4 @@ export default function Button(props) {
{props.children}
</button>
);
}
};
7 changes: 3 additions & 4 deletions src/components/DayListItem.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";

import "components/DayListItem.scss";
import classNames from "classnames";

Expand All @@ -11,7 +10,7 @@ export default function DayListItem(props) {
'day-list__item--selected': props.selected,
'day-list__item--full': props.spots === 0
}
)
);

const formatSpots = function(spots) {
if (spots > 1) {
Expand All @@ -23,7 +22,7 @@ export default function DayListItem(props) {
if (spots === 0) {
return ("no spots remaining");
}
}
};

return (
<li
Expand All @@ -35,4 +34,4 @@ export default function DayListItem(props) {
<h3 className="text--light">{formatSpots(props.spots)}</h3>
</li>
);
}
};
8 changes: 3 additions & 5 deletions src/components/InterviewerList.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from "react";
import PropTypes from "prop-types";

import "components/InterviewerList.scss";
import InterviewerListItem from "components/InterviewerListItem";



export default function InterviewerList(props) {
const list = props.interviewers.map((interviewer) => {
return (
Expand All @@ -17,15 +15,15 @@ export default function InterviewerList(props) {
setInterviewer={(event) => props.setInterviewer(interviewer.id)}
/>
)
})
});

return (
<section className="interviewers">
<h4 className="interviewers__header text--light">Interviewer</h4>
<ul className="interviewers__list">{list}</ul>
</section>
)
}
);
};

InterviewerList.propTypes = {
interviewers: PropTypes.array.isRequired
Expand Down
3 changes: 0 additions & 3 deletions src/components/__tests__/Application.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import React from "react";

import { render, cleanup, waitForElement, fireEvent, getByText, prettyDOM, getAllByTestId, getByAltText, getByPlaceholderText, queryByText, queryByAltText } from "@testing-library/react";
import axios from "axios";

import Application from "components/Application";

afterEach(cleanup);


describe("Application", () => {
it("defaults to Monday and changes the schedule when a new day is selected", () => {
const { getByText } = render(<Application />);
Expand Down
4 changes: 1 addition & 3 deletions src/components/__tests__/Appointment.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from "react";

import { render, cleanup } from "@testing-library/react";

import Appointment from "components/Appointment/index";

afterEach(cleanup);
Expand All @@ -10,4 +8,4 @@ describe("Appointment", () => {
it("renders without crashing", () => {
render(<Appointment />);
});
});
});
Loading

0 comments on commit 033639a

Please sign in to comment.