diff --git a/front/src/api/announcements/types.ts b/front/src/api/announcements/types.ts index 37e86cc..3d4b91c 100644 --- a/front/src/api/announcements/types.ts +++ b/front/src/api/announcements/types.ts @@ -4,7 +4,7 @@ import { AnnouncementResponse, isAnnouncementResponse } from '../announcement/ty type AnnouncementsResponse = AnnouncementResponse[] const isAnnouncementsResponse = (obj: unknown): obj is AnnouncementsResponse => ( - isArrayOf(obj, isAnnouncementResponse) + isArrayOf(obj, isAnnouncementResponse) ) export type { diff --git a/front/src/api/trashbox/types.ts b/front/src/api/trashbox/types.ts index 7458354..6a7d1da 100644 --- a/front/src/api/trashbox/types.ts +++ b/front/src/api/trashbox/types.ts @@ -14,7 +14,7 @@ const isTrashbox = (obj: unknown): obj is Trashbox => ( 'Lat': 'number', 'Lng': 'number', 'Address': 'string', - 'Categories': obj => isArrayOf(obj, isString), + 'Categories': obj => isArrayOf(obj, isString), }) ) diff --git a/front/src/components/AuthForm.tsx b/front/src/components/AuthForm.tsx index 3f1dd89..8ba4472 100644 --- a/front/src/components/AuthForm.tsx +++ b/front/src/components/AuthForm.tsx @@ -51,7 +51,11 @@ const AuthForm = ({ goBack }: AuthFormProps) => { - Я согласен с условиями обработки персональных данных + Я согласен с{' '} + условиями обработки персональных данных diff --git a/front/src/components/CardLayout.tsx b/front/src/components/CardLayout.tsx index 0c163b8..28bc4ae 100644 --- a/front/src/components/CardLayout.tsx +++ b/front/src/components/CardLayout.tsx @@ -1,7 +1,7 @@ import { PropsWithChildren } from 'react' import { Card } from 'react-bootstrap' -import { BackHeader } from '.' +import BackHeader from './BackHeader' type CardLayoutProps = { text: string, diff --git a/front/src/components/CategoryPreview.tsx b/front/src/components/CategoryPreview.tsx index d711b61..1416930 100644 --- a/front/src/components/CategoryPreview.tsx +++ b/front/src/components/CategoryPreview.tsx @@ -1,4 +1,4 @@ -import { StoriesPreview } from '.' +import StoriesPreview from './StoriesPreview' import { UserCategoriesNames, UserCategory, composeUserCategoriesFilters } from '../assets/userCategories' import { useAnnouncements } from '../hooks/api' import { gotError, gotResponse } from '../hooks/useFetch' diff --git a/front/src/components/LocationMarker.tsx b/front/src/components/LocationMarker.tsx index f49149b..5961db5 100644 --- a/front/src/components/LocationMarker.tsx +++ b/front/src/components/LocationMarker.tsx @@ -11,7 +11,6 @@ type LocationMarkerProps = { } function LocationMarker({ address, position, setPosition }: LocationMarkerProps) { - const map = useMapEvents({ dragend: () => { setPosition(map.getCenter()) diff --git a/front/src/components/ClickHandler.tsx b/front/src/components/MapClickHandler.tsx similarity index 69% rename from front/src/components/ClickHandler.tsx rename to front/src/components/MapClickHandler.tsx index 1391c30..4f64d53 100644 --- a/front/src/components/ClickHandler.tsx +++ b/front/src/components/MapClickHandler.tsx @@ -3,7 +3,7 @@ import { LatLng } from 'leaflet' import { SetState } from '../utils/types' -function ClickHandler({ setPosition }: { setPosition: SetState }) { +function MapClickHandler({ setPosition }: { setPosition: SetState }) { const map = useMapEvent('click', (e) => { setPosition(e.latlng) map.setView(e.latlng) @@ -12,4 +12,4 @@ function ClickHandler({ setPosition }: { setPosition: SetState }) { return null } -export default ClickHandler +export default MapClickHandler diff --git a/front/src/components/index.ts b/front/src/components/index.ts index 312f3db..15d9eba 100644 --- a/front/src/components/index.ts +++ b/front/src/components/index.ts @@ -5,7 +5,7 @@ export { default as LineDot } from './LineDot' export { default as LocationMarker } from './LocationMarker' export { default as TrashboxMarkers } from './TrashboxMarkers' export { default as WithToken } from './WithToken' -export { default as ClickHandler } from './ClickHandler' +export { default as MapClickHandler } from './MapClickHandler' export { default as AuthForm } from './AuthForm' export { default as BackHeader } from './BackHeader' export { default as CategoryPreview } from './CategoryPreview' @@ -15,3 +15,4 @@ export { default as SignOut } from './SignOut' export { default as Poetry } from './Poetry' export { default as SelectDisposalTrashbox } from './SelectDisposalTrashbox' export { default as StarRating } from './StarRating' +export { default as CardLayout } from './CardLayout' diff --git a/front/src/hooks/api/useAddAnnouncement.ts b/front/src/hooks/api/useAddAnnouncement.ts index 1b5a16d..c8701b0 100644 --- a/front/src/hooks/api/useAddAnnouncement.ts +++ b/front/src/hooks/api/useAddAnnouncement.ts @@ -1,4 +1,4 @@ -import { useSendWithButton } from '..' +import useSendWithButton from '../useSendWithButton' import { composePutAnnouncementURL, processPutAnnouncement } from '../../api/putAnnouncement' import { isPutAnnouncementResponse } from '../../api/putAnnouncement/types' diff --git a/front/src/hooks/api/useAnnouncements.ts b/front/src/hooks/api/useAnnouncements.ts index 1828fc6..e6b74e2 100644 --- a/front/src/hooks/api/useAnnouncements.ts +++ b/front/src/hooks/api/useAnnouncements.ts @@ -1,4 +1,4 @@ -import { useFetch } from '../' +import useFetch from '../useFetch' import { FiltersType } from '../../utils/filters' import { composeAnnouncementsURL, initialAnnouncements, processAnnouncements } from '../../api/announcements' import { isAnnouncementsResponse } from '../../api/announcements/types' diff --git a/front/src/hooks/api/useDispose.ts b/front/src/hooks/api/useDispose.ts index cc20841..343cf7c 100644 --- a/front/src/hooks/api/useDispose.ts +++ b/front/src/hooks/api/useDispose.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import { useSendWithButton } from '..' +import useSendWithButton from '../useSendWithButton' import { composeDisposeBody, composeDisposeURL, processDispose } from '../../api/dispose' import { DisposeParams, isDisposeResponse } from '../../api/dispose/types' diff --git a/front/src/hooks/api/useOsmAddress.ts b/front/src/hooks/api/useOsmAddress.ts index 015cf6e..fa930db 100644 --- a/front/src/hooks/api/useOsmAddress.ts +++ b/front/src/hooks/api/useOsmAddress.ts @@ -1,6 +1,6 @@ import { LatLng } from 'leaflet' -import { useFetch } from '../' +import useFetch from '../useFetch' import { composeOsmAddressURL, processOsmAddress } from '../../api/osmAddress' import { isOsmAddressResponse } from '../../api/osmAddress/types' diff --git a/front/src/hooks/api/useRemoveAnnouncement.ts b/front/src/hooks/api/useRemoveAnnouncement.ts index b139d03..0f06a72 100644 --- a/front/src/hooks/api/useRemoveAnnouncement.ts +++ b/front/src/hooks/api/useRemoveAnnouncement.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import { useSendWithButton } from '..' +import useSendWithButton from '../useSendWithButton' import { composeRemoveAnnouncementURL, processRemoveAnnouncement } from '../../api/removeAnnouncement' import { isRemoveAnnouncementResponse } from '../../api/removeAnnouncement/types' diff --git a/front/src/hooks/api/useSendRate.ts b/front/src/hooks/api/useSendRate.ts index f85dbe2..f58a279 100644 --- a/front/src/hooks/api/useSendRate.ts +++ b/front/src/hooks/api/useSendRate.ts @@ -1,4 +1,4 @@ -import { useSend } from '..' +import useSend from '../useSend' import { composeSendRateURL, processSendRate } from '../../api/sendRate' import { isSendRateResponse } from '../../api/sendRate/types' diff --git a/front/src/hooks/api/useSignIn.ts b/front/src/hooks/api/useSignIn.ts index 06a5dda..7202ef8 100644 --- a/front/src/hooks/api/useSignIn.ts +++ b/front/src/hooks/api/useSignIn.ts @@ -1,4 +1,4 @@ -import { useSendWithButton } from '..' +import useSendWithButton from '../useSendWithButton' import { composeTokenURL, processToken } from '../../api/token' import { isTokenResponse } from '../../api/token/types' import { setToken } from '../../utils/auth' diff --git a/front/src/hooks/api/useSignUp.ts b/front/src/hooks/api/useSignUp.ts index 2bb95b7..5fdb41a 100644 --- a/front/src/hooks/api/useSignUp.ts +++ b/front/src/hooks/api/useSignUp.ts @@ -1,4 +1,4 @@ -import { useSendWithButton } from '..' +import useSendWithButton from '../useSendWithButton' import { composeSignUpURL, processSignUp } from '../../api/signup' import { isSignUpResponse } from '../../api/signup/types' diff --git a/front/src/hooks/useSendWithButton.ts b/front/src/hooks/useSendWithButton.ts index 8730664..85948c1 100644 --- a/front/src/hooks/useSendWithButton.ts +++ b/front/src/hooks/useSendWithButton.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react' -import { useSend } from '.' +import useSend from './useSend' import useSendButtonCaption from './useSendButtonCaption' function useSendWithButton>( diff --git a/front/src/pages/AddPage.tsx b/front/src/pages/AddPage.tsx index 61c180d..85c91e0 100644 --- a/front/src/pages/AddPage.tsx +++ b/front/src/pages/AddPage.tsx @@ -4,13 +4,12 @@ import { MapContainer, TileLayer } from 'react-leaflet' import { latLng } from 'leaflet' import { useNavigate } from 'react-router-dom' -import { ClickHandler, LocationMarker } from '../components' +import { MapClickHandler, LocationMarker, CardLayout } from '../components' import { useAddAnnouncement } from '../hooks/api' import { categories, categoryNames } from '../assets/category' import { stations, lines, lineNames } from '../assets/metro' import { fallbackError, gotResponse } from '../hooks/useFetch' import { useOsmAddresses } from '../hooks/api' -import CardLayout from '../components/CardLayout' const styles = { map: { @@ -92,7 +91,7 @@ function AddPage() { setPosition={setAddressPosition} />} - @@ -102,7 +101,12 @@ function AddPage() { Описание - + diff --git a/front/src/pages/HomePage.tsx b/front/src/pages/HomePage.tsx index ed09a45..4f1a04a 100644 --- a/front/src/pages/HomePage.tsx +++ b/front/src/pages/HomePage.tsx @@ -3,12 +3,11 @@ import Stories from 'react-insta-stories' import { Story } from 'react-insta-stories/dist/interfaces' import { BottomNavBar, AnnouncementDetails, Filters } from '../components' -import { useFilters, useStoryDimensions } from '../hooks' +import { useFilters, useStoryDimensions, useStoryIndex } from '../hooks' import { useAnnouncements } from '../hooks/api' import { Announcement } from '../api/announcement/types' import { categoryGraphics } from '../assets/category' import { UseFetchReturn, gotError } from '../hooks/useFetch' -import { useStoryIndex } from '../hooks' import puffSpinner from '../assets/puff.svg' @@ -45,13 +44,14 @@ function fallbackGenerateStories(announcements: UseFetchReturn) const fallbackStory = (text = '', isError = false): Story[] => [{ content: ({ action }) => { + // ESLint can't detect that it is a component // eslint-disable-next-line react-hooks/rules-of-hooks - useEffect(() => { - action('pause') + useEffect(() => { + action('pause') }, [action]) return ( -
+
{text || }
) @@ -64,9 +64,6 @@ const styles = { justifyContent: 'center', backgroundColor: 'rgb(17, 17, 17)', } as CSSProperties, - center: { - margin: 'auto', - } as CSSProperties, } function HomePage() { @@ -83,7 +80,12 @@ function HomePage() { const index = useStoryIndex(announcements.data?.length) return (<> - +
- + ) } diff --git a/front/src/pages/LoginPage.tsx b/front/src/pages/LoginPage.tsx index d569b81..a9e3ff8 100644 --- a/front/src/pages/LoginPage.tsx +++ b/front/src/pages/LoginPage.tsx @@ -1,7 +1,6 @@ import { useNavigate } from 'react-router-dom' -import { AuthForm } from '../components' -import CardLayout from '../components/CardLayout' +import { AuthForm, CardLayout } from '../components' function LoginPage() { const navigate = useNavigate()