Skip to content

Commit

Permalink
Feature/decouple user (#680)
Browse files Browse the repository at this point in the history
* Moving components

* Moving user

* wip

* Fix test import

* Update test imports

* Fix modals import
  • Loading branch information
eddsaura committed Nov 9, 2022
1 parent 64875bb commit dd58ee5
Show file tree
Hide file tree
Showing 29 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/App/FishbowlPreJoin/connection.ts
Expand Up @@ -8,7 +8,7 @@
*/

import api from '@/lib/api';
import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';

export const connectWithPassword = async (
password: string,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/App/ModalOnBoarding/index.tsx
Expand Up @@ -13,8 +13,8 @@ import Cross from '@/ui/svg/cross.svg';
import OnboardingModal from '@/components/App/ModalOnBoarding/styles';
import OnBoardingSlider from '@/components/App/OnBoarding/OnBoardingSlider';
import { useStooa } from '@/contexts/StooaManager';
import { setOnBoardingCookie } from '@/user/auth';
import { useModals } from '@/contexts/ModalsContext';
import { setOnBoardingCookie } from '@/lib/auth';

const ModalOnboarding = () => {
const { isModerator } = useStooa();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/App/ModalShareLink/index.tsx
Expand Up @@ -16,7 +16,7 @@ import Modal from '@/ui/Modal';
import Cross from '@/ui/svg/cross.svg';
import ButtonCopyUrl from '@/components/Common/ButtonCopyUrl';
import { useStooa } from '@/contexts/StooaManager';
import { getOnBoardingCookie, isFishbowlShareLinkCookie, setShareLinkCookie } from '@/lib/auth';
import { getOnBoardingCookie, isFishbowlShareLinkCookie, setShareLinkCookie } from '@/user/auth';

const ModalShareLink: React.FC = () => {
const { t } = useTranslation('fishbowl');
Expand Down
Expand Up @@ -10,7 +10,7 @@
import React from 'react';
import Link from 'next/link';

import { isCurrentGuest } from '@/lib/auth';
import { isCurrentGuest } from '@/user/auth';
import { pushEventDataLayer } from '@/lib/analytics';

import Linkedin from '@/ui/svg/share-linkedin.svg';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/App/Participants/index.tsx
Expand Up @@ -12,7 +12,7 @@ import useTranslation from 'next-translate/useTranslation';

import { Participant } from '@/types/participant';
import { pushEventDataLayer } from '@/lib/analytics';
import { ping } from '@/lib/auth';
import { ping } from '@/user/auth';
import { getParticipantList } from '@/lib/jitsi';
import ParticipantCard from '@/components/App/Participants/ParticipantCard';

Expand Down
Expand Up @@ -13,7 +13,7 @@ import { Participant } from '@/types/participant';
import useTranslation from 'next-translate/useTranslation';
import ParticipantCard from '@/components/App/Participants/ParticipantCard';
import People from '@/ui/svg/people.svg';
import { ping } from '@/lib/auth';
import { ping } from '@/user/auth';
import { useRouter } from 'next/router';
import {
StyledParticipantListWrapper,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/contexts/AuthContext.tsx
Expand Up @@ -34,12 +34,12 @@ import {
getAuthToken,
setRefreshToken,
setToken
} from '@/lib/auth';
} from '@/user/auth';

import { Auth, StatusPayload } from '@/types/contexts/auth-context';
import userRepository from '@/jitsi/User';
import api from '@/lib/api';
import { AuthToken } from '@/lib/auth/authToken';
import { AuthToken } from '@/user/auth/authToken';
import Layout from '@/layouts/Clean';
import LoadingIcon from '@/components/Common/LoadingIcon';
import { User } from '@/types/user';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/contexts/ModalsContext.tsx
Expand Up @@ -10,7 +10,7 @@
import { useCallback, useEffect, useState } from 'react';

import { pushEventDataLayer } from '@/lib/analytics';
import { getOnBoardingCookie } from '@/lib/auth';
import { getOnBoardingCookie } from '@/user/auth';
import { ModalsContextValues } from '@/types/contexts/modals-context';
import { useStateValue } from './AppContext';
import createGenericContext from './createGenericContext';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/apollo-client.js
Expand Up @@ -9,7 +9,7 @@

import { ApolloClient, ApolloProvider, createHttpLink, InMemoryCache } from '@apollo/client';
import { setContext } from '@apollo/client/link/context';
import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';
import LocaleCookie from '@/lib/LocaleCookie';

const httpLink = createHttpLink({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/jitsi-modules/Conference.js
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';
import { getBackendSafeRoomName, dispatchEvent } from '@/lib/helpers';
import {
CONFERENCE_IS_LOCKABLE,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/edit-profile.tsx
Expand Up @@ -13,7 +13,7 @@ import useTranslation from 'next-translate/useTranslation';

import { GET_SELF_USER } from '@/lib/gql/User';

const ProfileForm = dynamic(import('@/components/Web/Forms/profile'), { loading: () => <div /> });
const ProfileForm = dynamic(import('@/user/forms/profile'), { loading: () => <div /> });
const Layout = dynamic(import('@/layouts/Default'), { loading: () => <div /> });
const Loader = dynamic(import('@/components/Web/Loader'), { loading: () => <div /> });
const Error = dynamic(import('@/components/Common/Error'), { loading: () => <div /> });
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/fishbowl/list.tsx
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

import FishbowlList from '@/components/App/FishbowlList';
import FishbowlList from '@/user/FishbowlList';
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
import { ToastContainer } from 'react-toastify';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/log-in.tsx
Expand Up @@ -11,7 +11,7 @@ import useTranslation from 'next-translate/useTranslation';

import { useAuth } from '@/contexts/AuthContext';
import Layout from '@/layouts/Default';
import LogInForm from '@/components/Web/Forms/log-in';
import LogInForm from '@/user/forms/log-in';

const SignIn = () => {
const { t } = useTranslation('login');
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/recover-password.tsx
Expand Up @@ -10,7 +10,7 @@
import useTranslation from 'next-translate/useTranslation';

import { useAuth } from '@/contexts/AuthContext';
import RecoverPasswordForm from '@/components/Web/Forms/recover-password';
import RecoverPasswordForm from '@/user/forms/recover-password';
import Layout from '@/layouts/Default';
import Description from '@/components/Common/Description';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/register.tsx
Expand Up @@ -11,7 +11,7 @@ import useTranslation from 'next-translate/useTranslation';

import { useAuth } from '@/contexts/AuthContext';
import Layout from '@/layouts/Default';
import RegisterForm from '@/components/Web/Forms/register';
import RegisterForm from '@/user/forms/register';

const Register = () => {
const { t } = useTranslation('register');
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/reset-password/[token].tsx
Expand Up @@ -11,7 +11,7 @@ import { useRouter } from 'next/router';
import useTranslation from 'next-translate/useTranslation';

import { useAuth } from '@/contexts/AuthContext';
import ResetPasswordForm from '@/components/Web/Forms/reset-password';
import ResetPasswordForm from '@/user/forms/reset-password';
import Layout from '@/layouts/Default';

const ChangePassword = () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/repository/ApiParticipantRepository.ts
Expand Up @@ -9,7 +9,7 @@

import api from '@/lib/api';
import LocaleCookie from '@/lib/LocaleCookie';
import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';
import { Participant } from '@/types/participant';

const getApiParticipantList = async (lang: string, slug: string): Promise<Participant[]> => {
Expand Down
Expand Up @@ -18,7 +18,7 @@ import ButtonCopyUrl from '@/components/Common/ButtonCopyUrl';
import RedirectLink from '@/components/Web/RedirectLink';
import { Fishbowl } from '@/types/api-platform';

import { CardStyled, CardTitle } from '@/components/App/FishbowlList/styles';
import { CardStyled, CardTitle } from '@/user/FishbowlList/styles';
import { convertIntoClassName } from '@/lib/helpers';
import Button from '@/components/Common/Button';
import Icon from '@/components/Common/Fields/Icon';
Expand Down
Expand Up @@ -24,7 +24,7 @@ import { pushEventDataLayer } from '@/lib/analytics';

import RedirectLink from '@/components/Web/RedirectLink';
import LoadingIcon from '@/components/Common/LoadingIcon';
import FishbowlCard from '@/components/App/FishbowlList/FishbowlCard';
import FishbowlCard from '@/user/FishbowlList/FishbowlCard';
import {
EmptyFishbowlList,
FishbowlListWrapper,
Expand All @@ -34,11 +34,11 @@ import {
EditFormWrapper,
DetailPlaceholder,
MobileBackButton
} from '@/components/App/FishbowlList/styles';
} from '@/user/FishbowlList/styles';
import FishbowlForm from '@/components/Web/Forms/FishbowlForm';
import Button from '@/components/Common/Button';

import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';
import api from '@/lib/api';
import { getIsoDateTimeWithActualTimeZone, isTimeLessThanNMinutes } from '@/lib/helpers';
import { useWindowSize } from '@/hooks/useWIndowSize';
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -10,7 +10,7 @@
import cookie from 'js-cookie';

import api from '@/lib/api';
import { AuthToken } from '@/lib/auth/authToken';
import { AuthToken } from '@/user/auth/authToken';
import userRepository from '@/jitsi/User';
import LocaleCookie from '@/lib/LocaleCookie';

Expand Down
File renamed without changes.
Expand Up @@ -23,7 +23,7 @@ import * as Yup from 'yup';
import { ROUTE_HOME } from '@/app.config';
import { useAuth } from '@/contexts/AuthContext';
import FormikForm from '@/ui/Form';
import { getAuthToken } from '@/lib/auth';
import { getAuthToken } from '@/user/auth';
import { UPDATE_USER } from '@/lib/gql/User';
import Input from '@/components/Common/Fields/Input';
import SubmitBtn from '@/components/Web/SubmitBtn';
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -11,10 +11,10 @@ import { render, waitFor } from '@testing-library/react';
import PreFishbowlParticipants from '@/components/App/PreFishbowl/PreFishbowlParticipants';
import { useStateValue } from '@/contexts/AppContext';
import { getApiParticipantList } from '@/repository/ApiParticipantRepository';
import { ping } from '@/lib/auth';
import { ping } from '@/user/auth';
import { makeParticipant } from '../../../factories/participant';

jest.mock('@/lib/auth');
jest.mock('@/user/auth');
jest.mock('@/contexts/AppContext');
jest.mock('@/repository/ApiParticipantRepository');
jest.mock('@/components/App/ParticipantPlaceholder', () => () => (
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/unit/components/Web/FishbowlCard.test.js
Expand Up @@ -8,7 +8,7 @@
*/

import { render, screen } from '@testing-library/react';
import FishbowlCard from '@/components/App/FishbowlList/FishbowlCard';
import FishbowlCard from '@/user/FishbowlList/FishbowlCard';

const TWENTY_MINUTES_IN_MS = 20 * 60 * 1000;
const HOUR_IN_MS = 1000 * 60 * 60;
Expand Down

0 comments on commit dd58ee5

Please sign in to comment.