switched to yarn:
This commit is contained in:
parent
9ae0ba509d
commit
f75dcb668a
15
.vscode/launch.json
vendored
15
.vscode/launch.json
vendored
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Launch Chrome against localhost",
|
|
||||||
"url": "http://localhost:3000",
|
|
||||||
"webRoot": "${workspaceFolder}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
14123
package-lock.json
generated
14123
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
19
package.json
19
package.json
@ -17,16 +17,27 @@
|
|||||||
"@types/react": "^16.9.46",
|
"@types/react": "^16.9.46",
|
||||||
"@types/react-dom": "^16.9.8",
|
"@types/react-dom": "^16.9.8",
|
||||||
"@types/styled-components": "^5.1.2",
|
"@types/styled-components": "^5.1.2",
|
||||||
"prettier": "^2.0.5",
|
"@typescript-eslint/eslint-plugin": "^4.8.1",
|
||||||
|
"@typescript-eslint/parser": "^4.8.1",
|
||||||
|
"eslint-config-prettier": "^6.15.0",
|
||||||
|
"eslint-config-react-app": "^6.0.0",
|
||||||
|
"eslint-loader": "^4.0.2",
|
||||||
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
|
"eslint-plugin-react": "^7.21.5",
|
||||||
|
"prettier": "^2.2.0",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.7"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject"
|
||||||
"lint": "eslint src/*.{js,ts,tsx} --quiet --fix"
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
@ -1,24 +1,42 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="pl">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%PUBLIC_URL%/logo.svg" />
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<meta name="description" content="Web site created using create-react-app" />
|
<meta
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.svg" />
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;700&display=swap" rel="stylesheet">
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
<title>PlanNaPlan</title>
|
-->
|
||||||
</head>
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>Potrzebujesz włączyć JavaScript, żeby otworzyć tę aplikację</br>You need to enable JavaScript to run this
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
app.</noscript>
|
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
</body>
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
</html>
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"short_name": "PlanNaPlan",
|
|
||||||
"name": "PlanNaPlan",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "logo.svg"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": ".",
|
|
||||||
"display": "standalone",
|
|
||||||
"theme_color": "#000000",
|
|
||||||
"background_color": "#ffffff"
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
import React, { useState, useContext } from 'react';
|
import React, { useState } from 'react';
|
||||||
import Topbar from './Topbar';
|
import Topbar from './Topbar';
|
||||||
import {Admin} from './Admin';
|
|
||||||
import { Transfer } from './Transfer';
|
import { Transfer } from './Transfer';
|
||||||
import { Scheduler } from './Scheduler';
|
import { Scheduler } from './Scheduler';
|
||||||
import { Rightbar } from './Rightbar';
|
import { Rightbar } from './Rightbar';
|
||||||
@ -9,9 +8,9 @@ import styled from 'styled-components';
|
|||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 80px);
|
height: calc(100vh - 80px);
|
||||||
background-color: #ECEEF4;
|
background-color: #eceef4;
|
||||||
padding-top:20px;
|
padding-top: 20px;
|
||||||
padding-bottom:20px;
|
padding-bottom: 20px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const App = () => {
|
export const App = () => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useContext, useEffect, MouseEvent } from 'react';
|
import React, { useState, useContext, useEffect, MouseEvent, useMemo } from 'react';
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
import { coursesContext } from '../contexts/CoursesProvider';
|
||||||
import { Course } from '../types';
|
import { Course } from '../types';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
@ -47,9 +47,8 @@ interface DropdownProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Dropdown = ({ open, input, handleCloseDropdown }: DropdownProps) => {
|
export const Dropdown = ({ open, input, handleCloseDropdown }: DropdownProps) => {
|
||||||
const { courses, basket, addCourseToBasket } = useContext(coursesContext)!;
|
const { courses, selectBasketNames, addCourseToBasket } = useContext(coursesContext)!;
|
||||||
const basketNames = basket.map(({ name }) => name.trim());
|
const basketNames = useMemo(() => selectBasketNames(), [selectBasketNames]);
|
||||||
|
|
||||||
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
||||||
|
|
||||||
const onCourseClick = (event: MouseEvent) => {
|
const onCourseClick = (event: MouseEvent) => {
|
||||||
@ -79,7 +78,7 @@ export const Dropdown = ({ open, input, handleCloseDropdown }: DropdownProps) =>
|
|||||||
setFilteredCourses(filteredCourses);
|
setFilteredCourses(filteredCourses);
|
||||||
};
|
};
|
||||||
filterCourses(input);
|
filterCourses(input);
|
||||||
}, [open, input, basket]);
|
}, [basketNames, courses, input]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownContainer>
|
<DropdownContainer>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, MouseEvent, ChangeEvent, useEffect, useRef } from 'react';
|
import React, { useState, MouseEvent, ChangeEvent, useEffect, useCallback } from 'react';
|
||||||
import { ReactComponent as Close } from '../assets/close.svg';
|
import { ReactComponent as Close } from '../assets/close.svg';
|
||||||
import ProfileIcon from '../assets/account.svg';
|
import ProfileIcon from '../assets/account.svg';
|
||||||
import { Profile } from './Profile';
|
import { Profile } from './Profile';
|
||||||
@ -119,14 +119,11 @@ export default function ({ handleTransfer }: TopbarProps) {
|
|||||||
|
|
||||||
const handleCloseProfile = () => setAnchorEl(null);
|
const handleCloseProfile = () => setAnchorEl(null);
|
||||||
|
|
||||||
const handleClearInput = () => setClearInput(!clearInput);
|
const handleClearInput = useCallback(() => setClearInput((clearInput) => !clearInput), []);
|
||||||
|
|
||||||
const handleChange = (event: ChangeEvent<HTMLInputElement>) => setInput(event.target.value);
|
const handleChange = (event: ChangeEvent<HTMLInputElement>) => setInput(event.target.value);
|
||||||
|
|
||||||
const handleShowDropdown = () => {
|
const handleShowDropdown = () => setOpen(true);
|
||||||
console.log('show dropdown');
|
|
||||||
setOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCloseDropdown = () => setOpen(false);
|
const handleCloseDropdown = () => setOpen(false);
|
||||||
|
|
||||||
@ -135,14 +132,7 @@ export default function ({ handleTransfer }: TopbarProps) {
|
|||||||
setInput('');
|
setInput('');
|
||||||
handleClearInput();
|
handleClearInput();
|
||||||
}
|
}
|
||||||
}, [clearInput]);
|
}, [clearInput, handleClearInput]);
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// console.log('input changed');
|
|
||||||
// if (!open) {
|
|
||||||
// setOpen(true);
|
|
||||||
// }
|
|
||||||
// }, [input]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Topbar>
|
<Topbar>
|
||||||
|
@ -18,27 +18,26 @@ export const CASProvider = ({ children }: CASProviderProps) => {
|
|||||||
const [user, setUser] = useState<User | undefined>(undefined);
|
const [user, setUser] = useState<User | undefined>(undefined);
|
||||||
const [token, setToken] = useState<string | null>(null);
|
const [token, setToken] = useState<string | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const login = async () => {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const ticket = urlParams.get('ticket');
|
||||||
|
if (!ticket) {
|
||||||
|
redirectToCASLoginService();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!sessionStorage.getItem('userToken')) {
|
||||||
|
const { data: token } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`);
|
||||||
|
sessionStorage.setItem('userToken', token);
|
||||||
|
}
|
||||||
|
const token = sessionStorage.getItem('userToken');
|
||||||
|
setToken(token);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
login();
|
login();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const login = async () => {
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
const ticket = urlParams.get('ticket');
|
|
||||||
if (!ticket) {
|
|
||||||
redirectToCASLoginService();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (!sessionStorage.getItem('userToken')) {
|
|
||||||
const { data: token } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`);
|
|
||||||
sessionStorage.setItem('userToken', token);
|
|
||||||
}
|
|
||||||
const token = sessionStorage.getItem('userToken');
|
|
||||||
setToken(token);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
redirectToCASLogoutService();
|
redirectToCASLogoutService();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useState, createContext, useEffect, ReactNode, useContext } from 'react';
|
import React, { useState, createContext, useEffect, ReactNode } from 'react';
|
||||||
import { Course, Group, Basket, GroupType, SchedulerEvent } from '../types';
|
import { Course, Group, Basket, GroupType, SchedulerEvent } from '../types';
|
||||||
import { useSnackbar } from 'notistack';
|
import { useSnackbar } from 'notistack';
|
||||||
import { createClassTime } from '../utils';
|
import { createClassTime } from '../utils';
|
||||||
@ -120,7 +120,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
);
|
);
|
||||||
const basket = data === '' ? [] : data;
|
const basket = data === '' ? [] : data;
|
||||||
setBasket(basket);
|
setBasket(basket);
|
||||||
console.log('newest timetable: ', basket);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
@ -132,7 +131,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
||||||
);
|
);
|
||||||
const sortedCourses = courses.sort((a, b) => (a.name > b.name ? 1 : -1));
|
const sortedCourses = courses.sort((a, b) => (a.name > b.name ? 1 : -1));
|
||||||
console.log('courses: ', courses);
|
|
||||||
setCourses(sortedCourses);
|
setCourses(sortedCourses);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user