Repository: rolling-scopes-school/RSS-Teams-FE Branch: master Commit: 87986aad70b2 Files: 199 Total size: 268.1 KB Directory structure: gitextract_043m4_he/ ├── .eslintrc.js ├── .firebaserc ├── .github/ │ └── workflows/ │ └── deploy-client.yml ├── .gitignore ├── .prettierrc ├── README.md ├── firebase.json ├── package.json ├── pre-build.js ├── public/ │ ├── index.html │ ├── manifest.json │ └── robots.txt ├── src/ │ ├── appConstants/ │ │ ├── api.ts │ │ ├── colors.ts │ │ └── index.ts │ ├── assets/ │ │ └── fonts/ │ │ ├── Poppins-Bold-700.otf │ │ ├── Poppins-Medium-500.otf │ │ ├── Poppins-Regular-400.otf │ │ └── Poppins-SemiBold-600.otf │ ├── components/ │ │ ├── App/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── CommonSelectList/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── CourseField/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── ErrorBoundary/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── ErrorModal/ │ │ │ └── index.tsx │ │ ├── FilterForm/ │ │ │ ├── filterFormFields.ts │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── FilterSelect/ │ │ │ └── index.tsx │ │ ├── Footer/ │ │ │ ├── components/ │ │ │ │ ├── FooterContent/ │ │ │ │ │ └── index.tsx │ │ │ │ └── index.ts │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── Header/ │ │ │ ├── components/ │ │ │ │ ├── BurgerMenu/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ ├── MenuWrapper/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── CoursesSelect/ │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ ├── LangSelect/ │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ └── Nav/ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ └── styled.ts │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ └── index.ts │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── InputField/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── Loader/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── Modal/ │ │ │ ├── index.module.css │ │ │ └── index.tsx │ │ ├── ModalCreateEditTeam/ │ │ │ └── index.tsx │ │ ├── ModalCreated/ │ │ │ └── index.tsx │ │ ├── ModalEditCourse/ │ │ │ └── index.tsx │ │ ├── ModalExpel/ │ │ │ └── index.tsx │ │ ├── ModalJoin/ │ │ │ └── index.tsx │ │ ├── Pagination/ │ │ │ ├── index.tsx │ │ │ └── style.css │ │ ├── PrivateRoute/ │ │ │ └── index.tsx │ │ ├── SelectField/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── TablePopup/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── TourGuide/ │ │ │ ├── index.tsx │ │ │ ├── style.css │ │ │ ├── styled.ts │ │ │ └── tourConfig.tsx │ │ └── index.ts │ ├── graphql/ │ │ ├── mutations/ │ │ │ ├── addUserToTeamMutation.ts │ │ │ ├── createCourseMutation.ts │ │ │ ├── createTeamMutation.ts │ │ │ ├── index.ts │ │ │ ├── removeUserFromCourseMutation.ts │ │ │ ├── removeUserFromTeamMutation.ts │ │ │ ├── sortStudentsMutation.ts │ │ │ ├── updUserMutation.ts │ │ │ ├── updateCourseMutation.ts │ │ │ └── updateTeamMutation.ts │ │ └── queries/ │ │ ├── coursesQuery.ts │ │ ├── index.ts │ │ ├── teamsQuery.ts │ │ ├── usersQuery.ts │ │ └── whoAmIQuery.ts │ ├── hooks/ │ │ └── graphql/ │ │ ├── index.ts │ │ ├── mutations/ │ │ │ ├── useAddUserToTeamMutation.ts │ │ │ ├── useCreateCourseMutation.ts │ │ │ ├── useCreateTeamMutation.ts │ │ │ ├── useExpelUserFromTeamMutation.ts │ │ │ ├── useRemoveUserFromCourseMutation.ts │ │ │ ├── useRemoveUserFromTeamMutation.ts │ │ │ ├── useSortStudentsMutation.ts │ │ │ ├── useUpdUserMutation.ts │ │ │ ├── useUpdateCourseMutation.ts │ │ │ └── useUpdateTeamMutation.ts │ │ └── queries/ │ │ ├── useCoursesQuery.ts │ │ ├── useTeamsQuery.ts │ │ ├── useUsersQuery.ts │ │ └── useWhoAmIQuery.ts │ ├── index.tsx │ ├── modules/ │ │ ├── AdminPage/ │ │ │ ├── components/ │ │ │ │ ├── ContentWrapper/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── AddCourseBlock/ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ └── InputsBlock/ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ ├── CoursesList/ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ └── Course/ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ └── ShowCourseSelect/ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ └── index.ts │ │ │ └── index.tsx │ │ ├── EditProfile/ │ │ │ ├── components/ │ │ │ │ └── UserCourseListItem/ │ │ │ │ ├── index.tsx │ │ │ │ └── styled.ts │ │ │ ├── formFields.ts │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── LoginPage/ │ │ │ ├── components/ │ │ │ │ ├── LoginInfoBlock/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ └── index.ts │ │ │ ├── index.tsx │ │ │ ├── loginPageMiddleware.ts │ │ │ ├── loginPageReducer.ts │ │ │ ├── selectors.ts │ │ │ └── styled.ts │ │ ├── NotFoundPage/ │ │ │ ├── index.tsx │ │ │ └── styled.ts │ │ ├── StudentsTable/ │ │ │ ├── components/ │ │ │ │ └── Dashboard/ │ │ │ │ ├── components/ │ │ │ │ │ ├── TableBody/ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ └── TableRow/ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ └── TableItem/ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ ├── styled.ts │ │ │ │ │ │ └── styles.css │ │ │ │ │ ├── TableHead/ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ └── styled.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── index.tsx │ │ │ │ └── styled.ts │ │ │ ├── index.tsx │ │ │ ├── selectors.ts │ │ │ ├── studentsTableReducer.ts │ │ │ └── styled.ts │ │ ├── TeamsList/ │ │ │ ├── components/ │ │ │ │ ├── TeamListModals/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── useCommonMutations.ts │ │ │ │ ├── Teams/ │ │ │ │ │ ├── components/ │ │ │ │ │ │ ├── MemberListToggle/ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ ├── MyTeam/ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ └── MyTeamInfoBlock/ │ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ │ ├── MyTeamInfoLine/ │ │ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ │ │ └── styled.tsx │ │ │ │ │ │ │ │ │ └── NotificationPopup/ │ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ ├── TeamItem/ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.tsx │ │ │ │ │ │ ├── TeamUserTable/ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ └── TableRow/ │ │ │ │ │ │ │ │ ├── components/ │ │ │ │ │ │ │ │ │ ├── ExpelButton/ │ │ │ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ │ │ │ ├── TableCell/ │ │ │ │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ │ │ │ └── index.ts │ │ │ │ │ │ │ │ └── index.tsx │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.tsx │ │ │ │ │ │ ├── TeamsHeader/ │ │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ │ └── styled.ts │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── index.tsx │ │ │ │ └── index.ts │ │ │ ├── index.tsx │ │ │ ├── selectors.ts │ │ │ ├── styled.ts │ │ │ └── teamsListReducer.ts │ │ ├── TokenPage/ │ │ │ └── index.tsx │ │ ├── TutorialPage/ │ │ │ ├── components/ │ │ │ │ ├── NoteBlock/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ ├── StepBlock/ │ │ │ │ │ ├── index.tsx │ │ │ │ │ └── styled.ts │ │ │ │ └── index.ts │ │ │ ├── index.tsx │ │ │ ├── styled.ts │ │ │ └── tutorialPageInfo.tsx │ │ └── index.ts │ ├── react-app-env.d.ts │ ├── reportWebVitals.ts │ ├── setupTests.ts │ ├── store/ │ │ └── index.tsx │ ├── translation/ │ │ ├── en/ │ │ │ └── en.json │ │ ├── resources.ts │ │ └── ru/ │ │ └── ru.json │ ├── types.ts │ ├── typography/ │ │ ├── common.css │ │ ├── fonts.css │ │ ├── index.ts │ │ └── normalize.css │ └── utils/ │ └── isFieldValid.ts └── tsconfig.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .eslintrc.js ================================================ module.exports = { parser: '@typescript-eslint/parser', extends: [ 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint', 'plugin:react-hooks/recommended', 'plugin:prettier/recommended', ], plugins: ['@typescript-eslint', 'react', 'prettier', 'react-hooks'], parserOptions: { ecmaVersion: 2018, sourceType: 'module', ecmaFeatures: { jsx: true, }, }, rules: { 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', 'comma-dangle': ['error', 'only-multiline'], 'react/prop-types': 'off', 'react/display-name': 'off', '@typescript-eslint/explicit-function-return-type': 'off', 'prettier/prettier': ['error', { endOfLine: 'auto' }], '@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/ban-ts-ignore': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-var-reqiures': 'off', }, settings: { react: { version: 'detect', }, }, globals: { React: 'writable' }, }; ================================================ FILE: .firebaserc ================================================ { "projects": { "default": "rss-teams" } } ================================================ FILE: .github/workflows/deploy-client.yml ================================================ name: Build and Deploy on: push: branches: - master jobs: admin: name: Deploy PROD runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@master - name: Install Dependencies run: npm install - name: Build run: npm run build - name: Archive Production Artifact uses: actions/upload-artifact@master with: name: build path: build - name: Deploy to Firebase uses: w9jds/firebase-action@master with: args: deploy --only hosting env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} ================================================ FILE: .gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js /.eslintcache* # testing /coverage # production /build /.firebase # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* .eslintcache* ================================================ FILE: .prettierrc ================================================ { "endOfLine": "auto", "semi": true, "singleQuote": true, "tabWidth": 2, "trailingComma": "es5", "printWidth": 100 } ================================================ FILE: README.md ================================================ # RSS-Teams-FE - Deprecated and no longer maintained. The latest deployed version will become unavailable from 28/10/2022 due to Heroku limitations. Link to deployment - https://rss-teams.web.app/login Stack: 1 React - https://reactjs.org/ 2 Redux, redux-thunk, redux-devtools-extension - https://redux.js.org/ 3 Typescript - https://www.typescriptlang.org/ 4 Apollo - https://www.howtographql.com/ Used libs: 1 styled-components - https://askd.rocks/pres/styled-gdg/ 2 react-router/react-router-dom - https://reactrouter.com/ 3 react-hook-form 4 react-window 5 react-paginate 6 reactour Linters: prettier, eslint. Branch RSSFE-01 contains login via github made frontend way. App description: The application is intended for use by students of The Rolling Scopes School. The purpose of the application is to enable students to collect teams from friends, and single students - to be automatically assigned to teams. Backend repo: https://github.com/rolling-scopes-school/RSS-Teams-BE MindMap: https://miro.com/welcomeonboard/2TsmiaGCbWQVZGhwyEW6EDfjdeQpOnKt6Hl62GvbVkT3ky3h02vqWHvI2gCz76cG # Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `yarn start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.\ You will also see any lint errors in the console. ### `yarn test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `yarn build` Builds the app for production to the `build` folder.\ It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\ Your app is ready to be deployed! See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `yarn eject` **Note: this is a one-way operation. Once you `eject`, you can’t go back!** If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ================================================ FILE: firebase.json ================================================ { "hosting": { "public": "build", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } } ================================================ FILE: package.json ================================================ { "name": "rss-teams-fe", "version": "0.1.0", "private": true, "dependencies": { "@apollo/client": "^3.3.7", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "@types/jest": "^26.0.15", "@types/node": "^12.0.0", "@types/react": "^16.9.53", "@types/react-dom": "^16.9.8", "@types/react-router-dom": "^5.1.7", "@types/react-virtualized-auto-sizer": "^1.0.0", "@types/react-window": "^1.8.2", "@types/reactour": "^1.18.1", "@types/redux-actions": "^2.6.1", "@types/styled-components": "^5.1.7", "graphql": "^15.5.0", "i18next": "^19.9.1", "react": "^17.0.1", "react-dom": "^17.0.1", "react-hook-form": "^6.15.1", "react-i18next": "^11.8.8", "react-paginate": "^7.0.0", "react-redux": "^7.2.2", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "react-virtualized-auto-sizer": "^1.0.4", "react-window": "^1.8.6", "reactour": "^1.18.3", "redux": "^4.0.5", "redux-actions": "^2.6.5", "redux-thunk": "^2.3.0", "styled-components": "^5.2.1", "typescript": "4.2.4", "web-vitals": "^0.2.4" }, "scripts": { "start": "react-scripts start", "build": "npm run pre-build && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "pre-build": "node pre-build", "deploy": "firebase deploy", "lint:eslint": "eslint \"{,!(node_modules)/**/}*.{ts,tsx}\"", "fix:prettier": "prettier --write \"{,!(node_modules)/**/}*.{ts,tsx}\"", "fix:eslint": "eslint --fix \"{,!(node_modules)/**/}*.{{ts,tsx}\"" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "@types/react-paginate": "^6.2.1", "@types/react-redux": "^7.1.16", "@types/redux": "^3.6.0", "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", "eslint": "^7.19.0", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "prettier": "^2.2.1", "redux-devtools-extension": "^2.13.8" } } ================================================ FILE: pre-build.js ================================================ /* eslint-disable @typescript-eslint/no-var-requires */ const fs = require('fs'); require('dotenv').config(); const BACKEND_LINK = `export const BACKEND_LINK = 'https://rss-teams.herokuapp.com/graphql'; `; const AUTH_BACKEND_LINK = `export const AUTH_BACKEND_LINK = 'https://rss-teams.herokuapp.com/auth/github/'; `; fs.writeFileSync('./src/appConstants/api.ts', BACKEND_LINK + AUTH_BACKEND_LINK); ================================================ FILE: public/index.html ================================================ RSS Teams
================================================ FILE: public/manifest.json ================================================ { "short_name": "RSS Teams", "name": "The Rolling Scopes School Teams", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "favicon.png", "type": "image/png", "sizes": "192x192" }, { "src": "favicon.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ================================================ FILE: src/appConstants/api.ts ================================================ export const BACKEND_LINK = 'https://rss-teams-dev.herokuapp.com/graphql'; export const AUTH_BACKEND_LINK = 'https://rss-teams-dev.herokuapp.com/auth/github/'; ================================================ FILE: src/appConstants/colors.ts ================================================ export const WHITE_COLOR = '#FFFFFF'; export const BG_COLOR = '#F2F8FD'; export const MAIN1_COLOR = '#6550F6'; // violet export const MAIN1_DARK_COLOR = '#5039EF'; // dark violet export const MAIN2_COLOR = '#FA6678'; // red export const MAIN2_LIGHT_COLOR = '#FE7888'; // light red export const LIGHT_TEXT_COLOR = '#7E96C2'; export const DARK_TEXT_COLOR = '#363D48'; export const OVERLAY_COLOR = '#363D4866'; export const DASHBOARD_HEADER_BG_COLOR = '#E1EEFA'; export const TABLE_SCROLLBAR_BG_COLOR = '#F9F9FD'; export const TABLE_SCROLLBAR_THUMB_COLOR = '#1E33570D'; export const TABLE_POPUP_BORDER_COLOR = '#363D4833'; export const FOOTER_NAMES_COLOR = '#9CA5B5'; export const ALERT_COLOR = '#FA6678'; // red ================================================ FILE: src/appConstants/index.ts ================================================ export { BACKEND_LINK, AUTH_BACKEND_LINK } from './api'; export const SET_USER_DATA = 'SET_USER_DATA'; export const AUTH_TOKEN = 'AUTH_TOKEN'; export const SET_TOKEN = 'SET_TOKEN'; export const SET_CURR_COURSE = 'SET_CURR_COURSE'; export const SET_COMMON_ERROR = 'SET_COMMON_ERROR'; export const SET_BURGER_MENU_OPEN = 'SET_BURGER_MENU_OPEN'; export const ACTIVE_MODAL_EXPEL = 'ACTIVE_MODAL_EXPEL'; export const ACTIVE_MODAL_LEAVE = 'ACTIVE_MODAL_LEAVE'; export const ACTIVE_MODAL_JOIN = 'ACTIVE_MODAL_JOIN'; export const ACTIVE_MODAL_CREATE_TEAM = 'ACTIVE_MODAL_CREATE_TEAM'; export const ACTIVE_MODAL_CREATED = 'ACTIVE_MODAL_CREATED'; export const ACTIVE_MODAL_UPDATE_SOCIAL_LINK = 'ACTIVE_MODAL_UPDATE_SOCIAL_LINK'; export const ACTIVE_MODAL_REMOVE_COURSE = 'ACTIVE_MODAL_REMOVE_COURSE'; export const ACTIVE_MODAL_SORT_STUDENTS = 'ACTIVE_MODAL_SORT_STUDENTS'; export const ACTIVE_MODAL_LEAVE_PAGE = 'ACTIVE_MODAL_LEAVE_PAGE'; export const ACTIVE_MODAL_CREATED_COURSE = 'ACTIVE_MODAL_CREATED_COURSE'; export const ACTIVE_MODAL_EDIT_COURSE = 'ACTIVE_MODAL_EDIT_COURSE'; export const SET_TEAM_MEMBER_EXPEL_ID = 'SET_TEAM_MEMBER_EXPEL_ID'; export const SET_TEAM_PASSWORD = 'SET_TEAM_PASSWORD'; export const SET_SOCIAL_LINK = 'SET_SOCIAL_LINK'; export const SET_FILTER_DATA = 'SET_FILTER_DATA'; export const SET_CURR_LANG = 'SET_CURR_LANG'; export const SET_EDIT_PROFILE_DATA_CHANGE = 'SET_EDIT_PROFILE_DATA_CHANGE'; export const SET_PATH_TO_THE_PAGE = 'SET_PATH_TO_THE_PAGE'; export const SET_IS_TOUR_OPEN = 'SET_IS_TOUR_OPEN'; export const USERS_PER_PAGE = 20; export const TEAMS_PER_PAGE = 10; export const CURRENT_YEAR = new Date(Date.now()).getFullYear(); export const CURRENT_COURSE = 'currentCourse'; export const CURRENT_LANG = 'currentLanguage'; export const TOUR_OPENING = 'tourOpening'; export const TABLE_HEADERS = [ '№', 'First / Last Name', 'Score', 'Team Number', 'Telegram', 'Discord', 'Github', 'Location', 'Courses', ]; export const TABLE_TEAMS_HEADERS = [ '№', 'First / Last Name', 'Score', 'Telegram', 'Discord', 'Github', 'Location', 'Action', ]; export const INPUT_VALUES_EDIT_PROFILE: string[] = [ 'firstName', 'lastName', 'discord', 'telegram', 'city', 'country', 'score', ]; export const MODAL_INPUT_VALIDATION = { pattern: { value: /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?|^((http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/, message: 'Use the format', }, maxLength: { value: 55, message: 'This input exceed maxLength.', }, }; export const COURSE_NAME_VALIDATION = { pattern: { value: `${CURRENT_YEAR}`, message: 'Please, enter correct course name', }, minLength: { value: 5, message: 'Minimal length is 5.', }, maxLength: { value: 55, message: 'This input exceed maxLength.', }, uniq: { message: 'Please, enter unique course name', }, }; export const TEAM_SIZE_VALIDATION = { pattern: { value: /^[2-9]$/i, message: 'Please, enter correct team size', }, minLength: { value: 1, message: 'Minimal length is 1.', }, maxLength: { value: 1, message: 'This input exceed maxLength.', }, }; export const APP_NAVIGATION_LINKS = { ['/students']: { name: 'Dashboard', isAlwaysVisible: false, }, ['/']: { name: 'Teams', isAlwaysVisible: false, }, ['/edit-profile']: { name: 'Edit Profile', isAlwaysVisible: true, }, ['/tutorial']: { name: 'Tutorial', isAlwaysVisible: true, }, ['/admin']: { name: 'Admin', isAlwaysVisible: true, }, }; export const DEFAULT_LANGUAGE = 'en'; export const LANGUAGES: string[] = [DEFAULT_LANGUAGE, 'ru']; export const Language: { [key: string]: string } = { en: 'EN', ru: 'RU', }; export const FOOTER_INFO = [ { title: 'Development', members: ['besovadevka', 'MadaShindeInai', 'self067', 'manuminsk', 'Malagor', 'dariavv'], }, { title: 'Design', members: ['Nastya Kapylova'], }, ]; export const LINK_TO_DESIGN_BLOCK = 'https://www.linkedin.com/in/nastya-kapylova-54126215a'; export const LINK_TO_REPO = 'https://github.com/rolling-scopes-school/RSS-Teams-FE'; export const addCourseInputsInfo = [ { label: 'Course name', placeholder: 'Enter course name' }, { label: 'Team size', placeholder: 'Enter team size' }, ]; export const SHOW_COURSES_OPTIONS = [ { id: '1', name: 'All' }, { id: '2', name: 'Active' }, { id: '3', name: 'Terminated' }, ]; export const UNAUTHORIZED_ERROR_MESSAGE = 'Unauthorized'; ================================================ FILE: src/components/App/index.tsx ================================================ import React, { FC, useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Route, Switch } from 'react-router-dom'; import { TeamsList, LoginPage, StudentsTable, TokenPage, NotFoundPage, EditProfile, TutorialPage, AdminPage, } from 'modules'; import { Loader, PrivateRoute, Header, Footer, ErrorModal, TourGuide } from 'components'; import { selectToken } from 'modules/LoginPage/selectors'; import { AUTH_TOKEN, CURRENT_COURSE, CURRENT_LANG, DEFAULT_LANGUAGE } from 'appConstants'; import { useWhoAmIQuery } from 'hooks/graphql'; import { AppStyled } from './styled'; import { setToken } from 'modules/LoginPage/loginPageReducer'; import { setUserData } from 'modules/StudentsTable/studentsTableReducer'; import { setCourse, setLanguage } from 'modules/LoginPage/loginPageMiddleware'; export const App: FC = () => { const dispatch = useDispatch(); const loginToken = useSelector(selectToken); const [loading, setLoading] = useState(true); const { loadingW, whoAmI, errorW } = useWhoAmIQuery({ skip: loginToken === null, }); const newUserCheck = !!whoAmI?.courses.length; const isUserAdmin = !!whoAmI?.isAdmin; useEffect(() => { if (!loginToken) { const token = sessionStorage.getItem(AUTH_TOKEN); if (token) dispatch(setToken(token)); } if (!!whoAmI) { dispatch(setUserData(whoAmI)); } if (whoAmI?.courses[0]) { dispatch(setLanguage(localStorage.getItem(CURRENT_LANG) ?? DEFAULT_LANGUAGE)); dispatch( setCourse(JSON.parse(localStorage.getItem(CURRENT_COURSE) as string) ?? whoAmI?.courses[0]) ); } if (!loadingW) setLoading(false); }, [dispatch, loginToken, loadingW, loading, whoAmI]); if (errorW) return ; if (loading || loadingW) return ; return (
{!!loginToken &&