Skip to content

Commit

Permalink
Added absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
TOPOFGR committed Apr 23, 2020
1 parent 6cb9042 commit cb2fd2d
Show file tree
Hide file tree
Showing 23 changed files with 72 additions and 70 deletions.
6 changes: 6 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion src/components/Navigation/Aside/Aside.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';

import paths from 'pages/Router/paths';
import Aside, { SubMenu } from '.';
import NavLink from '../Link';
import paths from '../../../pages/Router/paths';

describe('<Aside /> rendering', () => {
const onHandler = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation/Aside/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import classNames from 'classnames';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import paths from 'pages/Router/paths';
import NavLink from '../Link';
import paths from '../../../pages/Router/paths';
import classes from './Aside.module.scss';

export const SubMenu = ({ label, children }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation/NavBar/NavBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import * as reactRedux from 'react-redux';
import { Link } from 'react-router-dom';

import * as actions from '../../../state/actions/auth';
import * as actions from 'state/actions/auth';
import NavBar from '.';

const onHandleMobile = jest.fn();
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navigation/NavBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import classNames from 'classnames';
import PropTypes from 'prop-types';

import { logout } from 'state/actions/auth';
import paths from 'pages/Router/paths';
import defaultLogo from 'assets/user-default-log.svg';
import Link from '../Link';
import { logout } from '../../../state/actions/auth';
import paths from '../../../pages/Router/paths';
import defaultLogo from '../../../assets/user-default-log.svg';

const NavBar = ({ handleMobileToggle, asideMobileActive }) => {
const [navMobileActive, setNavMobileActive] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserForm/UserForm.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import * as reactRedux from 'react-redux';

import * as actions from '../../state/actions/users';
import * as actions from 'state/actions/users';
import UserForm from '.';

describe('<UserForm /> rendering', () => {
Expand Down
45 changes: 22 additions & 23 deletions src/components/UserForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import DatePicker from '../DatePicker';
import { useChangeHandler } from '../../utils/hooks';
import { validateEmail } from '../../utils';
import paths from 'pages/Router/paths';
import { usersCleanUp } from 'state/actions/users';
import { useChangeHandler } from 'utils/hooks';
import { validateEmail } from 'utils';
import './UserForm.scss';
import { usersCleanUp } from '../../state/actions/users';
import paths from '../../pages/Router/paths';
import DatePicker from '../DatePicker';

const UserForm = ({ isEditing, isProfile, userData, action }) => {
const { loading } = useSelector(
Expand Down Expand Up @@ -80,26 +80,25 @@ const UserForm = ({ isEditing, isProfile, userData, action }) => {
</header>
<div className="card-content">
<form onSubmit={onSubmitHandler}>

{isEditing ? (
<div className="field is-horizontal">
<div className="field-label is-normal">
<label className="label">E-mail</label>
</div>
<div className="field-body">
<div className="field">
<div className="control">
<input
type="text"
readOnly="readOnly"
className="input is-static"
value={user.email}
/>
{isEditing ? (
<div className="field is-horizontal">
<div className="field-label is-normal">
<label className="label">E-mail</label>
</div>
<div className="field-body">
<div className="field">
<div className="control">
<input
type="text"
readOnly="readOnly"
className="input is-static"
value={user.email}
/>
</div>
</div>
</div>
</div>
</div>
) : (
) : (
<div className="field is-horizontal">
<div className="field-label is-normal">
<label className="label">E-mail</label>
Expand Down Expand Up @@ -258,7 +257,7 @@ const UserForm = ({ isEditing, isProfile, userData, action }) => {
<span>Submit</span>
</button>
</div>
{ !isProfile && (
{!isProfile && (
<Link to={paths.USERS} className="button">
Go Back
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Home/Home.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import * as reactRedux from 'react-redux';

import * as actions from '../../state/actions/auth';
import * as actions from 'state/actions/auth';
import Home from '.';

describe('<Home /> rendering', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Login/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { Redirect, Link } from 'react-router-dom';

import firebase from '../../firebase';
import { auth, setPassword, authCleanUp } from '../../state/actions/auth';
import firebase from 'firebase';
import { auth, setPassword, authCleanUp } from 'state/actions/auth';
import { useChangeHandler } from 'utils/hooks';
import { inputValidations } from 'utils';
import paths from '../Router/paths';
import { useChangeHandler } from '../../utils/hooks';
import { inputValidations } from '../../utils';
import classes from './Login.module.scss';

const Login = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/NotFound/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { Link, useLocation } from 'react-router-dom';
import { useSelector, shallowEqual } from 'react-redux';

import path from '../Router/paths';
import NotFoudImage from '../../assets/404.gif';
import path from 'pages/Router/paths';
import NotFoudImage from 'assets/404.gif';
import classes from './NotFound.module.scss';

const NotFound = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Profile/ChangePassword/ChangePassword.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import * as reactRedux from 'react-redux';

import * as actions from '../../../state/actions/auth';
import * as actions from 'state/actions/auth';
import ChangePassword from '.';

describe('<ChangePassword /> rendering', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Profile/ChangePassword/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';

import { changeUserPassword, authCleanUp } from '../../../state/actions/auth';
import { useChangeHandler } from '../../../utils/hooks';
import { changeUserPassword, authCleanUp } from 'state/actions/auth';
import { useChangeHandler } from 'utils/hooks';

const ChangePasswordCard = () => {
const [passwords, setPasswords] = useState({
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Profile/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { useSelector, shallowEqual } from 'react-redux';

import UserForm from 'components/UserForm';
import { modifyUser } from 'state/actions/users';
import ChangePassword from './ChangePassword';
import UserForm from '../../components/UserForm';
import { modifyUser } from '../../state/actions/users';

const Profile = () => {
const { userData } = useSelector(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ResetPassword/ResetPassword.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import * as reactRedux from 'react-redux';

import * as actions from '../../state/actions/auth';
import * as actions from 'state/actions/auth';
import ResetPassword from '.';

describe('<ResetPassword /> rendering', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/ResetPassword/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { Redirect, Link } from 'react-router-dom';

import classes from './ResetPassword.module.scss';
import { useChangeHandler } from '../../utils/hooks';
import { resetPassword, authCleanUp } from '../../state/actions/auth';
import paths from '../Router/paths';
import { useChangeHandler } from 'utils/hooks';
import { resetPassword, authCleanUp } from 'state/actions/auth';
import paths from 'pages/Router/paths';

const ResetPassword = () => {
const { loading, error, restoredPassword, isAuth } = useSelector(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Router/PrivateRoute/PrivateRoute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import * as reactRedux from 'react-redux';
import { Redirect } from 'react-router-dom';

import * as actions from '../../../state/actions/auth';
import * as actions from 'state/actions/auth';
import PrivateRoute from '.';
import paths from '../paths';

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Router/PrivateRoute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Route, Redirect } from 'react-router-dom';
import { useSelector, shallowEqual } from 'react-redux';
import PropTypes from 'prop-types';

import Layout from 'components/Layout';
import paths from '../paths';
import Layout from '../../../components/Layout';

const PrivateRoute = ({ path, component: Component }) => {
const { id } = useSelector(
Expand All @@ -19,7 +19,7 @@ const PrivateRoute = ({ path, component: Component }) => {
<Route
exact
path={path}
render={() => id ? <Component /> : <Redirect to={paths.LOGIN} />}
render={() => (id ? <Component /> : <Redirect to={paths.LOGIN} />)}
/>
</Layout>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Router/Router.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import * as reactRedux from 'react-redux';

import * as actions from '../../state/actions/auth';
import * as actions from 'state/actions/auth';
import Router from '.';

describe('<Router /> rendering', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/User/User.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import ClipLoader from 'react-spinners/ClipLoader';

import UserForm from 'components/UserForm';
import User from '.';
import UserForm from '../../components/UserForm';

describe('<User /> rendering', () => {
it('should render without crashing', () => {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/User/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useState, useEffect } from 'react';
import { useParams, Redirect } from 'react-router-dom';
import { useSelector, shallowEqual } from 'react-redux';

import ClipLoader from 'react-spinners/ClipLoader';
import UserForm from '../../components/UserForm';
import firebase from '../../firebase';
import { createUser, modifyUser } from '../../state/actions/users';
import paths from '../Router/paths';

import UserForm from 'components/UserForm';
import { createUser, modifyUser } from 'state/actions/users';
import paths from 'pages/Router/paths';
import firebase from 'firebase.js';

const User = () => {
const { id } = useParams();
Expand Down
14 changes: 5 additions & 9 deletions src/pages/Users/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import React, { useEffect, useState, Fragment } from 'react';
import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { Redirect, Link } from 'react-router-dom';
import classNames from 'classnames';
import ClipLoader from 'react-spinners/ClipLoader';

import Table from '../../components/Table';
import {
fetchUsers,
deleteUser,
clearUsersData
} from '../../state/actions/users';
import Table from 'components/Table';
import { fetchUsers, deleteUser, clearUsersData } from 'state/actions/users';
import paths from 'pages/Router/paths';
import ConfirmationModal from 'components/ConfirmationModal';
import classes from './Users.module.scss';
import paths from '../Router/paths';
import ConfirmationModal from '../../components/ConfirmationModal';

const Users = () => {
const { usersList, isAdmin, error, loading, deleted } = useSelector(
Expand Down
5 changes: 3 additions & 2 deletions src/state/actions/auth.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createAction } from 'redux-act';
import { toastr } from 'react-redux-toastr';

import { firebaseError, FIREBASE_RESPONSE } from '../../utils';
import { firebaseError, FIREBASE_RESPONSE } from 'utils';
import firebase from 'firebase.js';
import { clearUsersData } from './users';
import firebase from '../../firebase';

export const AUTH_SIGN_IN_INIT = createAction('AUTH_SIGN_IN_INIT');
export const AUTH_SIGN_IN_FAIL = createAction('AUTH_SIGN_IN_FAIL');
Expand Down Expand Up @@ -74,6 +74,7 @@ export const logout = () => {

export const verifyAuth = () => {
return dispatch => {
debugger;
firebase.auth().onAuthStateChanged(user => {
dispatch(AUTH_RESTORE_SESSION_INIT());

Expand Down
6 changes: 3 additions & 3 deletions src/state/actions/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createAction } from 'redux-act';
import uuid from 'uuid/v4';
import { toastr } from 'react-redux-toastr';

import axios from '../../utils/axios';
import firebase from '../../firebase';
import { firebaseError } from '../../utils';
import axios from 'utils/axios';
import { firebaseError } from 'utils';
import firebase from 'firebase';
import { checkUserData, AUTH_UPDATE_USER_DATA } from './auth';

export const USERS_FETCH_DATA_INIT = createAction('USERS_FETCH_DATA_INIT');
Expand Down

0 comments on commit cb2fd2d

Please sign in to comment.