Skip to content

Commit dbc6971

Browse files
committed
linter
1 parent ec10fa2 commit dbc6971

File tree

11 files changed

+123
-125
lines changed

11 files changed

+123
-125
lines changed

backend/services/implementation/miscImplementation.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ class MiscService implements IMiscService {
77
const today = new Date();
88
const rooms = await prisma.participant.findMany({
99
where: {
10-
OR: [
11-
{ departure: "" },
12-
{ departure: { gte: today.toISOString() } },
13-
],
10+
OR: [{ departure: "" }, { departure: { gte: today.toISOString() } }],
1411
},
1512
select: {
1613
roomNumber: true,

backend/services/implementation/participantImplementation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ParticipantService implements IParticipantService {
66
async getAllParticipants(): Promise<Participant[]> {
77
try {
88
const participants = await prisma.participant.findMany({
9-
orderBy: [{ departure: "asc" }, { arrival: "desc" }],
9+
orderBy: [{ departure: "asc" }, { arrival: "asc" }],
1010
});
1111
return participants;
1212
} catch (err) {

frontend/src/App.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ const App = (): React.ReactElement => {
6565
{/* <Route path={ROUTES.HOME_PAGE} element={<HomePage />} /> */}
6666
{/* <Route path={ROUTES.SCHEDULE_PAGE} element={<SchedulePage />} /> */}
6767
{/* <Route path={ROUTES.ANNOUNCEMENTS_PAGE} element={<AnnouncementsPage />} /> */}
68-
<Route path={ROUTES.PARTICIPANTS_PAGE} element={<ParticipantsPage />} />
68+
<Route
69+
path={ROUTES.PARTICIPANTS_PAGE}
70+
element={<ParticipantsPage />}
71+
/>
6972
{/* <Route path={ROUTES.TASKS_PAGE} element={<TasksPage />} /> */}
7073
<Route path="*" element={<NotFoundPage />} />
7174
</Switch>

frontend/src/components/common/CommonTable.tsx

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -203,41 +203,48 @@ const CommonTable = ({
203203
/>
204204
</Th>
205205
) : null}
206-
{columnInfo.map((header, index) => header.display && (
207-
<Th key={index}>
208-
<Flex alignItems="center">
209-
{header.header}
210-
<Flex
211-
alignItems="center"
212-
flexDirection="column"
213-
paddingLeft="2.5px"
214-
>
215-
<KeyboardArrowUpOutlinedIcon
216-
style={{
217-
height: "0.5em",
218-
cursor: "pointer",
219-
color:
220-
sortingColumn[header.key] === 1 ? "" : "#c4c8d8",
221-
}}
222-
onClick={() => {
223-
sortColumn(header.key);
224-
}}
225-
/>
226-
<KeyboardArrowDownOutlinedIcon
227-
style={{
228-
height: "0.5em",
229-
cursor: "pointer",
230-
color:
231-
sortingColumn[header.key] === 2 ? "" : "#c4c8d8",
232-
}}
233-
onClick={() => {
234-
sortColumn(header.key);
235-
}}
236-
/>
237-
</Flex>
238-
</Flex>
239-
</Th>
240-
))}
206+
{columnInfo.map(
207+
(header, index) =>
208+
header.display && (
209+
<Th key={index}>
210+
<Flex alignItems="center">
211+
{header.header}
212+
<Flex
213+
alignItems="center"
214+
flexDirection="column"
215+
paddingLeft="2.5px"
216+
>
217+
<KeyboardArrowUpOutlinedIcon
218+
style={{
219+
height: "0.5em",
220+
cursor: "pointer",
221+
color:
222+
sortingColumn[header.key] === 1
223+
? ""
224+
: "#c4c8d8",
225+
}}
226+
onClick={() => {
227+
sortColumn(header.key);
228+
}}
229+
/>
230+
<KeyboardArrowDownOutlinedIcon
231+
style={{
232+
height: "0.5em",
233+
cursor: "pointer",
234+
color:
235+
sortingColumn[header.key] === 2
236+
? ""
237+
: "#c4c8d8",
238+
}}
239+
onClick={() => {
240+
sortColumn(header.key);
241+
}}
242+
/>
243+
</Flex>
244+
</Flex>
245+
</Th>
246+
),
247+
)}
241248
<Th />
242249
</Tr>
243250
</Thead>
@@ -262,16 +269,19 @@ const CommonTable = ({
262269
/>
263270
</Td>
264271
) : null}
265-
{columnInfo.map((column, i) => column.display && (
266-
<Td
267-
onClick={() => {
268-
handleRowClick(row);
269-
}}
270-
key={i}
271-
>
272-
{String(row[column.key])}
273-
</Td>
274-
))}
272+
{columnInfo.map(
273+
(column, i) =>
274+
column.display && (
275+
<Td
276+
onClick={() => {
277+
handleRowClick(row);
278+
}}
279+
key={i}
280+
>
281+
{String(row[column.key])}
282+
</Td>
283+
),
284+
)}
275285
<Td
276286
onClick={(e) => {
277287
e.stopPropagation();

frontend/src/components/common/FormInputField.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {
77
FormLabel,
88
InputRightElement,
99
InputGroup,
10-
InputLeftElement,
11-
FormErrorMessage,
10+
InputLeftElement
1211
} from "@chakra-ui/react";
1312

1413
import VisibilityIcon from "@mui/icons-material/Visibility";

frontend/src/components/common/FormSelectField.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import React, { useState } from "react";
1+
import React from "react";
22
import {
3-
Flex,
43
FormControl,
54
FormLabel,
6-
FormErrorMessage,
75
Select,
86
} from "@chakra-ui/react";
97

frontend/src/components/common/ModalContainer.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,18 @@ const ModalContainer = ({
2424
children,
2525
}: Props): React.ReactElement => {
2626
return (
27-
<Modal
28-
closeOnOverlayClick={false}
29-
isOpen
30-
onClose={() => {}}
31-
isCentered
32-
>
27+
<Modal closeOnOverlayClick={false} isOpen onClose={() => {}} isCentered>
3328
<ModalOverlay />
3429
<ModalContent>
3530
<ModalHeader>
3631
{title}
37-
{
38-
onDelete &&
39-
<Button
40-
variant="del"
41-
gap="2px"
42-
onClick={onDelete}
43-
>
32+
{onDelete && (
33+
<Button variant="del" gap="2px" onClick={onDelete}>
4434
<DeleteOutlinedIcon />
4535
Delete
4636
</Button>
47-
}
48-
{
49-
close &&
37+
)}
38+
{close && (
5039
<Button
5140
bg="transparent"
5241
h="auto"
@@ -55,7 +44,7 @@ const ModalContainer = ({
5544
>
5645
<CloseIcon />
5746
</Button>
58-
}
47+
)}
5948
</ModalHeader>
6049
<ModalBody>{children}</ModalBody>
6150
</ModalContent>

frontend/src/components/common/SideBar.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
1-
import React, { useContext } from "react";
2-
import { gql, useMutation } from "@apollo/client";
1+
import React from "react";
32
import {
43
Tabs,
54
TabList,
65
Tab,
76
Box,
87
Button,
9-
Avatar,
108
Text,
11-
Flex,
12-
Heading,
13-
useBreakpointValue,
9+
Flex
1410
} from "@chakra-ui/react";
1511
import { useNavigate } from "react-router-dom";
1612

1713
import * as Routes from "../../constants/routes";
1814
import { ReactComponent as Logo } from "../../assets/marillacPlaceLogo.svg";
1915

20-
const mockAuthenticatedUser = {
21-
id: "1",
22-
type: "STAFF",
23-
email: "janedoe@gmail.com",
24-
firstName: "Jane",
25-
lastName: "Doe",
26-
};
27-
2816
const SideBarTab: React.FC<{ label: string; handleClick: () => void }> = ({
2917
label,
3018
handleClick,

frontend/src/components/pages/participants/AddParticipantCard.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import React, { useState } from "react";
2-
import {
3-
Button,
4-
Text,
5-
Flex,
6-
Spinner,
7-
} from "@chakra-ui/react";
2+
import { Button, Flex, Spinner } from "@chakra-ui/react";
83

94
import { useMutation, useQuery, useLazyQuery } from "@apollo/client";
105
import {
@@ -21,7 +16,9 @@ type AddParticipantCardProps = {
2116
close: () => void;
2217
};
2318

24-
const AddParticipantCard = ({close}: AddParticipantCardProps): React.ReactElement => {
19+
const AddParticipantCard = ({
20+
close,
21+
}: AddParticipantCardProps): React.ReactElement => {
2522
const [participantId, setParticipantId] = useState("");
2623
const [roomNumber, setRoomNumber] = useState("");
2724
const [arrivalDate, setArrivalDate] = useState("");
@@ -51,7 +48,9 @@ const AddParticipantCard = ({close}: AddParticipantCardProps): React.ReactElemen
5148
return false;
5249
}
5350
try {
54-
const { data } = await getParticipantById({ variables: { participantId } });
51+
const { data } = await getParticipantById({
52+
variables: { participantId },
53+
});
5554
if (data && data.getParticipantById) {
5655
setError("ID already exists.");
5756
return false;
@@ -83,7 +82,7 @@ const AddParticipantCard = ({close}: AddParticipantCardProps): React.ReactElemen
8382
window.location.reload();
8483
}
8584
} catch (err) {
86-
setError("Unable to create participant.")
85+
setError("Unable to create participant.");
8786
console.log(err);
8887
}
8988
};

frontend/src/components/pages/participants/EditParticipantCard.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import React, { useState } from "react";
2-
import {
3-
Button,
4-
Flex,
5-
Spinner
6-
} from "@chakra-ui/react";
2+
import { Button, Flex, Spinner } from "@chakra-ui/react";
73

84
import { useMutation, useQuery } from "@apollo/client";
95

@@ -20,7 +16,10 @@ type EditParticipantCardProps = {
2016
close: () => void;
2117
};
2218

23-
const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React.ReactElement => {
19+
const EditParticipantCard = ({
20+
selected,
21+
close,
22+
}: EditParticipantCardProps): React.ReactElement => {
2423
const [roomNumber, setRoomNumber] = useState(selected.roomNumber);
2524
const [arrivalDate, setArrivalDate] = useState(selected.arrival);
2625
const [departureDate, setDepartureDate] = useState(selected.departure);
@@ -38,7 +37,7 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
3837
const reset = () => {
3938
setRoomNumber(selected.roomNumber);
4039
setArrivalDate(selected.arrival);
41-
setDepartureDate(selected.departure)
40+
setDepartureDate(selected.departure);
4241
setPassword(selected.password);
4342
setError("");
4443
};
@@ -47,8 +46,13 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
4746
if (!roomNumber || !arrivalDate || !password) {
4847
setError("Missing fields.");
4948
return false;
50-
}
51-
if (roomNumber === selected.roomNumber && arrivalDate === selected.arrival && departureDate === selected.departure && password === selected.password) {
49+
}
50+
if (
51+
roomNumber === selected.roomNumber &&
52+
arrivalDate === selected.arrival &&
53+
departureDate === selected.departure &&
54+
password === selected.password
55+
) {
5256
setError("No changes made.");
5357
return false;
5458
}
@@ -73,7 +77,7 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
7377
reset();
7478
close();
7579
window.location.reload();
76-
}
80+
}
7781
} catch (err) {
7882
setError("Unable to update participant.");
7983
console.log(err);
@@ -86,7 +90,9 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
8690
{error && <Flex textColor="red.500">{error}</Flex>}
8791

8892
<Flex flexDir="column">
89-
<Flex mb="5px" color="gray.main" fontWeight="700">ID Number</Flex>
93+
<Flex mb="5px" color="gray.main" fontWeight="700">
94+
ID Number
95+
</Flex>
9096
<Flex>{selected.participantId}</Flex>
9197
</Flex>
9298

@@ -106,7 +112,9 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
106112
display: `Room ${room}`,
107113
}),
108114
)}
109-
onChange={(e) => setRoomNumber(e.target.value || selected.roomNumber)}
115+
onChange={(e) =>
116+
setRoomNumber(e.target.value || selected.roomNumber)
117+
}
110118
/>
111119
)}
112120

@@ -155,4 +163,4 @@ const EditParticipantCard = ({selected, close}: EditParticipantCardProps): React
155163
);
156164
};
157165

158-
export default EditParticipantCard;
166+
export default EditParticipantCard;

0 commit comments

Comments
 (0)