From 4847304f5c5f23ccc105cc07b1a7caac4b87aa26 Mon Sep 17 00:00:00 2001 From: Ivan Samozhenov Date: Sun, 14 Jan 2024 23:10:00 +0300 Subject: [PATCH] Add index.js files in homogeneous units (components and pages) --- frontend/src/App.jsx | 10 ++++++---- frontend/src/components/index.js | 4 ++++ frontend/src/pages/LoginPage.jsx | 3 +-- frontend/src/pages/MainPage.jsx | 3 +-- frontend/src/pages/SignupPage.jsx | 4 ++-- frontend/src/pages/index.js | 4 ++++ 6 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 frontend/src/components/index.js create mode 100644 frontend/src/pages/index.js diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 951aff1..6835c9c 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -6,10 +6,12 @@ import { import 'react-toastify/dist/ReactToastify.css'; import { hooks } from './providers'; -import MainPage from './pages/MainPage'; -import LoginPage from './pages/LoginPage'; -import NotFoundPage from './pages/NotFoundPage'; -import SignupPage from './pages/SignupPage'; +import { + MainPage, + LoginPage, + NotFoundPage, + SignupPage, +} from './pages'; const ConditionalRoute = ({ children, redirectWhenAuthIsExist, redirectTo }) => { const auth = hooks.useAuth(); diff --git a/frontend/src/components/index.js b/frontend/src/components/index.js new file mode 100644 index 0000000..b33c000 --- /dev/null +++ b/frontend/src/components/index.js @@ -0,0 +1,4 @@ +export { default as LoginForm } from './LoginForm'; +export { default as Navbar } from './Navbar'; +export { default as SignupForm } from './SignupForm'; +export { default as Chat } from './chat/Chat'; diff --git a/frontend/src/pages/LoginPage.jsx b/frontend/src/pages/LoginPage.jsx index 5100fa8..83eae63 100644 --- a/frontend/src/pages/LoginPage.jsx +++ b/frontend/src/pages/LoginPage.jsx @@ -3,8 +3,7 @@ import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Image } from 'react-bootstrap'; -import LoginForm from '../components/LoginForm'; -import Navbar from '../components/Navbar'; +import { LoginForm, Navbar } from '../components'; import totaImg from '../assets/img/Tota-with-flag.jpg'; const LoginPage = () => { diff --git a/frontend/src/pages/MainPage.jsx b/frontend/src/pages/MainPage.jsx index 130981f..ee3d95b 100644 --- a/frontend/src/pages/MainPage.jsx +++ b/frontend/src/pages/MainPage.jsx @@ -4,8 +4,7 @@ import { Spinner } from 'react-bootstrap'; import { useDispatch } from 'react-redux'; import { useTranslation } from 'react-i18next'; -import Navbar from '../components/Navbar'; -import Chat from '../components/chat/Chat'; +import { Navbar, Chat } from '../components'; import { hooks } from '../providers'; import { fetchChatData } from '../api/serverApi'; import { serverRoutes } from '../utils/routes'; diff --git a/frontend/src/pages/SignupPage.jsx b/frontend/src/pages/SignupPage.jsx index b295702..abcd14c 100644 --- a/frontend/src/pages/SignupPage.jsx +++ b/frontend/src/pages/SignupPage.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { Image } from 'react-bootstrap'; -import SignupForm from '../components/SignupForm'; -import Navbar from '../components/Navbar'; + +import { SignupForm, Navbar } from '../components'; import totaImg from '../assets/img/Tota-celebrating.jpg'; const SignupPage = () => ( diff --git a/frontend/src/pages/index.js b/frontend/src/pages/index.js new file mode 100644 index 0000000..aeaee6e --- /dev/null +++ b/frontend/src/pages/index.js @@ -0,0 +1,4 @@ +export { default as LoginPage } from './LoginPage'; +export { default as MainPage } from './MainPage'; +export { default as NotFoundPage } from './NotFoundPage'; +export { default as SignupPage } from './SignupPage';