From 39560bd1858bbc3bddfef43b1b19c2c67bb9b793 Mon Sep 17 00:00:00 2001 From: Florian Pagnoux Date: Mon, 11 Dec 2023 00:47:36 -0500 Subject: [PATCH] Cleanup import sorting (#68) --- src/index.tsx | 9 ++++--- src/pages/Approvals/AddNewApproval.tsx | 6 ++--- src/pages/Approvals/AddNewApprovalForm.tsx | 14 +++++----- src/pages/Approvals/ApprovalItemsPicker.tsx | 10 +++---- src/pages/Approvals/ApprovalsPage.tsx | 5 ++-- src/pages/Approvals/ApprovalsTable.tsx | 12 ++++----- src/pages/Gear/AddNewGear/AddNewGear.tsx | 4 +-- src/pages/Gear/AddNewGear/AddNewGearForm.tsx | 10 +++---- .../Gear/AddNewGear/AddNewGearResults.tsx | 2 +- src/pages/Gear/AllGearPage/AllGearPage.tsx | 24 +++++++++-------- src/pages/Gear/AllGearPage/GearFilters.tsx | 2 +- src/pages/Gear/GearInfoPanel.tsx | 8 +++--- src/pages/Gear/GearItemEditForm.tsx | 26 ++++++++++++------- src/pages/Gear/GearItemPage.tsx | 2 +- src/pages/Gear/GearRentalsHistory.tsx | 4 +-- src/pages/Gear/GearStatus.tsx | 2 +- src/pages/Gear/GearStatusForm.tsx | 2 +- src/pages/LogIn/LoginForm.tsx | 8 +++--- src/pages/LogIn/RequestPasswordConfirm.tsx | 2 +- src/pages/LogIn/RequestPasswordReset.tsx | 5 ++-- .../OfficeHours/ApproveDeskCreditPage.tsx | 5 ++-- .../OfficeHours/MyOfficeHoursHistory.tsx | 1 + src/pages/OfficeHours/OfficeHoursHistory.tsx | 4 +-- src/pages/OfficeHours/OfficeHoursPage.tsx | 10 +++---- .../RequestDeskCreditForm.tsx | 18 ++++++------- .../RequestDeskCreditPage.tsx | 4 +-- .../People/AddNewPerson/AddNewPerson.tsx | 6 ++--- src/pages/People/BuyGear.tsx | 4 +-- src/pages/People/CheckoutStaging.tsx | 4 +-- src/pages/People/MoreGear.tsx | 4 +-- src/pages/People/PeoplePage/PeopleFilters.tsx | 2 +- src/pages/People/PeoplePage/PeoplePage.tsx | 7 +++-- .../People/PeoplePage/PersonPageContext.tsx | 3 ++- src/pages/People/PersonPage.tsx | 16 ++++++------ .../People/PersonProfile/ExpirableTile.tsx | 3 +-- .../PersonProfile/FrequentFlyerForm.tsx | 6 +++-- .../People/PersonProfile/MembershipForm.tsx | 6 +++-- .../People/PersonProfile/MitocCreditForm.tsx | 2 +- .../People/PersonProfile/PeopleGroups.tsx | 4 +-- .../PersonProfile/PersonChangePassword.tsx | 6 ++--- .../People/PersonProfile/PersonEditForm.tsx | 6 ++--- .../People/PersonProfile/PersonProfile.tsx | 15 ++++++----- src/pages/People/PersonProfile/WaiverForm.tsx | 6 +++-- src/pages/People/PersonRentals.tsx | 3 ++- src/pages/People/PersonRentalsHistory.tsx | 6 ++--- .../People/ReturnStaging/PaymentSummary.tsx | 12 ++++----- .../People/ReturnStaging/ReturnStaging.tsx | 11 ++++---- src/redux/api.ts | 10 +++---- src/redux/auth/authSlice.ts | 11 ++++---- src/redux/hooks.ts | 2 +- src/redux/store.ts | 4 +-- 51 files changed, 187 insertions(+), 171 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index d427f34..0d5df45 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,13 +1,14 @@ -import React from "react"; -import ReactDOM from "react-dom"; import "bootstrap/dist/css/bootstrap.min.css"; import "bootstrap/js/dist/collapse"; import "bootstrap/js/dist/dropdown"; - import "./index.css"; + +import React from "react"; +import ReactDOM from "react-dom"; +import { Provider } from "react-redux"; + import App from "./App"; import { store } from "./redux/store"; -import { Provider } from "react-redux"; import * as serviceWorker from "./serviceWorker"; ReactDOM.render( diff --git a/src/pages/Approvals/AddNewApproval.tsx b/src/pages/Approvals/AddNewApproval.tsx index 3e5607d..6eee9cf 100644 --- a/src/pages/Approvals/AddNewApproval.tsx +++ b/src/pages/Approvals/AddNewApproval.tsx @@ -1,13 +1,13 @@ import { useState } from "react"; +import { Link } from "react-router-dom"; -import { APIErrorType } from "apiClient/types"; -import { useSetPageTitle } from "hooks"; import { createNewApproval, CreateNewApprovalArgs } from "apiClient/approvals"; import { APIError as APIErrorClass } from "apiClient/client"; +import { APIErrorType } from "apiClient/types"; +import { useSetPageTitle } from "hooks"; import { gearDbApi } from "redux/api"; import { AddNewApprovalForm } from "./AddNewApprovalForm"; -import { Link } from "react-router-dom"; export function AddNewApproval() { useSetPageTitle("Approve restricted gear rental"); diff --git a/src/pages/Approvals/AddNewApprovalForm.tsx b/src/pages/Approvals/AddNewApprovalForm.tsx index d37e7cf..7afabc3 100644 --- a/src/pages/Approvals/AddNewApprovalForm.tsx +++ b/src/pages/Approvals/AddNewApprovalForm.tsx @@ -1,18 +1,18 @@ -import { useForm } from "react-hook-form"; import DatePicker from "react-datepicker"; +import { useForm } from "react-hook-form"; import { useHistory } from "react-router-dom"; -import { makeLabeledInput } from "components/Inputs/LabeledInput"; -import { Form } from "components/Inputs/Form"; -import { PersonSelect } from "components/PersonSelect"; - -import { ApprovalItemsPicker, defaultItem } from "./ApprovalItemsPicker"; -import { FormValues } from "./types"; import { ApprovalItemToCreate, ApprovalItemType, CreateNewApprovalArgs, } from "apiClient/approvals"; +import { Form } from "components/Inputs/Form"; +import { makeLabeledInput } from "components/Inputs/LabeledInput"; +import { PersonSelect } from "components/PersonSelect"; + +import { ApprovalItemsPicker, defaultItem } from "./ApprovalItemsPicker"; +import { FormValues } from "./types"; type Props = { onSubmit: (args: CreateNewApprovalArgs) => void; diff --git a/src/pages/Approvals/ApprovalItemsPicker.tsx b/src/pages/Approvals/ApprovalItemsPicker.tsx index 1f59f99..5909071 100644 --- a/src/pages/Approvals/ApprovalItemsPicker.tsx +++ b/src/pages/Approvals/ApprovalItemsPicker.tsx @@ -1,13 +1,13 @@ -import { useFieldArray, Controller, useFormContext } from "react-hook-form"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faClose } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { Controller, useFieldArray, useFormContext } from "react-hook-form"; import styled from "styled-components"; -import { makeLabeledInput } from "components/Inputs/LabeledInput"; import { ApprovalItemType, PartialApprovalItem } from "apiClient/approvals"; -import { Select } from "components/Select"; -import { GearTypeSelect } from "components/GearTypeSelect"; import { GearItemSelect } from "components/GearItemSelect"; +import { GearTypeSelect } from "components/GearTypeSelect"; +import { makeLabeledInput } from "components/Inputs/LabeledInput"; +import { Select } from "components/Select"; import { FormValues } from "./types"; diff --git a/src/pages/Approvals/ApprovalsPage.tsx b/src/pages/Approvals/ApprovalsPage.tsx index b03e413..fc9660d 100644 --- a/src/pages/Approvals/ApprovalsPage.tsx +++ b/src/pages/Approvals/ApprovalsPage.tsx @@ -1,10 +1,9 @@ import { useState } from "react"; - -import { TablePagination } from "components/TablePagination"; -import { useSetPageTitle } from "hooks"; import { Link } from "react-router-dom"; import { Checkbox } from "components/Inputs/Checkbox"; +import { TablePagination } from "components/TablePagination"; +import { useSetPageTitle } from "hooks"; import { restrictedGearDoc } from "lib/constants"; import { useGetApprovalsQuery } from "redux/api"; import { usePermissions } from "redux/auth"; diff --git a/src/pages/Approvals/ApprovalsTable.tsx b/src/pages/Approvals/ApprovalsTable.tsx index 2659052..e9d894d 100644 --- a/src/pages/Approvals/ApprovalsTable.tsx +++ b/src/pages/Approvals/ApprovalsTable.tsx @@ -1,13 +1,13 @@ -import { useMemo } from "react"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faClose } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { useMemo } from "react"; -import { DataGrid } from "components/DataGrid"; -import { formatDate } from "lib/fmtDate"; import { Approval, deleteApproval } from "apiClient/approvals"; -import { PersonLink } from "components/PersonLink"; -import { GearLink } from "components/GearLink"; import { PersonBase } from "apiClient/people"; +import { DataGrid } from "components/DataGrid"; +import { GearLink } from "components/GearLink"; +import { PersonLink } from "components/PersonLink"; +import { formatDate } from "lib/fmtDate"; export function ApprovalsTable({ approvals, diff --git a/src/pages/Gear/AddNewGear/AddNewGear.tsx b/src/pages/Gear/AddNewGear/AddNewGear.tsx index 7c90db4..e87cfcc 100644 --- a/src/pages/Gear/AddNewGear/AddNewGear.tsx +++ b/src/pages/Gear/AddNewGear/AddNewGear.tsx @@ -1,13 +1,13 @@ import { isEmpty } from "lodash"; import { useState } from "react"; -import { createGear, CreateGearArgs, GearSummary } from "apiClient/gear"; import { APIError as APIErrorClass } from "apiClient/client"; +import { createGear, CreateGearArgs, GearSummary } from "apiClient/gear"; import { APIErrorType } from "apiClient/types"; import { useSetPageTitle } from "hooks"; -import { AddNewGearForm } from "./AddNewGearForm"; import { AddNewGearError } from "./AddNewGearError"; +import { AddNewGearForm } from "./AddNewGearForm"; import { AddNewGearResults } from "./AddNewGearResults"; export function AddNewGear() { diff --git a/src/pages/Gear/AddNewGear/AddNewGearForm.tsx b/src/pages/Gear/AddNewGear/AddNewGearForm.tsx index 6eaecfc..e4ee72c 100644 --- a/src/pages/Gear/AddNewGear/AddNewGearForm.tsx +++ b/src/pages/Gear/AddNewGear/AddNewGearForm.tsx @@ -1,12 +1,12 @@ import { useEffect } from "react"; -import { useForm, FormProvider } from "react-hook-form"; +import { FormProvider, useForm } from "react-hook-form"; +import { Link } from "react-router-dom"; -import { useGetGearTypesQuery, useGetGearLocationsQuery } from "redux/api"; -import { CreateGearArgs, GearType, GearLocation } from "apiClient/gear"; +import { CreateGearArgs, GearLocation, GearType } from "apiClient/gear"; import { makeLabeledInput } from "components/Inputs/LabeledInput"; -import { Link } from "react-router-dom"; -import { fmtAmount } from "lib/fmtNumber"; import { Select } from "components/Select"; +import { fmtAmount } from "lib/fmtNumber"; +import { useGetGearLocationsQuery, useGetGearTypesQuery } from "redux/api"; type GearTypeOption = GearType & { value: string; label: string }; diff --git a/src/pages/Gear/AddNewGear/AddNewGearResults.tsx b/src/pages/Gear/AddNewGear/AddNewGearResults.tsx index 750a5e9..3272b2c 100644 --- a/src/pages/Gear/AddNewGear/AddNewGearResults.tsx +++ b/src/pages/Gear/AddNewGear/AddNewGearResults.tsx @@ -1,7 +1,7 @@ import { Link } from "react-router-dom"; -import { GearLink } from "components/GearLink"; import { GearSummary } from "apiClient/gear"; +import { GearLink } from "components/GearLink"; export function AddNewGearResults({ gearCreated, diff --git a/src/pages/Gear/AllGearPage/AllGearPage.tsx b/src/pages/Gear/AllGearPage/AllGearPage.tsx index 5e283fa..66be1f5 100644 --- a/src/pages/Gear/AllGearPage/AllGearPage.tsx +++ b/src/pages/Gear/AllGearPage/AllGearPage.tsx @@ -1,19 +1,20 @@ import { compact, isEqual } from "lodash"; import { useState } from "react"; -import styled from "styled-components"; import { Link } from "react-router-dom"; +import styled from "styled-components"; import { GearSummary } from "apiClient/gear"; import { DataGrid } from "components/DataGrid"; -import { TablePagination } from "components/TablePagination"; -import { SearchTextField } from "components/Inputs/TextField"; import { GearLink } from "components/GearLink"; -import { useGearList } from "redux/api"; +import { SearchTextField } from "components/Inputs/TextField"; +import { TablePagination } from "components/TablePagination"; import { useSetPageTitle } from "hooks"; +import { useGearList } from "redux/api"; import { GearStatus } from "../GearStatus"; + import { GearFilters, GearStatusFilter } from "./GearFilters"; -import { useGearFilters, gearStatusToBoolean } from "./useGearFilter"; +import { gearStatusToBoolean, useGearFilters } from "./useGearFilter"; export function AllGearPage() { useSetPageTitle("Gear"); @@ -46,7 +47,12 @@ export function AllGearPage() { renderer: DescriptionCell, }, { key: "status", header: "Status", renderer: StatusCell }, - { key: "location", header: "Location", renderer: LocationCell, hideOnMobile: true }, + { + key: "location", + header: "Location", + renderer: LocationCell, + hideOnMobile: true, + }, ]); return ( @@ -157,11 +163,7 @@ function TypeCell({ item: gearItem }: { item: GearSummary }) { } function LocationCell({ item: gearItem }: { item: GearSummary }) { - return ( - <> - {gearItem.location.shorthand} - - ); + return <>{gearItem.location.shorthand}; } const ColoredCell = styled.div<{ color?: string }>` diff --git a/src/pages/Gear/AllGearPage/GearFilters.tsx b/src/pages/Gear/AllGearPage/GearFilters.tsx index d555801..d7c4408 100644 --- a/src/pages/Gear/AllGearPage/GearFilters.tsx +++ b/src/pages/Gear/AllGearPage/GearFilters.tsx @@ -1,7 +1,7 @@ import { map } from "lodash"; -import { GearTypeMultiSelect } from "components/GearTypeSelect"; import { GearLocationSelect } from "components/GearLocationSelect"; +import { GearTypeMultiSelect } from "components/GearTypeSelect"; import { Select } from "components/Inputs/Select"; export enum GearStatusFilter { diff --git a/src/pages/Gear/GearInfoPanel.tsx b/src/pages/Gear/GearInfoPanel.tsx index 0df50da..0d7f3a6 100644 --- a/src/pages/Gear/GearInfoPanel.tsx +++ b/src/pages/Gear/GearInfoPanel.tsx @@ -1,14 +1,14 @@ +import { newApprovalUI } from "featureFlags"; import { useState } from "react"; +import { Link } from "react-router-dom"; import type { GearSummary } from "apiClient/gear"; +import { restrictedGearDoc } from "lib/constants"; import { fmtAmount } from "lib/fmtNumber"; +import { GearItemEditForm } from "./GearItemEditForm"; import { GearStatus } from "./GearStatus"; import { GearStatusForm, GearStatusFormType } from "./GearStatusForm"; -import { GearItemEditForm } from "./GearItemEditForm"; -import { Link } from "react-router-dom"; -import { newApprovalUI } from "featureFlags"; -import { restrictedGearDoc } from "lib/constants"; type Props = { gearItem: GearSummary; refreshGear: () => void }; diff --git a/src/pages/Gear/GearItemEditForm.tsx b/src/pages/Gear/GearItemEditForm.tsx index b40b0f4..3275f5b 100644 --- a/src/pages/Gear/GearItemEditForm.tsx +++ b/src/pages/Gear/GearItemEditForm.tsx @@ -1,12 +1,12 @@ -import { editGearItem, GearSummary, GearLocation } from "apiClient/gear"; +import { useState } from "react"; +import Select from "react-select"; + +import { editGearItem, GearLocation, GearSummary } from "apiClient/gear"; import { NumberField } from "components/Inputs/NumberField"; import { TextArea } from "components/Inputs/TextArea"; import { TextField } from "components/Inputs/TextField"; -import { useState } from "react"; -import Select from "react-select"; import { useGetGearLocationsQuery } from "redux/api"; - type GearLocationOption = GearLocation & { value: number; label: string }; type Props = { @@ -39,7 +39,7 @@ export function GearItemEditForm({ gearItem, closeForm, refreshGear }: Props) { setLocation({ id: gearLocationOption.id, shorthand: gearLocationOption.shorthand, - }) + }); } }; @@ -48,11 +48,17 @@ export function GearItemEditForm({ gearItem, closeForm, refreshGear }: Props) { if (deposit == null) { return; } - editGearItem(gearItem.id, specification, description, size, deposit, location.id).then( () => { - closeForm(); - refreshGear(); - } - ); + editGearItem( + gearItem.id, + specification, + description, + size, + deposit, + location.id + ).then(() => { + closeForm(); + refreshGear(); + }); }; return (
diff --git a/src/pages/Gear/GearItemPage.tsx b/src/pages/Gear/GearItemPage.tsx index 580ec66..c6b00a8 100644 --- a/src/pages/Gear/GearItemPage.tsx +++ b/src/pages/Gear/GearItemPage.tsx @@ -2,8 +2,8 @@ import { useParams } from "react-router-dom"; import { addNote } from "apiClient/gear"; import { Notes } from "components/Notes"; -import { useGetGearItemQuery } from "redux/api"; import { useSetPageTitle } from "hooks"; +import { useGetGearItemQuery } from "redux/api"; import { GearInfoPanel } from "./GearInfoPanel"; import { GearRentalsHistory } from "./GearRentalsHistory"; diff --git a/src/pages/Gear/GearRentalsHistory.tsx b/src/pages/Gear/GearRentalsHistory.tsx index 30312a4..2a7ca69 100644 --- a/src/pages/Gear/GearRentalsHistory.tsx +++ b/src/pages/Gear/GearRentalsHistory.tsx @@ -1,9 +1,9 @@ import { useEffect, useState } from "react"; -import { formatDate } from "lib/fmtDate"; import { GearRental, getGearRentalHistory } from "apiClient/gear"; -import { TablePagination } from "components/TablePagination"; import { PersonLink } from "components/PersonLink"; +import { TablePagination } from "components/TablePagination"; +import { formatDate } from "lib/fmtDate"; type Props = { gearId: string; diff --git a/src/pages/Gear/GearStatus.tsx b/src/pages/Gear/GearStatus.tsx index 8acf7c8..66f47f6 100644 --- a/src/pages/Gear/GearStatus.tsx +++ b/src/pages/Gear/GearStatus.tsx @@ -1,6 +1,6 @@ import { GearSummary } from "apiClient/gear"; -import { formatDate, formatDateTime } from "lib/fmtDate"; import { PersonLink } from "components/PersonLink"; +import { formatDate, formatDateTime } from "lib/fmtDate"; type Props = { gearItem: GearSummary; diff --git a/src/pages/Gear/GearStatusForm.tsx b/src/pages/Gear/GearStatusForm.tsx index d4f789b..5c1ca28 100644 --- a/src/pages/Gear/GearStatusForm.tsx +++ b/src/pages/Gear/GearStatusForm.tsx @@ -4,8 +4,8 @@ import { GearSummary, markBroken, markFixed, - markMissing, markFound, + markMissing, markRetired, markUnretired, } from "apiClient/gear"; diff --git a/src/pages/LogIn/LoginForm.tsx b/src/pages/LogIn/LoginForm.tsx index 746433f..3bb0c13 100644 --- a/src/pages/LogIn/LoginForm.tsx +++ b/src/pages/LogIn/LoginForm.tsx @@ -1,10 +1,10 @@ -import { useState } from "react"; import { isEmpty } from "lodash"; +import { useState } from "react"; +import { Link } from "react-router-dom"; -import { useAppDispatch } from "redux/hooks"; -import { logIn } from "redux/auth/authSlice"; import { validateEmail } from "lib/validation"; -import { Link } from "react-router-dom"; +import { logIn } from "redux/auth/authSlice"; +import { useAppDispatch } from "redux/hooks"; export function LoginForm() { const dispatch = useAppDispatch(); diff --git a/src/pages/LogIn/RequestPasswordConfirm.tsx b/src/pages/LogIn/RequestPasswordConfirm.tsx index 1735269..8a844e0 100644 --- a/src/pages/LogIn/RequestPasswordConfirm.tsx +++ b/src/pages/LogIn/RequestPasswordConfirm.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; -import { Link, useLocation } from "react-router-dom"; import { useForm } from "react-hook-form"; +import { Link, useLocation } from "react-router-dom"; import { authClient } from "apiClient/auth"; import { Form } from "components/Inputs/Form"; diff --git a/src/pages/LogIn/RequestPasswordReset.tsx b/src/pages/LogIn/RequestPasswordReset.tsx index e67ded7..ee99a7f 100644 --- a/src/pages/LogIn/RequestPasswordReset.tsx +++ b/src/pages/LogIn/RequestPasswordReset.tsx @@ -1,10 +1,9 @@ import { useState } from "react"; - -import { validateEmail } from "lib/validation"; -import { authClient } from "apiClient/auth"; import { useLocation } from "react-router-dom"; +import { authClient } from "apiClient/auth"; import { useSetPageTitle } from "hooks"; +import { validateEmail } from "lib/validation"; export function RequestPasswordReset() { useSetPageTitle("Reset password"); diff --git a/src/pages/OfficeHours/ApproveDeskCreditPage.tsx b/src/pages/OfficeHours/ApproveDeskCreditPage.tsx index f382f10..1b6c141 100644 --- a/src/pages/OfficeHours/ApproveDeskCreditPage.tsx +++ b/src/pages/OfficeHours/ApproveDeskCreditPage.tsx @@ -1,10 +1,11 @@ +import { isEmpty } from "lodash"; +import { FormProvider, useForm } from "react-hook-form"; + import { approveCredit } from "apiClient/officeHours"; import { Signup } from "apiClient/types"; import { LabeledInput } from "components/Inputs/LabeledInput"; import { useSetPageTitle } from "hooks"; import { formatDate, formatDateTime, formatDuration } from "lib/fmtDate"; -import { isEmpty } from "lodash"; -import { FormProvider, useForm } from "react-hook-form"; import { useGetSignupsQuery } from "redux/api"; export function ApproveDeskCreditPage() { diff --git a/src/pages/OfficeHours/MyOfficeHoursHistory.tsx b/src/pages/OfficeHours/MyOfficeHoursHistory.tsx index c52aca8..885b97d 100644 --- a/src/pages/OfficeHours/MyOfficeHoursHistory.tsx +++ b/src/pages/OfficeHours/MyOfficeHoursHistory.tsx @@ -4,6 +4,7 @@ import { TablePagination } from "components/TablePagination"; import { useSetPageTitle } from "hooks"; import { useGetPersonSignupsQuery } from "redux/api"; import { useCurrentUser } from "redux/auth"; + import { OfficeHoursSignupsTable } from "./OfficeHoursSignupsTable"; export function MyOfficeHoursHistory() { diff --git a/src/pages/OfficeHours/OfficeHoursHistory.tsx b/src/pages/OfficeHours/OfficeHoursHistory.tsx index 61606c8..d917c0f 100644 --- a/src/pages/OfficeHours/OfficeHoursHistory.tsx +++ b/src/pages/OfficeHours/OfficeHoursHistory.tsx @@ -1,11 +1,11 @@ import dayjs from "dayjs"; - import { useEffect, useState } from "react"; +import { Checkbox } from "components/Inputs/Checkbox"; import { TablePagination } from "components/TablePagination"; import { useSetPageTitle } from "hooks"; import { useGetSignupsQuery } from "redux/api"; -import { Checkbox } from "components/Inputs/Checkbox"; + import { OfficeHoursSignupsTable } from "./OfficeHoursSignupsTable"; export function OfficeHoursHistory() { diff --git a/src/pages/OfficeHours/OfficeHoursPage.tsx b/src/pages/OfficeHours/OfficeHoursPage.tsx index 605f2c2..8d3b9b9 100644 --- a/src/pages/OfficeHours/OfficeHoursPage.tsx +++ b/src/pages/OfficeHours/OfficeHoursPage.tsx @@ -1,16 +1,16 @@ -import styled from "styled-components"; import dayjs from "dayjs"; -import weekOfYears from "dayjs/plugin/weekOfYear"; import customParseFormat from "dayjs/plugin/customParseFormat"; +import weekOfYears from "dayjs/plugin/weekOfYear"; +import { groupBy, isEmpty, map } from "lodash"; +import React, { useEffect, useState } from "react"; +import styled from "styled-components"; import { cancelSignUp, signUp } from "apiClient/officeHours"; +import { OfficeHour } from "apiClient/types"; import { PersonLink } from "components/PersonLink"; import { useSetPageTitle } from "hooks"; -import { groupBy, isEmpty, map } from "lodash"; import { useGetOfficeHoursQuery } from "redux/api"; import { useCurrentUser } from "redux/auth"; -import { OfficeHour } from "apiClient/types"; -import React, { useEffect, useState } from "react"; dayjs.extend(weekOfYears); dayjs.extend(customParseFormat); diff --git a/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditForm.tsx b/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditForm.tsx index eb1a391..73b8dfc 100644 --- a/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditForm.tsx +++ b/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditForm.tsx @@ -1,18 +1,18 @@ +import dayjs from "dayjs"; +import { isEmpty } from "lodash"; import { useEffect, useMemo } from "react"; - -import { useGetPersonSignupsQuery } from "redux/api"; -import { useCurrentUser } from "redux/auth"; -import Select from "react-select"; -import { LabeledInput } from "components/Inputs/LabeledInput"; import { FormProvider, useForm } from "react-hook-form"; -import { formatDate } from "lib/fmtDate"; -import dayjs from "dayjs"; +import { Link } from "react-router-dom"; +import Select from "react-select"; + import { requestOfficeHourCredit, requestOtherEventCredit, } from "apiClient/officeHours"; -import { isEmpty } from "lodash"; -import { Link } from "react-router-dom"; +import { LabeledInput } from "components/Inputs/LabeledInput"; +import { formatDate } from "lib/fmtDate"; +import { useGetPersonSignupsQuery } from "redux/api"; +import { useCurrentUser } from "redux/auth"; type FormValues = { signup: { value: number; label: string }; diff --git a/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditPage.tsx b/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditPage.tsx index 017679a..ef26947 100644 --- a/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditPage.tsx +++ b/src/pages/OfficeHours/RequestDeskCreditPage/RequestDeskCreditPage.tsx @@ -1,10 +1,10 @@ -import { useMemo, useState } from "react"; import { isEmpty } from "lodash"; +import { useMemo, useState } from "react"; import { useSetPageTitle } from "hooks"; +import { formatDate, formatDateTime, formatDuration } from "lib/fmtDate"; import { useGetPersonSignupsQuery } from "redux/api"; import { useCurrentUser } from "redux/auth"; -import { formatDate, formatDateTime, formatDuration } from "lib/fmtDate"; import { RequestDeskCreditForm } from "./RequestDeskCreditForm"; import { RequestDeskCreditResults } from "./RequestDeskCreditResults"; diff --git a/src/pages/People/AddNewPerson/AddNewPerson.tsx b/src/pages/People/AddNewPerson/AddNewPerson.tsx index 8dedbef..50a30a0 100644 --- a/src/pages/People/AddNewPerson/AddNewPerson.tsx +++ b/src/pages/People/AddNewPerson/AddNewPerson.tsx @@ -3,12 +3,12 @@ import { useForm } from "react-hook-form"; import { Link, useHistory } from "react-router-dom"; import { APIError as APIErrorClass } from "apiClient/client"; +import { createPerson } from "apiClient/people"; import { APIErrorType } from "apiClient/types"; -import { validateEmail } from "lib/validation"; -import { LabeledInput } from "components/Inputs/LabeledInput"; import { Form } from "components/Inputs/Form"; -import { createPerson } from "apiClient/people"; +import { LabeledInput } from "components/Inputs/LabeledInput"; import { useSetPageTitle } from "hooks"; +import { validateEmail } from "lib/validation"; import { AddNewPersonError } from "./AddNewPersonError"; diff --git a/src/pages/People/BuyGear.tsx b/src/pages/People/BuyGear.tsx index 146def9..a6f6940 100644 --- a/src/pages/People/BuyGear.tsx +++ b/src/pages/People/BuyGear.tsx @@ -1,9 +1,9 @@ -import { useGetPurchasablesQuery } from "redux/api"; import { useState } from "react"; +import { SearchTextField } from "components/Inputs/TextField"; import { fmtAmount } from "lib/fmtNumber"; import { uniqueID } from "lib/uniqueID"; -import { SearchTextField } from "components/Inputs/TextField"; +import { useGetPurchasablesQuery } from "redux/api"; import { usePersonPageContext } from "./PeoplePage/PersonPageContext"; diff --git a/src/pages/People/CheckoutStaging.tsx b/src/pages/People/CheckoutStaging.tsx index d9387a1..a351cc5 100644 --- a/src/pages/People/CheckoutStaging.tsx +++ b/src/pages/People/CheckoutStaging.tsx @@ -1,9 +1,9 @@ -import { sum, map } from "lodash"; +import { map, sum } from "lodash"; import type { Person } from "apiClient/people"; +import { RemoveButton } from "components/Buttons"; import { GearLink } from "components/GearLink"; import { fmtAmount } from "lib/fmtNumber"; -import { RemoveButton } from "components/Buttons"; import { usePersonPageContext } from "./PeoplePage/PersonPageContext"; diff --git a/src/pages/People/MoreGear.tsx b/src/pages/People/MoreGear.tsx index 7df7f22..12c09ff 100644 --- a/src/pages/People/MoreGear.tsx +++ b/src/pages/People/MoreGear.tsx @@ -1,11 +1,11 @@ import { useState } from "react"; import styled from "styled-components"; -import { useGearList } from "redux/api"; -import { TablePagination } from "components/TablePagination"; import { GearLink } from "components/GearLink"; import { SearchTextField } from "components/Inputs/TextField"; +import { TablePagination } from "components/TablePagination"; import { fmtAmount } from "lib/fmtNumber"; +import { useGearList } from "redux/api"; import { usePersonPageContext } from "./PeoplePage/PersonPageContext"; diff --git a/src/pages/People/PeoplePage/PeopleFilters.tsx b/src/pages/People/PeoplePage/PeopleFilters.tsx index 3167bc3..106b3b4 100644 --- a/src/pages/People/PeoplePage/PeopleFilters.tsx +++ b/src/pages/People/PeoplePage/PeopleFilters.tsx @@ -1,7 +1,7 @@ import { map } from "lodash"; -import { Checkbox } from "components/Inputs/Checkbox"; import { GroupSelect } from "components/GroupSelect"; +import { Checkbox } from "components/Inputs/Checkbox"; export type Filters = { q?: string; diff --git a/src/pages/People/PeoplePage/PeoplePage.tsx b/src/pages/People/PeoplePage/PeoplePage.tsx index fe19140..055161d 100644 --- a/src/pages/People/PeoplePage/PeoplePage.tsx +++ b/src/pages/People/PeoplePage/PeoplePage.tsx @@ -1,16 +1,15 @@ import { isEmpty, max } from "lodash"; import { useState } from "react"; - -import styled from "styled-components"; import { Link } from "react-router-dom"; +import styled from "styled-components"; import { PersonSummary } from "apiClient/people"; import { DataGrid } from "components/DataGrid"; -import { TablePagination } from "components/TablePagination"; import { SearchTextField } from "components/Inputs/TextField"; import { PersonLink } from "components/PersonLink"; -import { usePeopleList } from "redux/api"; +import { TablePagination } from "components/TablePagination"; import { useSetPageTitle } from "hooks"; +import { usePeopleList } from "redux/api"; import { PeopleFilters } from "./PeopleFilters"; import { usePeopleFilters } from "./usePeopleFilters"; diff --git a/src/pages/People/PeoplePage/PersonPageContext.tsx b/src/pages/People/PeoplePage/PersonPageContext.tsx index 98678fb..2ee838b 100644 --- a/src/pages/People/PeoplePage/PersonPageContext.tsx +++ b/src/pages/People/PeoplePage/PersonPageContext.tsx @@ -1,10 +1,11 @@ +import { flow, keyBy, map, mapValues, sum } from "lodash"; import React, { useContext, useState } from "react"; import { GearSummary } from "apiClient/gear"; import { checkoutGear, Person, Rental, returnGear } from "apiClient/people"; -import { flow, keyBy, map, mapValues, sum } from "lodash"; import { ItemToPurchase } from "../types"; + import { useBasket } from "./useBasket"; export const isWinterSchool = false; // TODO: This should be read from the database diff --git a/src/pages/People/PersonPage.tsx b/src/pages/People/PersonPage.tsx index f099dd7..a930b32 100644 --- a/src/pages/People/PersonPage.tsx +++ b/src/pages/People/PersonPage.tsx @@ -1,24 +1,24 @@ +import { isEmpty } from "lodash"; import { useState } from "react"; import { useParams } from "react-router-dom"; -import { isEmpty } from "lodash"; import { addNote, archiveNote } from "apiClient/people"; import { Notes } from "components/Notes"; -import { useGetPersonQuery } from "redux/api"; import { useSetPageTitle } from "hooks"; +import { useGetPersonQuery } from "redux/api"; -import { PersonProfile } from "./PersonProfile"; -import { PersonRentals } from "./PersonRentals"; -import { MoreGear } from "./MoreGear"; import { BuyGear } from "./BuyGear"; -import { PersonTabsSelector, PersonPageTabs } from "./PersonTabs"; -import { PersonRentalsHistory } from "./PersonRentalsHistory"; import { CheckoutStaging } from "./CheckoutStaging"; -import { ReturnStaging } from "./ReturnStaging"; +import { MoreGear } from "./MoreGear"; import { PersonPageContextProvider, usePersonPageContext, } from "./PeoplePage/PersonPageContext"; +import { PersonProfile } from "./PersonProfile"; +import { PersonRentals } from "./PersonRentals"; +import { PersonRentalsHistory } from "./PersonRentalsHistory"; +import { PersonPageTabs, PersonTabsSelector } from "./PersonTabs"; +import { ReturnStaging } from "./ReturnStaging"; export function PersonPage() { const { personId } = useParams<{ personId: string }>(); diff --git a/src/pages/People/PersonProfile/ExpirableTile.tsx b/src/pages/People/PersonProfile/ExpirableTile.tsx index f191b37..f24e0a9 100644 --- a/src/pages/People/PersonProfile/ExpirableTile.tsx +++ b/src/pages/People/PersonProfile/ExpirableTile.tsx @@ -1,10 +1,9 @@ import { useState } from "react"; import styled from "styled-components"; -import { formatDate } from "lib/fmtDate"; - import type { Expireable, Person } from "apiClient/people"; import { ToggleExpandButton } from "components/Buttons"; +import { formatDate } from "lib/fmtDate"; export function ExpirableTile({ title, diff --git a/src/pages/People/PersonProfile/FrequentFlyerForm.tsx b/src/pages/People/PersonProfile/FrequentFlyerForm.tsx index 30c2a31..c2147e7 100644 --- a/src/pages/People/PersonProfile/FrequentFlyerForm.tsx +++ b/src/pages/People/PersonProfile/FrequentFlyerForm.tsx @@ -1,11 +1,13 @@ +import "react-datepicker/dist/react-datepicker.css"; + import { useState } from "react"; import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; import { addFFChecks, Person } from "apiClient/people"; -import { getNextExpirationDate } from "./utils"; import { useGetPersonQuery } from "redux/api"; +import { getNextExpirationDate } from "./utils"; + type Props = { person: Person; onClose: () => void; diff --git a/src/pages/People/PersonProfile/MembershipForm.tsx b/src/pages/People/PersonProfile/MembershipForm.tsx index e027a54..9525402 100644 --- a/src/pages/People/PersonProfile/MembershipForm.tsx +++ b/src/pages/People/PersonProfile/MembershipForm.tsx @@ -1,12 +1,14 @@ +import "react-datepicker/dist/react-datepicker.css"; + import { useEffect, useState } from "react"; import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; import { addMembership, Person } from "apiClient/people"; import { Select } from "components/Inputs/Select"; -import { getNextExpirationDate } from "./utils"; import { useGetAffiliationsQuery, useGetPersonQuery } from "redux/api"; +import { getNextExpirationDate } from "./utils"; + type Props = { person: Person; onClose: () => void; diff --git a/src/pages/People/PersonProfile/MitocCreditForm.tsx b/src/pages/People/PersonProfile/MitocCreditForm.tsx index 7256829..6503729 100644 --- a/src/pages/People/PersonProfile/MitocCreditForm.tsx +++ b/src/pages/People/PersonProfile/MitocCreditForm.tsx @@ -1,8 +1,8 @@ import { useState } from "react"; import { addMitocCredit, Person } from "apiClient/people"; -import { useGetPersonQuery } from "redux/api"; import { NumberField } from "components/Inputs/NumberField"; +import { useGetPersonQuery } from "redux/api"; type Props = { person: Person; diff --git a/src/pages/People/PersonProfile/PeopleGroups.tsx b/src/pages/People/PersonProfile/PeopleGroups.tsx index d539012..f559738 100644 --- a/src/pages/People/PersonProfile/PeopleGroups.tsx +++ b/src/pages/People/PersonProfile/PeopleGroups.tsx @@ -1,9 +1,9 @@ -import { useState } from "react"; import { isEmpty, map } from "lodash"; +import { useState } from "react"; import { PeopleGroup, Person, updatePersonGroups } from "apiClient/people"; -import { usePermissions } from "redux/auth"; import { GroupSelect } from "components/GroupSelect"; +import { usePermissions } from "redux/auth"; type Props = { person: Person; diff --git a/src/pages/People/PersonProfile/PersonChangePassword.tsx b/src/pages/People/PersonProfile/PersonChangePassword.tsx index c94f82c..a705613 100644 --- a/src/pages/People/PersonProfile/PersonChangePassword.tsx +++ b/src/pages/People/PersonProfile/PersonChangePassword.tsx @@ -1,14 +1,14 @@ -import { useForm } from "react-hook-form"; import { useState } from "react"; +import { useForm } from "react-hook-form"; import { authClient } from "apiClient/auth"; import { APIError } from "apiClient/client"; -import { useAppDispatch } from "redux/hooks"; import { Form } from "components/Inputs/Form"; import { LabeledInput } from "components/Inputs/LabeledInput"; +import { useSetPageTitle } from "hooks"; import { logIn } from "redux/auth"; import { useCurrentUser } from "redux/auth/hooks"; -import { useSetPageTitle } from "hooks"; +import { useAppDispatch } from "redux/hooks"; type FormValues = { oldPassword: string; diff --git a/src/pages/People/PersonProfile/PersonEditForm.tsx b/src/pages/People/PersonProfile/PersonEditForm.tsx index 597edd3..df742c7 100644 --- a/src/pages/People/PersonProfile/PersonEditForm.tsx +++ b/src/pages/People/PersonProfile/PersonEditForm.tsx @@ -1,11 +1,11 @@ +import { isEmpty, map } from "lodash"; import { useFieldArray, useForm } from "react-hook-form"; +import styled from "styled-components"; +import { editPerson, Person } from "apiClient/people"; import { Form } from "components/Inputs/Form"; import { LabeledInput } from "components/Inputs/LabeledInput"; -import { editPerson, Person } from "apiClient/people"; import { validateEmail } from "lib/validation"; -import styled from "styled-components"; -import { isEmpty, map } from "lodash"; type Props = { person: Person; diff --git a/src/pages/People/PersonProfile/PersonProfile.tsx b/src/pages/People/PersonProfile/PersonProfile.tsx index b0d812d..91bf327 100644 --- a/src/pages/People/PersonProfile/PersonProfile.tsx +++ b/src/pages/People/PersonProfile/PersonProfile.tsx @@ -1,17 +1,18 @@ +import { useState } from "react"; +import styled from "styled-components"; + import { ToggleExpandButton } from "components/Buttons"; +import { usePermissions } from "redux/auth"; + +import { usePersonPageContext } from "../PeoplePage/PersonPageContext"; import { ColoredTile, ExpirableTile } from "./ExpirableTile"; import { FrequentFlyerForm } from "./FrequentFlyerForm"; -import { WaiverForm } from "./WaiverForm"; import { MembershipForm } from "./MembershipForm"; -import { useState } from "react"; -import { PersonEditForm } from "./PersonEditForm"; import { MitocCreditForm } from "./MitocCreditForm"; -import { usePermissions } from "redux/auth"; - import PeopleGroups from "./PeopleGroups"; -import styled from "styled-components"; -import { usePersonPageContext } from "../PeoplePage/PersonPageContext"; +import { PersonEditForm } from "./PersonEditForm"; +import { WaiverForm } from "./WaiverForm"; export function PersonProfile() { const [isEditing, setEditing] = useState(false); diff --git a/src/pages/People/PersonProfile/WaiverForm.tsx b/src/pages/People/PersonProfile/WaiverForm.tsx index ec62e4b..10b74b2 100644 --- a/src/pages/People/PersonProfile/WaiverForm.tsx +++ b/src/pages/People/PersonProfile/WaiverForm.tsx @@ -1,11 +1,13 @@ +import "react-datepicker/dist/react-datepicker.css"; + import { useState } from "react"; import DatePicker from "react-datepicker"; -import "react-datepicker/dist/react-datepicker.css"; import { addWaiver, Person } from "apiClient/people"; -import { getNextExpirationDate } from "./utils"; import { useGetPersonQuery } from "redux/api"; +import { getNextExpirationDate } from "./utils"; + type Props = { person: Person; onClose: () => void; diff --git a/src/pages/People/PersonRentals.tsx b/src/pages/People/PersonRentals.tsx index 83cb340..9818f76 100644 --- a/src/pages/People/PersonRentals.tsx +++ b/src/pages/People/PersonRentals.tsx @@ -1,6 +1,7 @@ -import { formatDate } from "lib/fmtDate"; import { GearLink } from "components/GearLink"; +import { formatDate } from "lib/fmtDate"; import { fmtAmount } from "lib/fmtNumber"; + import { usePersonPageContext } from "./PeoplePage/PersonPageContext"; export function PersonRentals() { diff --git a/src/pages/People/PersonRentalsHistory.tsx b/src/pages/People/PersonRentalsHistory.tsx index 2289645..7172dc6 100644 --- a/src/pages/People/PersonRentalsHistory.tsx +++ b/src/pages/People/PersonRentalsHistory.tsx @@ -1,9 +1,9 @@ import { useEffect, useState } from "react"; -import { formatDate } from "lib/fmtDate"; -import { Rental, getPersonRentalHistory } from "apiClient/people"; -import { TablePagination } from "components/TablePagination"; +import { getPersonRentalHistory, Rental } from "apiClient/people"; import { GearLink } from "components/GearLink"; +import { TablePagination } from "components/TablePagination"; +import { formatDate } from "lib/fmtDate"; type Props = { personId: string; diff --git a/src/pages/People/ReturnStaging/PaymentSummary.tsx b/src/pages/People/ReturnStaging/PaymentSummary.tsx index c7da566..fca775c 100644 --- a/src/pages/People/ReturnStaging/PaymentSummary.tsx +++ b/src/pages/People/ReturnStaging/PaymentSummary.tsx @@ -1,13 +1,13 @@ -import styled from "styled-components"; -import { ButtonHTMLAttributes, useState } from "react"; -import { isEmpty } from "lodash"; +import { faEdit, faPen, faRefresh } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faEdit, faRefresh, faPen } from "@fortawesome/free-solid-svg-icons"; +import { isEmpty } from "lodash"; +import { ButtonHTMLAttributes, useState } from "react"; import { OverlayTrigger, Tooltip } from "react-bootstrap"; +import styled from "styled-components"; -import { fmtAmount } from "lib/fmtNumber"; -import { NumberField } from "components/Inputs/NumberField"; import { Checkbox } from "components/Inputs/Checkbox"; +import { NumberField } from "components/Inputs/NumberField"; +import { fmtAmount } from "lib/fmtNumber"; import { isWinterSchool, diff --git a/src/pages/People/ReturnStaging/ReturnStaging.tsx b/src/pages/People/ReturnStaging/ReturnStaging.tsx index 0572332..863eea0 100644 --- a/src/pages/People/ReturnStaging/ReturnStaging.tsx +++ b/src/pages/People/ReturnStaging/ReturnStaging.tsx @@ -1,20 +1,21 @@ +import { isEmpty } from "lodash"; import { useState } from "react"; import styled from "styled-components"; -import { isEmpty } from "lodash"; +import { RemoveButton } from "components/Buttons"; +import { GearLink } from "components/GearLink"; import { Checkbox } from "components/Inputs/Checkbox"; import { NumberField } from "components/Inputs/NumberField"; -import { GearLink } from "components/GearLink"; -import { RemoveButton } from "components/Buttons"; -import { fmtAmount } from "lib/fmtNumber"; import { formatDate } from "lib/fmtDate"; +import { fmtAmount } from "lib/fmtNumber"; -import { WinterSchoolDisclaimer } from "./WinterSchoolDisclaimer"; import { isWinterSchool, usePersonPageContext, } from "../PeoplePage/PersonPageContext"; + import { PaymentSummary } from "./PaymentSummary"; +import { WinterSchoolDisclaimer } from "./WinterSchoolDisclaimer"; export function ReturnStaging() { const { returnBasket, purchaseBasket } = usePersonPageContext(); diff --git a/src/redux/api.ts b/src/redux/api.ts index 8c513af..e89b255 100644 --- a/src/redux/api.ts +++ b/src/redux/api.ts @@ -1,14 +1,17 @@ import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; +import { isEmpty } from "lodash"; import queryString from "query-string"; -import { Person, PersonSummary, PeopleGroup } from "apiClient/people"; +import { Approval } from "apiClient/approvals"; +import { API_HOST } from "apiClient/client"; import type { GearItem, + GearLocation, GearSummary, GearType, - GearLocation, PurchasableItem, } from "apiClient/gear"; +import { PeopleGroup, Person, PersonSummary } from "apiClient/people"; import { Affiliations, ListWrapper, @@ -16,9 +19,6 @@ import { PersonSignup, Signup, } from "apiClient/types"; -import { API_HOST } from "apiClient/client"; -import { isEmpty } from "lodash"; -import { Approval } from "apiClient/approvals"; export const gearDbApi = createApi({ reducerPath: "gearDbApi", diff --git a/src/redux/auth/authSlice.ts b/src/redux/auth/authSlice.ts index c868f76..6222152 100644 --- a/src/redux/auth/authSlice.ts +++ b/src/redux/auth/authSlice.ts @@ -1,9 +1,10 @@ -import { createSlice, createAsyncThunk } from "@reduxjs/toolkit"; +import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"; import { authClient } from "apiClient/auth"; -import type { User, APIErrorType } from "apiClient/types"; +import type { APIErrorType, User } from "apiClient/types"; import { createCustomAsyncThunk } from "../tools"; + export interface AuthState { loadingStatus: "loading" | "idle" | "blank"; loggedIn?: boolean; @@ -39,8 +40,7 @@ const authSlice = createSlice({ state.loadingStatus = "idle"; if (action.payload == null) { state.error = { - msg: - "Unable to reach API server. Please try again later and/or contact mitoc-webmaster@mit.edu", + msg: "Unable to reach API server. Please try again later and/or contact mitoc-webmaster@mit.edu", err: "unavailableServer", }; return; @@ -48,8 +48,7 @@ const authSlice = createSlice({ const payload = action.payload as APIErrorType; if ((payload.err = "userDoesNotMatchPerson")) { state.error = { - msg: - "This user account is not associated with a desk worker person. Please contact mitoc-desk@mit.edu to fix the issue.", + msg: "This user account is not associated with a desk worker person. Please contact mitoc-desk@mit.edu to fix the issue.", err: payload.err, }; return; diff --git a/src/redux/hooks.ts b/src/redux/hooks.ts index 6617d58..8b8f1d5 100644 --- a/src/redux/hooks.ts +++ b/src/redux/hooks.ts @@ -1,6 +1,6 @@ import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"; -import type { RootState, AppDispatch } from "./store"; +import type { AppDispatch, RootState } from "./store"; // Use throughout your app instead of plain `useDispatch` and `useSelector` export const useAppDispatch = () => useDispatch(); diff --git a/src/redux/store.ts b/src/redux/store.ts index 4382c6d..591747a 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -1,7 +1,7 @@ -import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit"; +import { Action, configureStore, ThunkAction } from "@reduxjs/toolkit"; -import authReducer from "./auth/authSlice"; import { gearDbApi } from "./api"; +import authReducer from "./auth/authSlice"; export const store = configureStore({ reducer: {