From efeaf4b3d6e50d8d97d71bc112377fc7716ff117 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Tue, 13 Jul 2021 20:02:04 -0400 Subject: [PATCH] move several functions to the lib/ folder --- src/components/Carpool/InvitationsAndRequests.tsx | 2 +- src/components/Carpool/MemberList.tsx | 2 +- src/components/Event/Event.tsx | 2 +- src/components/Event/EventCarpools.tsx | 2 +- src/components/Event/EventDetails.tsx | 2 +- src/components/Event/EventSignups.tsx | 2 +- src/components/EventCreator/DaysOfWeekSelector.tsx | 4 ++-- src/components/EventCreator/EventCreator.tsx | 2 +- src/components/UI/UIPlacesAutocomplete.tsx | 2 +- src/components/usePlace.ts | 2 +- src/{components => lib}/bits.ts | 0 src/{components => lib}/colors.ts | 0 src/{components => lib}/dates.ts | 0 src/{components => lib}/getPlaceDetails.ts | 0 src/{components => lib}/latlongdist.ts | 0 src/{components => lib}/localstorage.ts | 0 src/{components => lib}/wslrucache.ts | 0 17 files changed, 11 insertions(+), 11 deletions(-) rename src/{components => lib}/bits.ts (100%) rename src/{components => lib}/colors.ts (100%) rename src/{components => lib}/dates.ts (100%) rename src/{components => lib}/getPlaceDetails.ts (100%) rename src/{components => lib}/latlongdist.ts (100%) rename src/{components => lib}/localstorage.ts (100%) rename src/{components => lib}/wslrucache.ts (100%) diff --git a/src/components/Carpool/InvitationsAndRequests.tsx b/src/components/Carpool/InvitationsAndRequests.tsx index f18b301..5253049 100644 --- a/src/components/Carpool/InvitationsAndRequests.tsx +++ b/src/components/Carpool/InvitationsAndRequests.tsx @@ -1,4 +1,4 @@ -import { lightgrey } from '../colors'; +import { lightgrey } from '../../lib/colors'; import UIButton from '../UI/UIButton'; import InvitationList from './InvitationList'; import MailOutlineIcon from '@material-ui/icons/MailOutline'; diff --git a/src/components/Carpool/MemberList.tsx b/src/components/Carpool/MemberList.tsx index 31a2150..a768e4e 100644 --- a/src/components/Carpool/MemberList.tsx +++ b/src/components/Carpool/MemberList.tsx @@ -4,7 +4,7 @@ import { useMemo } from 'react'; import { useContext } from 'react'; import { useInvitationState } from '../../state/Notifications/NotificationsHooks'; import { NotificationsContext } from '../../state/Notifications/NotificationsProvider'; -import { lightgrey } from '../colors'; +import { lightgrey } from '../../lib/colors'; import { useMe } from '../hooks'; import UIButton from '../UI/UIButton'; import { CarpoolContext } from './Carpool'; diff --git a/src/components/Event/Event.tsx b/src/components/Event/Event.tsx index 499781f..9b6092e 100644 --- a/src/components/Event/Event.tsx +++ b/src/components/Event/Event.tsx @@ -4,7 +4,7 @@ import { getEventSignups, removeEventSignup, } from '../api'; -import { green, lightgrey } from '../colors'; +import { green, lightgrey } from '../../lib/colors'; import { useMe } from '../hooks'; import { IEvent, IEventSignup } from '../types'; import UIButton from '../UI/UIButton'; diff --git a/src/components/Event/EventCarpools.tsx b/src/components/Event/EventCarpools.tsx index eb531dc..f4418d9 100644 --- a/src/components/Event/EventCarpools.tsx +++ b/src/components/Event/EventCarpools.tsx @@ -2,7 +2,7 @@ import EmojiPeopleIcon from '@material-ui/icons/EmojiPeople'; import { useCallback, useMemo, useState } from 'react'; import { createCarpool } from '../api'; -import { lightgrey } from '../colors'; +import { lightgrey } from '../../lib/colors'; import { useMe } from '../hooks'; import { IEvent } from '../types'; import UIButton from '../UI/UIButton'; diff --git a/src/components/Event/EventDetails.tsx b/src/components/Event/EventDetails.tsx index 1e13d6e..e9363e2 100644 --- a/src/components/Event/EventDetails.tsx +++ b/src/components/Event/EventDetails.tsx @@ -1,4 +1,4 @@ -import formatStartAndEndTime from '../dates'; +import formatStartAndEndTime from '../../lib/dates'; import EventIcon from '@material-ui/icons/Event'; import LocationOnIcon from '@material-ui/icons/LocationOn'; diff --git a/src/components/Event/EventSignups.tsx b/src/components/Event/EventSignups.tsx index 77d45ff..50d9b09 100644 --- a/src/components/Event/EventSignups.tsx +++ b/src/components/Event/EventSignups.tsx @@ -1,6 +1,6 @@ import PersonAddIcon from '@material-ui/icons/PersonAdd'; import { useMe } from '../hooks'; -import latlongdist, { R_miles } from '../latlongdist'; +import latlongdist, { R_miles } from '../../lib/latlongdist'; import { IEventSignup, IEvent } from '../types'; import usePlace from '../usePlace'; diff --git a/src/components/EventCreator/DaysOfWeekSelector.tsx b/src/components/EventCreator/DaysOfWeekSelector.tsx index f78ecbc..b99ab41 100644 --- a/src/components/EventCreator/DaysOfWeekSelector.tsx +++ b/src/components/EventCreator/DaysOfWeekSelector.tsx @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useCallback } from 'react'; -import { toggleBit } from '../bits'; -import { green, lightgrey } from '../colors'; +import { toggleBit } from '../../lib/bits'; +import { green, lightgrey } from '../../lib/colors'; const DAY_NAMES = [ 'Sunday', diff --git a/src/components/EventCreator/EventCreator.tsx b/src/components/EventCreator/EventCreator.tsx index 9c4a95b..fe9fc91 100644 --- a/src/components/EventCreator/EventCreator.tsx +++ b/src/components/EventCreator/EventCreator.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import { createEvent } from '../api'; -import { green, lightgrey } from '../colors'; +import { green, lightgrey } from '../../lib/colors'; import { IGroup } from '../Group'; import UIButton from '../UI/UIButton'; import UIDateInput from '../UI/UIDateInput'; diff --git a/src/components/UI/UIPlacesAutocomplete.tsx b/src/components/UI/UIPlacesAutocomplete.tsx index 69064fa..4be8dde 100644 --- a/src/components/UI/UIPlacesAutocomplete.tsx +++ b/src/components/UI/UIPlacesAutocomplete.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react'; import { CSSProperties, useRef, useState } from 'react'; import PlacesAutocomplete, { Suggestion } from 'react-places-autocomplete'; -import getPlaceDetails from '../getPlaceDetails'; +import getPlaceDetails from '../../lib/getPlaceDetails'; type Opts = Parameters['0']; diff --git a/src/components/usePlace.ts b/src/components/usePlace.ts index 31dbf49..dfa5f28 100644 --- a/src/components/usePlace.ts +++ b/src/components/usePlace.ts @@ -1,5 +1,5 @@ import { useState, useEffect, useCallback } from 'react'; -import getPlaceDetails, { PlaceDetails } from './getPlaceDetails'; +import getPlaceDetails, { PlaceDetails } from '../lib/getPlaceDetails'; import useThrottle from './useThrottle'; export default function usePlace(placeId: string | null) { diff --git a/src/components/bits.ts b/src/lib/bits.ts similarity index 100% rename from src/components/bits.ts rename to src/lib/bits.ts diff --git a/src/components/colors.ts b/src/lib/colors.ts similarity index 100% rename from src/components/colors.ts rename to src/lib/colors.ts diff --git a/src/components/dates.ts b/src/lib/dates.ts similarity index 100% rename from src/components/dates.ts rename to src/lib/dates.ts diff --git a/src/components/getPlaceDetails.ts b/src/lib/getPlaceDetails.ts similarity index 100% rename from src/components/getPlaceDetails.ts rename to src/lib/getPlaceDetails.ts diff --git a/src/components/latlongdist.ts b/src/lib/latlongdist.ts similarity index 100% rename from src/components/latlongdist.ts rename to src/lib/latlongdist.ts diff --git a/src/components/localstorage.ts b/src/lib/localstorage.ts similarity index 100% rename from src/components/localstorage.ts rename to src/lib/localstorage.ts diff --git a/src/components/wslrucache.ts b/src/lib/wslrucache.ts similarity index 100% rename from src/components/wslrucache.ts rename to src/lib/wslrucache.ts