Compare commits
No commits in common. "master" and "unit-tests" have entirely different histories.
master
...
unit-tests
61
package-lock.json
generated
@ -4510,12 +4510,6 @@
|
|||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fsevents": {
|
|
||||||
"version": "2.1.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
|
|
||||||
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"is-number": {
|
"is-number": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||||
@ -5388,11 +5382,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"date-fns": {
|
|
||||||
"version": "2.16.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz",
|
|
||||||
"integrity": "sha512-sAJVKx/FqrLYHAQeN7VpJrPhagZc9R4ImZIWYRFZaaohR3KzmuK88touwsSwSVT8Qcbd4zoDsnGfX4GFB4imyQ=="
|
|
||||||
},
|
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "4.3.1",
|
"version": "4.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||||
@ -7306,14 +7295,10 @@
|
|||||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
},
|
},
|
||||||
"fsevents": {
|
"fsevents": {
|
||||||
"version": "1.2.13",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
|
||||||
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
|
||||||
"optional": true,
|
"optional": true
|
||||||
"requires": {
|
|
||||||
"bindings": "^1.5.0",
|
|
||||||
"nan": "^2.12.1"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"function-bind": {
|
"function-bind": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@ -8642,6 +8627,18 @@
|
|||||||
"micromatch": "^3.1.10",
|
"micromatch": "^3.1.10",
|
||||||
"sane": "^4.0.3",
|
"sane": "^4.0.3",
|
||||||
"walker": "^1.0.7"
|
"walker": "^1.0.7"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"fsevents": {
|
||||||
|
"version": "1.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
||||||
|
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"nan": "^2.12.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jest-jasmine2": {
|
"jest-jasmine2": {
|
||||||
@ -12341,12 +12338,6 @@
|
|||||||
"pinkie-promise": "^2.0.0"
|
"pinkie-promise": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fsevents": {
|
|
||||||
"version": "2.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz",
|
|
||||||
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==",
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"path-exists": {
|
"path-exists": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
|
||||||
@ -14899,6 +14890,16 @@
|
|||||||
"upath": "^1.1.1"
|
"upath": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "1.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
||||||
|
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"nan": "^2.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"glob-parent": {
|
"glob-parent": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz",
|
||||||
@ -15206,6 +15207,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "1.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
|
||||||
|
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"nan": "^2.12.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"get-caller-file": {
|
"get-caller-file": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
"@material-ui/icons": "^4.9.1",
|
"@material-ui/icons": "^4.9.1",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.56",
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"date-fns": "^2.16.1",
|
|
||||||
"notistack": "^1.0.1",
|
"notistack": "^1.0.1",
|
||||||
"react": "16.9.0",
|
"react": "16.9.0",
|
||||||
"react-click-away-listener": "^1.4.3",
|
"react-click-away-listener": "^1.4.3",
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
||||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 330 330" style="enable-background:new 0 0 330 330;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<path d="M165,0C74.019,0,0,74.02,0,165.001C0,255.982,74.019,330,165,330s165-74.018,165-164.999C330,74.02,255.981,0,165,0z
|
|
||||||
M165,300c-74.44,0-135-60.56-135-134.999C30,90.562,90.56,30,165,30s135,60.562,135,135.001C300,239.44,239.439,300,165,300z"/>
|
|
||||||
<path d="M164.998,70c-11.026,0-19.996,8.976-19.996,20.009c0,11.023,8.97,19.991,19.996,19.991
|
|
||||||
c11.026,0,19.996-8.968,19.996-19.991C184.994,78.976,176.024,70,164.998,70z"/>
|
|
||||||
<path d="M165,140c-8.284,0-15,6.716-15,15v90c0,8.284,6.716,15,15,15c8.284,0,15-6.716,15-15v-90C180,146.716,173.284,140,165,140z
|
|
||||||
"/>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.1 KiB |
@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 492 492" style="enable-background:new 0 0 492 492;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<path d="M198.608,246.104L382.664,62.04c5.068-5.056,7.856-11.816,7.856-19.024c0-7.212-2.788-13.968-7.856-19.032l-16.128-16.12
|
|
||||||
C361.476,2.792,354.712,0,347.504,0s-13.964,2.792-19.028,7.864L109.328,227.008c-5.084,5.08-7.868,11.868-7.848,19.084
|
|
||||||
c-0.02,7.248,2.76,14.028,7.848,19.112l218.944,218.932c5.064,5.072,11.82,7.864,19.032,7.864c7.208,0,13.964-2.792,19.032-7.864
|
|
||||||
l16.124-16.12c10.492-10.492,10.492-27.572,0-38.06L198.608,246.104z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 964 B |
@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<path d="M255.15,468.625H63.787c-11.737,0-21.262-9.526-21.262-21.262V64.638c0-11.737,9.526-21.262,21.262-21.262H255.15
|
|
||||||
c11.758,0,21.262-9.504,21.262-21.262S266.908,0.85,255.15,0.85H63.787C28.619,0.85,0,29.47,0,64.638v382.724
|
|
||||||
c0,35.168,28.619,63.787,63.787,63.787H255.15c11.758,0,21.262-9.504,21.262-21.262
|
|
||||||
C276.412,478.129,266.908,468.625,255.15,468.625z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<path d="M505.664,240.861L376.388,113.286c-8.335-8.25-21.815-8.143-30.065,0.213s-8.165,21.815,0.213,30.065l92.385,91.173
|
|
||||||
H191.362c-11.758,0-21.262,9.504-21.262,21.262c0,11.758,9.504,21.263,21.262,21.263h247.559l-92.385,91.173
|
|
||||||
c-8.377,8.25-8.441,21.709-0.213,30.065c4.167,4.21,9.653,6.336,15.139,6.336c5.401,0,10.801-2.041,14.926-6.124l129.276-127.575
|
|
||||||
c4.04-3.997,6.336-9.441,6.336-15.139C512,250.302,509.725,244.88,505.664,240.861z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 492.004 492.004" style="enable-background:new 0 0 492.004 492.004;" xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<g>
|
|
||||||
<path d="M382.678,226.804L163.73,7.86C158.666,2.792,151.906,0,144.698,0s-13.968,2.792-19.032,7.86l-16.124,16.12
|
|
||||||
c-10.492,10.504-10.492,27.576,0,38.064L293.398,245.9l-184.06,184.06c-5.064,5.068-7.86,11.824-7.86,19.028
|
|
||||||
c0,7.212,2.796,13.968,7.86,19.04l16.124,16.116c5.068,5.068,11.824,7.86,19.032,7.86s13.968-2.792,19.032-7.86L382.678,265
|
|
||||||
c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z"/>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 971 B |
@ -1 +0,0 @@
|
|||||||
<svg id="bold" enable-background="new 0 0 24 24" height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m23.25 15c-.414 0-.75-.336-.75-.75 0-2.895-2.355-5.25-5.25-5.25h-7.25v3.25c0 .66-.794.994-1.268.542l-5.5-5.25c-.148-.141-.232-.337-.232-.542s.084-.401.232-.542l5.5-5.25c.476-.454 1.268-.116 1.268.542v3.25h6.25c4.273 0 7.75 3.477 7.75 7.75v1.5c0 .414-.336.75-.75.75z"/><path d="m14 22.25v-3.25h-6.25c-4.273 0-7.75-3.477-7.75-7.75v-1.5c0-.414.336-.75.75-.75s.75.336.75.75c0 2.895 2.355 5.25 5.25 5.25h7.25v-3.25c0-.657.791-.998 1.268-.542l5.5 5.25c.148.141.232.337.232.542s-.084.401-.232.542l-5.5 5.25c-.477.454-1.268.116-1.268-.542z"/></svg>
|
|
Before Width: | Height: | Size: 678 B |
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
||||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
||||||
viewBox="0 0 468.293 468.293" style="enable-background:new 0 0 468.293 468.293;" xml:space="preserve">
|
|
||||||
<circle style="fill:#44C4A1;" cx="234.146" cy="234.146" r="234.146"/>
|
|
||||||
<polygon style="fill:#EBF0F3;" points="357.52,110.145 191.995,275.67 110.773,194.451 69.534,235.684 191.995,358.148
|
|
||||||
398.759,151.378 "/>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
<g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 719 B |
@ -1 +0,0 @@
|
|||||||
<svg id="bold" enable-background="new 0 0 24 24" height="512" viewBox="0 0 24 24" width="512" xmlns="http://www.w3.org/2000/svg"><path d="m20.25 11c-.414 0-.75-.336-.75-.75v-4.5c0-.689-.561-1.25-1.25-1.25h-7.5c-.414 0-.75-.336-.75-.75s.336-.75.75-.75h7.5c1.517 0 2.75 1.233 2.75 2.75v4.5c0 .414-.336.75-.75.75z"/><path d="m20.25 11c-.192 0-.384-.073-.53-.22l-1.75-1.75c-.214-.214-.279-.537-.163-.817s.39-.463.693-.463h3.5c.303 0 .577.183.693.463s.052.603-.163.817l-1.75 1.75c-.146.147-.338.22-.53.22z"/><path d="m11.25 21h-5.5c-1.517 0-2.75-1.233-2.75-2.75v-4.5c0-.414.336-.75.75-.75s.75.336.75.75v4.5c0 .689.561 1.25 1.25 1.25h5.5c.414 0 .75.336.75.75s-.336.75-.75.75z"/><path d="m5.5 16.25h-3.5c-.303 0-.577-.183-.693-.463s-.052-.603.163-.817l1.75-1.75c.293-.293.768-.293 1.061 0l1.75 1.75c.214.214.279.537.163.817s-.391.463-.694.463z"/><circle cx="5" cy="2.5" r="2.5"/><path d="m7.25 6h-4.5c-1.517 0-2.75 1.233-2.75 2.75v.5c0 .414.336.75.75.75h8.5c.414 0 .75-.336.75-.75v-.5c0-1.517-1.233-2.75-2.75-2.75z"/><path d="m19 19c-1.378 0-2.5-1.122-2.5-2.5s1.122-2.5 2.5-2.5 2.5 1.122 2.5 2.5-1.122 2.5-2.5 2.5z"/><path d="m23.25 24h-8.5c-.414 0-.75-.336-.75-.75v-.5c0-1.517 1.233-2.75 2.75-2.75h4.5c1.517 0 2.75 1.233 2.75 2.75v.5c0 .414-.336.75-.75.75z"/></svg>
|
|
Before Width: | Height: | Size: 1.2 KiB |
@ -1,14 +1,10 @@
|
|||||||
import React, { useState, MouseEvent,useContext } from 'react';
|
import React, { useState, MouseEvent } from 'react';
|
||||||
import styled from 'styled-components/macro';
|
import styled from 'styled-components/macro';
|
||||||
import Plan from '../assets/plan.svg';
|
import Plan from '../assets/plan.svg';
|
||||||
import History from '../assets/history.svg';
|
import History from '../assets/history.svg';
|
||||||
import StatisticsIcon from '../assets/statistics.svg';
|
import Statistics from '../assets/statistics.svg';
|
||||||
import { Statistics } from './Statistics';
|
|
||||||
import { Scheduler } from './Scheduler';
|
import { Scheduler } from './Scheduler';
|
||||||
import { Rightbar } from './Rightbar';
|
import { Rightbar } from './Rightbar';
|
||||||
import { SchedulerHistory } from './SchedulerHistory';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import { SchedulerEvent } from '../types';
|
|
||||||
|
|
||||||
const LeftSide = styled.div`
|
const LeftSide = styled.div`
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -17,7 +13,7 @@ const LeftSide = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-radius: 5px;
|
border-radius:5px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Wrap = styled.div`
|
const Wrap = styled.div`
|
||||||
@ -49,11 +45,11 @@ const LeftPanelElement = styled.div<LeftPanelElement>`
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow: ${({ isCurrentTab }) => (isCurrentTab === true ? `inset 0px 0px 11px 0px rgba(0,0,0,0.30)` : '')};
|
box-shadow: ${({ isCurrentTab }) => (isCurrentTab === true ? `inset 0px 0px 11px 0px rgba(0,0,0,0.30)` : '')};
|
||||||
border-bottom: 1px solid #979797;
|
border-bottom: 1px solid #979797;
|
||||||
:first-child {
|
:first-child{
|
||||||
border-radius: 0px 5px 0px 0px;
|
border-radius:0px 5px 0px 0px;
|
||||||
}
|
}
|
||||||
:last-child {
|
:last-child{
|
||||||
border-radius: 0px 0px 5px 0px;
|
border-radius:0px 0px 5px 0px;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -98,19 +94,11 @@ const Icon = styled.img`
|
|||||||
margin: 5px;
|
margin: 5px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
interface Deanery {
|
export const Admin = () => {
|
||||||
schedulerEvents: Array<SchedulerEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Deanery = ({ schedulerEvents }: Deanery) => {
|
|
||||||
const [currentTab, setCurrentTab] = useState<null | number>(1);
|
const [currentTab, setCurrentTab] = useState<null | number>(1);
|
||||||
const { getNewestStudentTimetable,userID } = useContext(coursesContext)!;
|
|
||||||
const { selectHistorySchedulerEvents } = useContext(coursesContext)!;
|
|
||||||
const schedulerHistoryEvents = selectHistorySchedulerEvents();
|
|
||||||
|
|
||||||
const handleClick = (e: MouseEvent<HTMLDivElement>) => {
|
const handleClick = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
setCurrentTab(Number(e.currentTarget.id));
|
setCurrentTab(Number(e.currentTarget.id));
|
||||||
getNewestStudentTimetable(userID);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -125,20 +113,20 @@ export const Deanery = ({ schedulerEvents }: Deanery) => {
|
|||||||
Historia Zmian
|
Historia Zmian
|
||||||
</LeftPanelElement>
|
</LeftPanelElement>
|
||||||
<LeftPanelElement id={'3'} isCurrentTab={currentTab === 3} onClick={handleClick}>
|
<LeftPanelElement id={'3'} isCurrentTab={currentTab === 3} onClick={handleClick}>
|
||||||
<Icon alt="statistics" src={StatisticsIcon} />
|
<Icon alt="statistics" src={Statistics} />
|
||||||
Statystyki
|
Statystyki
|
||||||
</LeftPanelElement>
|
</LeftPanelElement>
|
||||||
</LeftSide>
|
</LeftSide>
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{currentTab === 1 ? (
|
{currentTab === 1 ? (
|
||||||
<>
|
<>
|
||||||
<Scheduler schedulerEvents={schedulerEvents}/>
|
<Scheduler />
|
||||||
<Rightbar />
|
<Rightbar />
|
||||||
</>
|
</>
|
||||||
) : currentTab === 2 ? (
|
) : currentTab === 2 ? (
|
||||||
<SchedulerHistory schedulerHistoryEvents={schedulerHistoryEvents}/>
|
<HistoryDiv />
|
||||||
) : currentTab === 3 ? (
|
) : currentTab === 3 ? (
|
||||||
<StatsDiv><Statistics/></StatsDiv>
|
<StatsDiv />
|
||||||
) : (
|
) : (
|
||||||
<LogoWrapper>
|
<LogoWrapper>
|
||||||
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
@ -1,266 +0,0 @@
|
|||||||
import { format } from 'date-fns';
|
|
||||||
import React, { useEffect, useState, useContext } from 'react';
|
|
||||||
import styled from 'styled-components/macro';
|
|
||||||
import { axiosInstance } from '../utils/axiosInstance';
|
|
||||||
import { useSnackbar } from 'notistack';
|
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
|
||||||
import { SyncLoader } from 'react-spinners';
|
|
||||||
import { CASContext } from '../contexts/CASProvider';
|
|
||||||
import LogoutIcon from '../assets/logout.svg';
|
|
||||||
import LogoPlanNaPlan from '../assets/logo.svg';
|
|
||||||
|
|
||||||
const StyledCloseIcon = styled(CloseIcon)`
|
|
||||||
color: #000000;
|
|
||||||
&:hover {
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Icon = styled.img`
|
|
||||||
width: 40px;
|
|
||||||
margin-left: 40px;
|
|
||||||
cursor: pointer;
|
|
||||||
@media only screen and (max-width: 670px) {
|
|
||||||
width: 35px;
|
|
||||||
}
|
|
||||||
position:absolute;
|
|
||||||
top:10px;
|
|
||||||
right:10px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const SaveButton = styled.button`
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
user-select: none;
|
|
||||||
background-color: #c7a424;
|
|
||||||
border: none;
|
|
||||||
font-weight: bold;
|
|
||||||
cursor: pointer;
|
|
||||||
height: 40px;
|
|
||||||
margin:10px;
|
|
||||||
&:hover {
|
|
||||||
color: #ffffff;
|
|
||||||
box-shadow: 0px 5px 4px 0px rgba(0, 0, 0, 0.24);
|
|
||||||
}
|
|
||||||
|
|
||||||
width: 150px;
|
|
||||||
`;
|
|
||||||
const AdministratorWrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
margin: 0 auto;
|
|
||||||
height: 100vh;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Wrap = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin:20px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const LogoWrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-top:-50px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Text = styled.div`
|
|
||||||
font-family: 'Roboto', sans-serif;
|
|
||||||
font-size: 5rem;
|
|
||||||
user-select: none;
|
|
||||||
margin-bottom:60px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Logo = styled.img`
|
|
||||||
width: 400px;
|
|
||||||
height: 400px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Form = styled.form`
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
input {
|
|
||||||
padding: 5px;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
width: 210px;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const DownloadSection = styled.div`
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
input {
|
|
||||||
padding: 5px;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
width: 210px;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
export const Administrator = () => {
|
|
||||||
const { logout } = useContext(CASContext)!;
|
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
|
||||||
const { closeSnackbar } = useSnackbar();
|
|
||||||
|
|
||||||
const today = new Date();
|
|
||||||
const dd = String(today.getDate()).padStart(2, '0');
|
|
||||||
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
|
||||||
const yyyy = today.getFullYear();
|
|
||||||
|
|
||||||
const date = yyyy + '-' + mm + '-' + dd;
|
|
||||||
|
|
||||||
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
|
||||||
const [startFirstDate, setStartFirstDate] = useState<Date | null>(null);
|
|
||||||
const [endFirstDate, setEndFirstDate] = useState<Date | null>(null);
|
|
||||||
const [startSecondDate, setStartSecondDate] = useState<Date | null>(null);
|
|
||||||
const [endSecondDate, setEndSecondDate] = useState<Date | null>(null);
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
|
|
||||||
const downloadFile = async () => {
|
|
||||||
|
|
||||||
const {data} = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/commisions/export/csv`,{responseType:"blob"});
|
|
||||||
|
|
||||||
const downloadUrl = window.URL.createObjectURL(new Blob([data]));
|
|
||||||
|
|
||||||
const link = document.createElement('a');
|
|
||||||
|
|
||||||
link.href = downloadUrl;
|
|
||||||
|
|
||||||
link.setAttribute('download', 'file.csv');
|
|
||||||
|
|
||||||
document.body.appendChild(link);
|
|
||||||
|
|
||||||
link.click();
|
|
||||||
|
|
||||||
link.remove();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
const uploadFile = async (event: React.FormEvent<HTMLFormElement>) => {
|
|
||||||
const action = (key: any) => (
|
|
||||||
<>
|
|
||||||
<StyledCloseIcon
|
|
||||||
onClick={() => {
|
|
||||||
closeSnackbar(key);
|
|
||||||
}}
|
|
||||||
></StyledCloseIcon>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
event.preventDefault();
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('file', selectedFile as Blob);
|
|
||||||
if (startFirstDate !== null) {
|
|
||||||
formData.append('firstTourBegin', format(startFirstDate, 'dd.MM.yyyy'));
|
|
||||||
}
|
|
||||||
if (endFirstDate !== null) {
|
|
||||||
formData.append('firstTourEnd', format(endFirstDate, 'dd.MM.yyyy'));
|
|
||||||
}
|
|
||||||
if (startSecondDate !== null) {
|
|
||||||
formData.append('secondTourBegin', format(startSecondDate, 'dd.MM.yyyy'));
|
|
||||||
}
|
|
||||||
if (endSecondDate !== null) {
|
|
||||||
formData.append('secondTourEnd', format(endSecondDate, 'dd.MM.yyyy'));
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
headers: {
|
|
||||||
'content-type': 'multipart/form-data',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
setLoading(true);
|
|
||||||
const response = await axiosInstance.post(
|
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/configurator/config/`,
|
|
||||||
formData,
|
|
||||||
config,
|
|
||||||
);
|
|
||||||
enqueueSnackbar('Ustawienia zostały zapisane', {
|
|
||||||
variant: 'success',
|
|
||||||
action,
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
enqueueSnackbar('Ustawienia nie zostały zapisane', {
|
|
||||||
variant: 'error',
|
|
||||||
action,
|
|
||||||
});
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
setLoading(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const xd = true;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AdministratorWrapper>
|
|
||||||
<Icon alt="logout" src={LogoutIcon} onClick={logout}/>
|
|
||||||
<Wrap>
|
|
||||||
<LogoWrapper>
|
|
||||||
<Logo alt="logo" src={LogoPlanNaPlan} />
|
|
||||||
<Text> plan na plan </Text>
|
|
||||||
</LogoWrapper>
|
|
||||||
{xd === true ? (
|
|
||||||
<div>
|
|
||||||
<Form onSubmit={uploadFile}>
|
|
||||||
<div>
|
|
||||||
<div>Start pierwszej tury:</div>{' '}
|
|
||||||
<div>
|
|
||||||
<input type="date" min={date} onChange={(e) => setStartFirstDate(e.target.valueAsDate)} />
|
|
||||||
</div>
|
|
||||||
<div>Koniec pierwszej tury:</div>{' '}
|
|
||||||
<div>
|
|
||||||
<input type="date" min={date} onChange={(e) => setEndFirstDate(e.target.valueAsDate)} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div>Start drugiej tury:</div>{' '}
|
|
||||||
<div>
|
|
||||||
<input type="date" min={date} onChange={(e) => setStartSecondDate(e.target.valueAsDate)} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div>Koniec drugiej tury:</div>{' '}
|
|
||||||
<div>
|
|
||||||
<input type="date" min={date} onChange={(e) => setEndSecondDate(e.target.valueAsDate)} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
onChange={(e) => {
|
|
||||||
if (e.target.files && e.target.files[0]) {
|
|
||||||
const file = e.target.files[0];
|
|
||||||
setSelectedFile(file);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<SaveButton type="submit">{loading === false ? 'Zapisz' : <SyncLoader />} </SaveButton>
|
|
||||||
</div>
|
|
||||||
</Form>
|
|
||||||
<DownloadSection>
|
|
||||||
<SaveButton onClick={downloadFile}>Pobierz dane.csv</SaveButton>
|
|
||||||
</DownloadSection>
|
|
||||||
</div>
|
|
||||||
) : (<div></div>
|
|
||||||
)}
|
|
||||||
</Wrap>
|
|
||||||
</AdministratorWrapper>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,15 +1,14 @@
|
|||||||
import React, { useContext, useState } from 'react';
|
import React, { ElementType, useContext, useEffect, useState } from 'react';
|
||||||
import Topbar from './Topbar';
|
import Topbar from './Topbar';
|
||||||
import { Transfer } from './Transfer';
|
import { Transfer } from './Transfer';
|
||||||
import { Deanery } from './DeaneryPanel';
|
import { Admin } from './Admin';
|
||||||
import { Scheduler } from './Scheduler';
|
import { Scheduler } from './Scheduler';
|
||||||
import { Rightbar } from './Rightbar';
|
import { Rightbar } from './Rightbar';
|
||||||
import { Administrator } from './Administrator';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import { coursesContext } from '../contexts/CoursesProvider';
|
||||||
import LoadingOverlay from 'react-loading-overlay';
|
import LoadingOverlay from 'react-loading-overlay';
|
||||||
import { SyncLoader } from 'react-spinners';
|
import { SyncLoader } from 'react-spinners';
|
||||||
import { CASContext } from '../contexts/CASProvider';
|
import { CASContext } from '../contexts/CASProvider';
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
height: calc(100vh - 80px);
|
height: calc(100vh - 80px);
|
||||||
@ -20,36 +19,33 @@ const Wrapper = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const App = () => {
|
export const App = () => {
|
||||||
const { role } = useContext(CASContext)!;
|
const { isDataLoading } = useContext(coursesContext)!;
|
||||||
|
const { isFetchingToken, user, role } = useContext(CASContext)!;
|
||||||
const [isOpenTransfer, setOpenTransfer] = useState(false);
|
const [isOpenTransfer, setOpenTransfer] = useState(false);
|
||||||
|
|
||||||
const { selectSchedulerEvents } = useContext(coursesContext)!;
|
|
||||||
const schedulerEvents = selectSchedulerEvents();
|
|
||||||
|
|
||||||
const handleTransfer = () => {
|
const handleTransfer = () => {
|
||||||
setOpenTransfer(!isOpenTransfer);
|
setOpenTransfer(!isOpenTransfer);
|
||||||
};
|
};
|
||||||
|
|
||||||
const userPrivilige = localStorage.getItem('userPrivilige');
|
const userPrivilige = localStorage.getItem('userPrivilige');
|
||||||
|
console.log('role of that user is: ', role);
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('is fetching token: ', isFetchingToken);
|
||||||
|
}, [isFetchingToken]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LoadingOverlay active={role === undefined} spinner={<SyncLoader />}>
|
<LoadingOverlay active={role === undefined} spinner={<SyncLoader />}>
|
||||||
{userPrivilige !== 'ADMIN' && (
|
<Topbar handleTransfer={handleTransfer} />
|
||||||
<>
|
<Transfer isOpen={isOpenTransfer} handleClose={handleTransfer} />
|
||||||
<Topbar handleTransfer={handleTransfer} />
|
<Wrapper>
|
||||||
<Transfer isTransferOpen={isOpenTransfer} handleClose={handleTransfer} />
|
{userPrivilige === 'STUDENT' && (
|
||||||
<Wrapper>
|
<>
|
||||||
{userPrivilige === 'STUDENT' && (
|
<Scheduler />
|
||||||
<>
|
<Rightbar />
|
||||||
<Scheduler schedulerEvents={schedulerEvents} />
|
</>
|
||||||
<Rightbar />
|
)}{' '}
|
||||||
</>
|
{userPrivilige === 'DEANERY' && <Admin />}
|
||||||
)}
|
</Wrapper>
|
||||||
{userPrivilige === 'DEANERY' && <Deanery schedulerEvents={schedulerEvents} />}
|
|
||||||
</Wrapper>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{userPrivilige === 'ADMIN' && <Administrator></Administrator>}
|
|
||||||
</LoadingOverlay>
|
</LoadingOverlay>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ const CourseCardWrapper = styled.div`
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
box-shadow: 3px 3px 5px 0px rgba(189,189,189,1);
|
box-shadow: 3px 3px 3px 0px rgba(0, 0, 0, 0.75);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TitleWrapper = styled.div`
|
const TitleWrapper = styled.div`
|
||||||
@ -158,11 +158,12 @@ export const CourseCard = ({ course }: CourseCardProps) => {
|
|||||||
} = useContext(coursesContext)!;
|
} = useContext(coursesContext)!;
|
||||||
const [isSelected, setSelected] = useState(true);
|
const [isSelected, setSelected] = useState(true);
|
||||||
const groups = [...course.lectures!, ...course.classes!];
|
const groups = [...course.lectures!, ...course.classes!];
|
||||||
const basketCourseGroups = useMemo(() => selectBasketCourseGroups(course.name), []);
|
const basketCourseGroups = useMemo(() => selectBasketCourseGroups(course.id), []);
|
||||||
const [previous, setPrevious] = useState(basketCourseGroups);
|
const [previous, setPrevious] = useState(basketCourseGroups);
|
||||||
|
|
||||||
|
console.log('course is: ', course);
|
||||||
const onGroupClick = (group: Group, courseId: number) => {
|
const onGroupClick = (group: Group, courseId: number) => {
|
||||||
setPrevious((prev) => (group.type === GroupType.CLASS ? { ...prev, classes: group, prev:"classes" } : { ...prev, lecture: group,prev:"lecture" }));
|
setPrevious((prev) => (group.type === GroupType.CLASS ? { ...prev, classes: group } : { ...prev, lecture: group }));
|
||||||
changeGroupInBasket(group, courseId);
|
changeGroupInBasket(group, courseId);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -187,17 +188,22 @@ export const CourseCard = ({ course }: CourseCardProps) => {
|
|||||||
onClick={() => onGroupClick(group, course.id)}
|
onClick={() => onGroupClick(group, course.id)}
|
||||||
onMouseEnter={() => {
|
onMouseEnter={() => {
|
||||||
if (group.type === GroupType.CLASS) {
|
if (group.type === GroupType.CLASS) {
|
||||||
changeGroupInBasket({classes: group,lecture:previous.lecture}, course.id);
|
changeGroupInBasket(group, course.id);
|
||||||
}
|
}
|
||||||
if (group.type === GroupType.LECTURE) {
|
if (group.type === GroupType.LECTURE) {
|
||||||
changeGroupInBasket({lecture: group,classes:previous.classes}, course.id);
|
changeGroupInBasket(group, course.id);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onMouseLeave={() => {
|
onMouseLeave={() => {
|
||||||
if (hoveredGroup) {
|
if (hoveredGroup) {
|
||||||
changeGroupInBasket(previous, course.id);
|
if (hoveredGroup.type === GroupType.CLASS && previous.classes !== undefined) {
|
||||||
|
changeGroupInBasket(previous.classes, course.id);
|
||||||
|
}
|
||||||
|
if (hoveredGroup.type === GroupType.LECTURE && previous.lecture !== undefined) {
|
||||||
|
changeGroupInBasket(previous.lecture, course.id);
|
||||||
|
}
|
||||||
|
changeHoveredGroup(null);
|
||||||
}
|
}
|
||||||
changeHoveredGroup(null);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<StyledGroupType groupType={group.type}>{group.type === 'CLASS' ? 'ĆW' : 'WYK'}</StyledGroupType>
|
<StyledGroupType groupType={group.type}>{group.type === 'CLASS' ? 'ĆW' : 'WYK'}</StyledGroupType>
|
||||||
|
@ -50,7 +50,7 @@ interface DropdownProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Dropdown = ({ open, input, handleCloseDropdown, selectedOption }: DropdownProps) => {
|
export const Dropdown = ({ open, input, handleCloseDropdown, selectedOption }: DropdownProps) => {
|
||||||
const { courses, selectBasketNames, addCourseToBasket, changeStudent, getStudentTimetablesHistory } = useContext(coursesContext)!;
|
const { courses, selectBasketNames, addCourseToBasket, changeStudent } = useContext(coursesContext)!;
|
||||||
const { students, changeSelectedStudent } = useContext(studentsContext)!;
|
const { students, changeSelectedStudent } = useContext(studentsContext)!;
|
||||||
const basketNames = useMemo(() => selectBasketNames(), [selectBasketNames]);
|
const basketNames = useMemo(() => selectBasketNames(), [selectBasketNames]);
|
||||||
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
||||||
@ -67,10 +67,10 @@ export const Dropdown = ({ open, input, handleCloseDropdown, selectedOption }: D
|
|||||||
|
|
||||||
const onUserClick = (event: MouseEvent) => {
|
const onUserClick = (event: MouseEvent) => {
|
||||||
const target = event.currentTarget;
|
const target = event.currentTarget;
|
||||||
|
console.log('target: ', target);
|
||||||
//to be moved to students provider
|
//to be moved to students provider
|
||||||
changeStudent(target.id);
|
changeStudent(target.id);
|
||||||
changeSelectedStudent(Number(target.id));
|
changeSelectedStudent(Number(target.id));
|
||||||
|
|
||||||
handleCloseDropdown();
|
handleCloseDropdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,8 +105,7 @@ export const Dropdown = ({ open, input, handleCloseDropdown, selectedOption }: D
|
|||||||
input
|
input
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.normalize('NFD')
|
.normalize('NFD')
|
||||||
.replace(/[\u0300-\u036f]/g, '')
|
.replace(/[\u0300-\u036f]/g, ''),
|
||||||
.replace(/\s/g, ''),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
setFilteredStudents(filteredUsers);
|
setFilteredStudents(filteredUsers);
|
||||||
@ -120,10 +119,9 @@ export const Dropdown = ({ open, input, handleCloseDropdown, selectedOption }: D
|
|||||||
<>
|
<>
|
||||||
{selectedOption === 'studenci' ? (
|
{selectedOption === 'studenci' ? (
|
||||||
<div>
|
<div>
|
||||||
{filteredStudents.map(({ surname, name, email, id }, index) => (
|
{filteredStudents.map(({ email, id }, index) => (
|
||||||
<CourseContainer key={index} id={id.toString()} onClick={onUserClick}>
|
<CourseContainer key={index} id={id.toString()} onClick={onUserClick}>
|
||||||
{name=== ''? <p>{email}</p> :<p>{name} {surname}</p>}
|
<p>{email}</p>
|
||||||
|
|
||||||
</CourseContainer>
|
</CourseContainer>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,111 +0,0 @@
|
|||||||
import React, { useState, useContext, useEffect, MouseEvent, useMemo } from 'react';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import { studentsContext } from '../contexts/StudentsProvider';
|
|
||||||
import { Course, Student } from '../types';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
|
|
||||||
const DropdownContainer = styled.div`
|
|
||||||
position: relative;
|
|
||||||
z-index: 99999999;
|
|
||||||
max-height: 396px;
|
|
||||||
border-radius: 3px;
|
|
||||||
overflow-y: auto;
|
|
||||||
opacity: 0.97;
|
|
||||||
box-shadow: 0.05em 0.2em 0.6em rgba(0, 0, 0, 0.2);
|
|
||||||
scroll-snap-type: y mandatory;
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background-color: #f2f4f7;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
background-color: #f2f4f7;
|
|
||||||
width: 5px;
|
|
||||||
border-style: none;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
border-radius: 10px;
|
|
||||||
background-color: #4b4b4b;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const CourseContainer = styled.div`
|
|
||||||
padding: 5px;
|
|
||||||
padding-left: 20px;
|
|
||||||
background-color: #f2f4f7;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 500;
|
|
||||||
scroll-snap-align: end;
|
|
||||||
:hover {
|
|
||||||
background-color: #eceef4;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface DropdownProps {
|
|
||||||
open: boolean;
|
|
||||||
input: string;
|
|
||||||
handleCloseDropdown: () => void;
|
|
||||||
handleSelectedGroupChange: (event: React.ChangeEvent<{ value: unknown }>) => void;
|
|
||||||
selectedOption: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DropdownModal = ({
|
|
||||||
open,
|
|
||||||
input,
|
|
||||||
handleCloseDropdown,
|
|
||||||
selectedOption,
|
|
||||||
handleSelectedGroupChange,
|
|
||||||
}: DropdownProps) => {
|
|
||||||
const { courses, selectBasketNames } = useContext(coursesContext)!;
|
|
||||||
const basketNames = useMemo(() => selectBasketNames(), [selectBasketNames]);
|
|
||||||
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
|
||||||
|
|
||||||
const onCourseClick = (event: MouseEvent) => {
|
|
||||||
const target = event.currentTarget;
|
|
||||||
if (target.id && target.textContent) {
|
|
||||||
const course = filteredCourses.find(({ id }) => id.toString() === target.id)!;
|
|
||||||
|
|
||||||
handleSelectedGroupChange((course as unknown) as any);
|
|
||||||
handleCloseDropdown();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const filterCourses = (input: string) => {
|
|
||||||
const filteredCourses = courses.filter(
|
|
||||||
({ name }) =>
|
|
||||||
name
|
|
||||||
.toLowerCase()
|
|
||||||
.normalize('NFD')
|
|
||||||
.replace(/[\u0300-\u036f]/g, '')
|
|
||||||
.includes(
|
|
||||||
input
|
|
||||||
.toLowerCase()
|
|
||||||
.normalize('NFD')
|
|
||||||
.replace(/[\u0300-\u036f]/g, ''),
|
|
||||||
) && !basketNames.includes(name),
|
|
||||||
);
|
|
||||||
setFilteredCourses(filteredCourses);
|
|
||||||
};
|
|
||||||
filterCourses(input);
|
|
||||||
}, [basketNames, courses, input]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DropdownContainer>
|
|
||||||
{open && (
|
|
||||||
<>
|
|
||||||
{
|
|
||||||
<div>
|
|
||||||
{filteredCourses.map(({ name, id }, index) => (
|
|
||||||
<CourseContainer key={index} id={id.toString()} onClick={onCourseClick}>
|
|
||||||
<p>{name} </p>
|
|
||||||
</CourseContainer>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</DropdownContainer>
|
|
||||||
);
|
|
||||||
};
|
|
@ -3,7 +3,6 @@ import { CourseCard } from './CourseCard';
|
|||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
import { coursesContext } from '../contexts/CoursesProvider';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { debounce } from '../utils/index';
|
import { debounce } from '../utils/index';
|
||||||
import { SyncLoader } from 'react-spinners';
|
|
||||||
|
|
||||||
const RightbarWrapper = styled.div`
|
const RightbarWrapper = styled.div`
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
@ -38,22 +37,24 @@ const SaveButton = styled.div`
|
|||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
box-shadow: 0px 5px 4px 0px rgba(0, 0, 0, 0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background-color: #54c457;
|
background-color: #54c457;
|
||||||
}
|
}
|
||||||
|
|
||||||
box-shadow: 3px 3px 5px 0px rgba(189,189,189,1);
|
box-shadow: 3px 3px 3px 0px rgba(0, 0, 0, 0.75);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Rightbar = () => {
|
export const Rightbar = () => {
|
||||||
const { selectBasketCourses, saveBasket, userID, isSavingLoading } = useContext(coursesContext)!;
|
const { selectBasketCourses, saveBasket, userID } = useContext(coursesContext)!;
|
||||||
|
|
||||||
const basketCourses = selectBasketCourses();
|
const basketCourses = selectBasketCourses();
|
||||||
const handleSave = debounce(() => saveBasket(userID), 500);
|
const handleSave = debounce(() => saveBasket(userID), 500);
|
||||||
return (
|
return (
|
||||||
<RightbarWrapper>
|
<RightbarWrapper>
|
||||||
<SaveButton onClick={()=> {!isSavingLoading && handleSave() }}> {isSavingLoading ? <SyncLoader size={9}/> : "ZAPISZ"}</SaveButton>
|
<SaveButton onClick={handleSave}>ZAPISZ</SaveButton>
|
||||||
{basketCourses.map((course) => (
|
{basketCourses.map((course) => (
|
||||||
<CourseCard course={course} key={course.id} />
|
<CourseCard course={course} key={course.id} />
|
||||||
))}
|
))}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import React, { useContext, useLayoutEffect, useRef } from 'react';
|
import React, { useEffect, useLayoutEffect, useRef } from 'react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { SchedulerEvents } from './SchedulerEvents';
|
import { SchedulerEvents } from './SchedulerEvents';
|
||||||
import { days, hours } from '../constants/index';
|
import { days, hours } from '../constants/index';
|
||||||
import styled from 'styled-components/macro';
|
import styled from 'styled-components/macro';
|
||||||
import { SchedulerEvent } from '../types';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
|
||||||
|
|
||||||
const SchedulerWrapper = styled.div`
|
const SchedulerWrapper = styled.div`
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@ -19,7 +16,6 @@ const SchedulerWrapper = styled.div`
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.59);
|
box-shadow: 3px 3px 3px -2px rgba(0, 0, 0, 0.59);
|
||||||
position:relative;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TableBody = styled.div`
|
const TableBody = styled.div`
|
||||||
@ -65,36 +61,10 @@ const TableCell = styled.div<TableCellProps>`
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TourWrapper = styled.div`
|
export const Scheduler = () => {
|
||||||
display: flex;
|
|
||||||
justify-content:center;
|
|
||||||
align-items:center;
|
|
||||||
position:absolute;
|
|
||||||
top:8px;
|
|
||||||
right:8px;
|
|
||||||
min-width: 10px;
|
|
||||||
padding: 3px 7px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: black;
|
|
||||||
line-height: 1;
|
|
||||||
vertical-align: middle;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #FFDC61;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-size:18px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface SchedulerProps {
|
|
||||||
schedulerEvents: Array<SchedulerEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Scheduler = ({ schedulerEvents }: SchedulerProps) => {
|
|
||||||
const cellRef = useRef<HTMLDivElement>(null);
|
const cellRef = useRef<HTMLDivElement>(null);
|
||||||
const [cellWidth, setCellWidth] = useState(0);
|
const [cellWidth, setCellWidth] = useState(0);
|
||||||
const [cellHeight, setCellHeight] = useState(0);
|
const [cellHeight, setCellHeight] = useState(0);
|
||||||
const { tour } = useContext(coursesContext)!;
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const handleResize = () => {
|
const handleResize = () => {
|
||||||
@ -153,21 +123,8 @@ export const Scheduler = ({ schedulerEvents }: SchedulerProps) => {
|
|||||||
)}
|
)}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
<SchedulerEvents cellWidth={cellWidth} cellHeight={cellHeight} schedulerEvents={schedulerEvents} />
|
<SchedulerEvents cellWidth={cellWidth} cellHeight={cellHeight} />
|
||||||
</TableBody>
|
</TableBody>
|
||||||
<TourWrapper>
|
|
||||||
<Tooltip title="Pierwsza Tura Zapisów">
|
|
||||||
<div style={{cursor: 'help'}}>{tour === 'FIRST_TOUR' && '1'}</div>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip title="Druga Tura Zapisów">
|
|
||||||
<div style={{cursor: 'help'}}>{tour === 'SECOND_TOUR' && '2'}</div>
|
|
||||||
</Tooltip>
|
|
||||||
<Tooltip title="Zapisywanie wyłączone">
|
|
||||||
<div style={{cursor: 'help'}}>{tour === 'NO_TOUR' && 'X'}</div>
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
|
|
||||||
</TourWrapper>
|
|
||||||
</SchedulerWrapper>
|
</SchedulerWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -3,15 +3,15 @@ import { SchedulerRow } from './SchedulerRow';
|
|||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
import { coursesContext } from '../contexts/CoursesProvider';
|
||||||
import { selectGroupsToShow } from '../utils/index';
|
import { selectGroupsToShow } from '../utils/index';
|
||||||
import { ROWS_COUNT } from '../constants';
|
import { ROWS_COUNT } from '../constants';
|
||||||
import { SchedulerEvent } from '../types';
|
|
||||||
|
|
||||||
interface SchedulerEventsProps {
|
interface SchedulerEventsProps {
|
||||||
cellWidth: number;
|
cellWidth: number;
|
||||||
cellHeight: number;
|
cellHeight: number;
|
||||||
schedulerEvents: Array<SchedulerEvent>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SchedulerEvents = ({ cellWidth, cellHeight,schedulerEvents }: SchedulerEventsProps) => {
|
export const SchedulerEvents = ({ cellWidth, cellHeight }: SchedulerEventsProps) => {
|
||||||
|
const { selectSchedulerEvents } = useContext(coursesContext)!;
|
||||||
|
|
||||||
|
const schedulerEvents = selectSchedulerEvents();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
import React, { useContext, useEffect, useState } from 'react';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import { SchedulerEvent } from '../types';
|
|
||||||
import { Scheduler } from './Scheduler';
|
|
||||||
import { SchedulerHistoryNavigation } from './SchedulerHistoryNavigation';
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface SchedulerHistoryProps {
|
|
||||||
schedulerHistoryEvents: Array<SchedulerEvent>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const SchedulerHistory = ({schedulerHistoryEvents}:SchedulerHistoryProps) => {
|
|
||||||
const { timetableHistory, setHistoryBasketFromHistoryGroups } = useContext(coursesContext)!;
|
|
||||||
const [currentTimetable, setCurrentTimetable] = useState(timetableHistory.length===0 ? 0 : timetableHistory.length - 1);
|
|
||||||
let commisionDate = timetableHistory[currentTimetable]?.commisionDate;
|
|
||||||
|
|
||||||
const SubstractCurrentTimetable = (value: number) => {
|
|
||||||
if (currentTimetable > 0) {
|
|
||||||
setCurrentTimetable((currentTimetable) => currentTimetable + value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const AddCurrentTimetable = (value: number) => {
|
|
||||||
if (currentTimetable < timetableHistory.length - 1) {
|
|
||||||
setCurrentTimetable((currentTimetable) => currentTimetable + value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const timetable = timetableHistory[currentTimetable];
|
|
||||||
if (timetable) {
|
|
||||||
const { groups } = timetable;
|
|
||||||
setHistoryBasketFromHistoryGroups(groups);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setHistoryBasketFromHistoryGroups([]);
|
|
||||||
}
|
|
||||||
}, [currentTimetable,timetableHistory]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Wrapper>
|
|
||||||
{timetableHistory.length > 0 && (
|
|
||||||
<SchedulerHistoryNavigation commisionDate={commisionDate} SubstractCurrentTimetable={SubstractCurrentTimetable} AddCurrentTimetable={AddCurrentTimetable} />
|
|
||||||
)}
|
|
||||||
<Scheduler schedulerEvents={schedulerHistoryEvents}/>
|
|
||||||
</Wrapper>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,89 +0,0 @@
|
|||||||
import React, { useContext } from 'react';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import RightArrow from '../assets/right-arrow.svg';
|
|
||||||
import LeftArrow from '../assets/left-arrow.svg';
|
|
||||||
|
|
||||||
type ButtonProps = {
|
|
||||||
direction: 'left' | 'right';
|
|
||||||
};
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-top:-15px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StyledButton = styled.div<ButtonProps>`
|
|
||||||
cursor:pointer;
|
|
||||||
user-select: none;
|
|
||||||
margin:10px;
|
|
||||||
border-radius:5px;
|
|
||||||
border-radius: 15px;
|
|
||||||
background-color: #9ed3ff;
|
|
||||||
border: 2px solid white;
|
|
||||||
min-width: 45px;
|
|
||||||
color: black;
|
|
||||||
display:flex;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:center;
|
|
||||||
padding: 12px;
|
|
||||||
:hover{
|
|
||||||
background-color:#85c8ff;
|
|
||||||
}
|
|
||||||
transition: color 0.3s, background-color 0.3s;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StyledArrow = styled.img`
|
|
||||||
width:20px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
|
|
||||||
const StyledDate = styled.div`
|
|
||||||
user-select: none;
|
|
||||||
margin:10px;
|
|
||||||
border-radius:5px;
|
|
||||||
border-radius: 15px;
|
|
||||||
background-color: #FFDC61;
|
|
||||||
border: 2px solid white;
|
|
||||||
min-width: 45px;
|
|
||||||
text-align:center;
|
|
||||||
color: black;
|
|
||||||
padding: 10px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
type SchedulerHistoryNavigationProps = {
|
|
||||||
commisionDate?: Date;
|
|
||||||
SubstractCurrentTimetable: (value: number) => void;
|
|
||||||
AddCurrentTimetable: (value: number) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const SchedulerHistoryNavigation = ({
|
|
||||||
commisionDate,
|
|
||||||
SubstractCurrentTimetable,
|
|
||||||
AddCurrentTimetable,
|
|
||||||
}: SchedulerHistoryNavigationProps) => {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Wrapper>
|
|
||||||
<StyledButton
|
|
||||||
direction="left"
|
|
||||||
onClick={() => {
|
|
||||||
SubstractCurrentTimetable(-1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StyledArrow src={LeftArrow}></StyledArrow>
|
|
||||||
</StyledButton>
|
|
||||||
<StyledDate>{commisionDate}</StyledDate>
|
|
||||||
<StyledButton
|
|
||||||
direction="right"
|
|
||||||
onClick={() => {
|
|
||||||
AddCurrentTimetable(1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StyledArrow src={RightArrow}></StyledArrow>
|
|
||||||
</StyledButton>
|
|
||||||
</Wrapper>
|
|
||||||
);
|
|
||||||
};
|
|
@ -5,7 +5,6 @@ import Popover from '@material-ui/core/Popover';
|
|||||||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
|
||||||
import { MONDAY_TO_FRIDAY } from '../constants';
|
import { MONDAY_TO_FRIDAY } from '../constants';
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
import { coursesContext } from '../contexts/CoursesProvider';
|
||||||
import TickIcon from '../assets/tick.svg';
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@ -58,7 +57,7 @@ const StyledSchedulerEvent = styled.div<SchedulerEventProps>`
|
|||||||
z-index: 20000;
|
z-index: 20000;
|
||||||
font-size: 0.65vw;
|
font-size: 0.65vw;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
border-radius: 2px;
|
border-radius: 10px;
|
||||||
height: ${({ cellHeight }) => cellHeight * 3}px;
|
height: ${({ cellHeight }) => cellHeight * 3}px;
|
||||||
width: ${({ cellWidth }) => (cellWidth * 3) / 4}px;
|
width: ${({ cellWidth }) => (cellWidth * 3) / 4}px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
@ -77,9 +76,7 @@ const StyledSchedulerEvent = styled.div<SchedulerEventProps>`
|
|||||||
transition: background-color ease-in 0.4s;
|
transition: background-color ease-in 0.4s;
|
||||||
`}
|
`}
|
||||||
transition: background-color ease-out 0.4s;
|
transition: background-color ease-out 0.4s;
|
||||||
box-shadow: 3px 3px 5px 0px rgba(189,189,189,1);
|
box-shadow: 3px 3px 3px 0px rgba(0, 0, 0, 0.75);
|
||||||
|
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -128,13 +125,6 @@ interface SchedulerRowProps {
|
|||||||
cellHeight: number;
|
cellHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Icon = styled.img`
|
|
||||||
width: 15px;
|
|
||||||
position:absolute;
|
|
||||||
top:5px;
|
|
||||||
left:15px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const getGroupsPerDay = (groups: Array<SchedulerEvent>) => {
|
const getGroupsPerDay = (groups: Array<SchedulerEvent>) => {
|
||||||
const groupsPerDay: any = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0 };
|
const groupsPerDay: any = { 0: 0, 1: 0, 2: 0, 3: 0, 4: 0 };
|
||||||
for (const group of groups) {
|
for (const group of groups) {
|
||||||
@ -156,10 +146,14 @@ export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight }
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePopoverClose = (e: MouseEvent<any>) => {
|
const handlePopoverClose = (e: MouseEvent<any>) => {
|
||||||
|
console.log('current target:', e.currentTarget);
|
||||||
|
console.log(' target:', e.target);
|
||||||
setPopoverId(null);
|
setPopoverId(null);
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
|
console.log('click awayyy');
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('anchorEl: ', anchorEl);
|
||||||
}, [anchorEl]);
|
}, [anchorEl]);
|
||||||
const open = Boolean(anchorEl);
|
const open = Boolean(anchorEl);
|
||||||
const id = open ? 'simple-popover' : undefined;
|
const id = open ? 'simple-popover' : undefined;
|
||||||
@ -195,16 +189,13 @@ export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight }
|
|||||||
<BoldParagraph isThree={groupsPerDay[group.day] >= 3}>{groups[index].name}</BoldParagraph>
|
<BoldParagraph isThree={groupsPerDay[group.day] >= 3}>{groups[index].name}</BoldParagraph>
|
||||||
{groupsPerDay[group.day] < 3 ? (
|
{groupsPerDay[group.day] < 3 ? (
|
||||||
<TextWrapper>
|
<TextWrapper>
|
||||||
{groups[index].isAccepted===true && <Icon alt="transfer" src={TickIcon} />}
|
|
||||||
<div>{`${groups[index].time}-${groups[index].endTime}`}</div>
|
<div>{`${groups[index].time}-${groups[index].endTime}`}</div>
|
||||||
<div>
|
<div>
|
||||||
{groups[index].takenPlaces}/{groups[index].capacity}
|
{groups[index].takenPlaces}/{groups[index].capacity}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</TextWrapper>
|
</TextWrapper>
|
||||||
) : (
|
) : (
|
||||||
<TextWrapper style={{ flexDirection: 'column' }}>
|
<TextWrapper style={{ flexDirection: 'column' }}>
|
||||||
{groups[index].isAccepted===true && <Icon alt="transfer" src={TickIcon} />}
|
|
||||||
<div style={{ alignSelf: 'flex-end' }}>
|
<div style={{ alignSelf: 'flex-end' }}>
|
||||||
{groups[index].takenPlaces}/{groups[index].capacity}
|
{groups[index].takenPlaces}/{groups[index].capacity}
|
||||||
</div>
|
</div>
|
||||||
@ -240,15 +231,14 @@ export const SchedulerRow = ({ groups, indexRow, rowTop, cellWidth, cellHeight }
|
|||||||
<PopoverSpan>Sala zajęć</PopoverSpan>: {groups[index].room}
|
<PopoverSpan>Sala zajęć</PopoverSpan>: {groups[index].room}
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: '2px 0 2px 0' }}>
|
<p style={{ margin: '2px 0 2px 0' }}>
|
||||||
<PopoverSpan>Kod przedmiotu: </PopoverSpan> {groups[index].symbol}
|
<PopoverSpan>Kod przedmiotu: </PopoverSpan>ACB129
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: '2px 0 2px 0' }}>
|
<p style={{ margin: '2px 0 2px 0' }}>
|
||||||
<PopoverSpan>Numer grupy: </PopoverSpan> {groups[index].grNr}
|
<PopoverSpan>Kod grupy: </PopoverSpan>FVJ753
|
||||||
</p>
|
</p>
|
||||||
<p style={{ margin: '2px 0 2px 0', color:"green"}}>
|
<p style={{ margin: '2px 0 2px 0' }}>
|
||||||
<b>{groups[index].isAccepted===true && "Przedmiot został zaakceptowany"}</b>
|
<PopoverSpan>Punkty ECTS:</PopoverSpan> 2
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Popover>
|
</Popover>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
@ -24,7 +24,6 @@ const Wrapper = styled.div`
|
|||||||
border-top-left-radius: 6px;
|
border-top-left-radius: 6px;
|
||||||
border-bottom-left-radius: 6px;
|
border-bottom-left-radius: 6px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
z-index:100;
|
|
||||||
`;
|
`;
|
||||||
const Header = styled.div`
|
const Header = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -85,6 +84,7 @@ export const SelectMenu = ({changeSelectedOption,changeDropdownOpen, selectedOpt
|
|||||||
<Wrapper onClick={() => {changeDropdownOpen(false)}}>
|
<Wrapper onClick={() => {changeDropdownOpen(false)}}>
|
||||||
<Header
|
<Header
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
console.log('clicked');
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -1,170 +0,0 @@
|
|||||||
import React, { useState, useContext, useEffect } from 'react';
|
|
||||||
import Collapse from '@material-ui/core/Collapse';
|
|
||||||
import { ReactComponent as Expand } from '../assets/expand.svg';
|
|
||||||
import { Course, Group, GroupType } from '../types/index';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import styled, { css } from 'styled-components';
|
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
|
||||||
import DeleteIcon from '@material-ui/icons/Delete';
|
|
||||||
import { useMemo } from 'react';
|
|
||||||
import { dayMapping } from '../constants';
|
|
||||||
import { axiosInstance } from '../utils/axiosInstance';
|
|
||||||
import { SyncLoader } from 'react-spinners';
|
|
||||||
|
|
||||||
const StatisticsWrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Row = styled.div`
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StatisticBox = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
z-index: 20000;
|
|
||||||
font-size: 0.65vw;
|
|
||||||
line-height: normal;
|
|
||||||
border-radius: 2px;
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: 5px;
|
|
||||||
padding: 5px 5px 0 5px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #ffe485;
|
|
||||||
box-shadow: 3px 3px 5px 0px rgba(189, 189, 189, 1);
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StatisticNumber = styled.p`
|
|
||||||
font-size: 52px;
|
|
||||||
margin-top: 40px;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const StatisticText = styled.p`
|
|
||||||
font-size: 18px;
|
|
||||||
text-align: center;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const Statistics = () => {
|
|
||||||
const [createdGroupsNumber, setCreatedGroupsNumber] = useState('');
|
|
||||||
const [fullGroupsNumber, setFullGroupsNumber] = useState('');
|
|
||||||
const [registeredStudentsNumber, setRegisteredStudentsNumber] = useState('');
|
|
||||||
const [notRegisteredStudentsNumber, setNotRegisteredStudentsNumber] = useState('');
|
|
||||||
const [acceptedStudentsNumber, setAcceptedStudentsNumber] = useState('');
|
|
||||||
const [partlyAcceptedStudentsNumber, setPartlyAcceptedStudentsNumber] = useState('');
|
|
||||||
const [loaded, setLoaded] = useState(false);
|
|
||||||
|
|
||||||
const getCreatedGroupsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/created`);
|
|
||||||
setCreatedGroupsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getFullGroupsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/full`);
|
|
||||||
setFullGroupsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getRegisteredStudentsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/full`);
|
|
||||||
setRegisteredStudentsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getNotRegisteredStudentsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/full`);
|
|
||||||
setNotRegisteredStudentsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getAcceptedStudentsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/full`);
|
|
||||||
setAcceptedStudentsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getPartlyAcceptedStudentsNumber = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/statistics/groups/full`);
|
|
||||||
setPartlyAcceptedStudentsNumber(data.ammount);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
Promise.all([
|
|
||||||
getCreatedGroupsNumber(),
|
|
||||||
getFullGroupsNumber(),
|
|
||||||
getRegisteredStudentsNumber(),
|
|
||||||
getNotRegisteredStudentsNumber(),
|
|
||||||
getAcceptedStudentsNumber(),
|
|
||||||
getPartlyAcceptedStudentsNumber(),
|
|
||||||
]).then(()=>{setLoaded(true);});
|
|
||||||
|
|
||||||
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return <StatisticsWrapper>{loaded === false ? <SyncLoader />:<><Row>
|
|
||||||
<StatisticBox>
|
|
||||||
<StatisticNumber>{createdGroupsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Utworzonych grup</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
<StatisticBox>
|
|
||||||
{' '}
|
|
||||||
<StatisticNumber>{registeredStudentsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Zapisanych studentów do grup</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
<StatisticBox>
|
|
||||||
{' '}
|
|
||||||
<StatisticNumber>{notRegisteredStudentsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Studentów niezapisanych do żadnej grupy</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
</Row>
|
|
||||||
<Row>
|
|
||||||
<StatisticBox>
|
|
||||||
{' '}
|
|
||||||
<StatisticNumber>{acceptedStudentsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Studentów z zaakceptowanym planem</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
<StatisticBox>
|
|
||||||
{' '}
|
|
||||||
<StatisticNumber>{partlyAcceptedStudentsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Studentów bez zaakceptowanego pełengo planu</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
<StatisticBox>
|
|
||||||
{' '}
|
|
||||||
<StatisticNumber>{fullGroupsNumber}</StatisticNumber>
|
|
||||||
<StatisticText>Grup z zajętymi wszystkimi miejscami</StatisticText>
|
|
||||||
</StatisticBox>
|
|
||||||
</Row></>}
|
|
||||||
</StatisticsWrapper>;
|
|
||||||
};
|
|
@ -1,7 +1,6 @@
|
|||||||
import React, { useState, MouseEvent, ChangeEvent, useEffect, useCallback, useContext, useRef } from 'react';
|
import React, { useState, MouseEvent, ChangeEvent, useEffect, useCallback, useContext, useRef } from 'react';
|
||||||
import { ReactComponent as Close } from '../assets/close.svg';
|
import { ReactComponent as Close } from '../assets/close.svg';
|
||||||
import LogoutIcon from '../assets/logout.svg';
|
import ProfileIcon from '../assets/account.svg';
|
||||||
import TransferIcon from '../assets/transfer.svg';
|
|
||||||
import { Profile } from './Profile';
|
import { Profile } from './Profile';
|
||||||
import { Dropdown } from './Dropdown';
|
import { Dropdown } from './Dropdown';
|
||||||
import styled from 'styled-components/macro';
|
import styled from 'styled-components/macro';
|
||||||
@ -9,8 +8,7 @@ import ClickAwayListener from 'react-click-away-listener';
|
|||||||
import { SelectMenu } from './SelectMenu';
|
import { SelectMenu } from './SelectMenu';
|
||||||
import { studentsContext } from '../contexts/StudentsProvider';
|
import { studentsContext } from '../contexts/StudentsProvider';
|
||||||
import { CASContext } from '../contexts/CASProvider';
|
import { CASContext } from '../contexts/CASProvider';
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
import { render } from 'react-dom';
|
||||||
import LogoPlanNaPlan from '../assets/logo.svg';
|
|
||||||
|
|
||||||
const Topbar = styled.div`
|
const Topbar = styled.div`
|
||||||
background-color: #e3e5ed;
|
background-color: #e3e5ed;
|
||||||
@ -115,7 +113,7 @@ const IconWrapper = styled.div`
|
|||||||
|
|
||||||
const Icon = styled.img`
|
const Icon = styled.img`
|
||||||
width: 40px;
|
width: 40px;
|
||||||
margin-left: 40px;
|
margin: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@media only screen and (max-width: 670px) {
|
@media only screen and (max-width: 670px) {
|
||||||
width: 35px;
|
width: 35px;
|
||||||
@ -139,7 +137,6 @@ interface TopbarProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ({ handleTransfer }: TopbarProps) {
|
export default function ({ handleTransfer }: TopbarProps) {
|
||||||
const { logout } = useContext(CASContext)!;
|
|
||||||
const { selectedStudent } = useContext(studentsContext)!;
|
const { selectedStudent } = useContext(studentsContext)!;
|
||||||
const { role } = useContext(CASContext)!;
|
const { role } = useContext(CASContext)!;
|
||||||
const [clearInput, setClearInput] = useState(false);
|
const [clearInput, setClearInput] = useState(false);
|
||||||
@ -176,12 +173,10 @@ export default function ({ handleTransfer }: TopbarProps) {
|
|||||||
}
|
}
|
||||||
}, [clearInput, handleClearInput]);
|
}, [clearInput, handleClearInput]);
|
||||||
|
|
||||||
const userPrivilige = localStorage.getItem('userPrivilige');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Topbar>
|
<Topbar>
|
||||||
<LogoWrapper>
|
<LogoWrapper>
|
||||||
<Logo alt="logo" src={LogoPlanNaPlan} />
|
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
||||||
<Text> plan na plan </Text>
|
<Text> plan na plan </Text>
|
||||||
</LogoWrapper>
|
</LogoWrapper>
|
||||||
<FlexboxColumn>
|
<FlexboxColumn>
|
||||||
@ -215,19 +210,13 @@ export default function ({ handleTransfer }: TopbarProps) {
|
|||||||
</ClickAwayListener>
|
</ClickAwayListener>
|
||||||
</FlexboxColumn>
|
</FlexboxColumn>
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<SelectedStudent>{selectedStudent?.surname === '' ? selectedStudent?.email.replace(/@st.amu.edu.pl/, '') : selectedStudent?.surname}</SelectedStudent>
|
<SelectedStudent>{selectedStudent?.email.replace(/@st.amu.edu.pl/, '')}</SelectedStudent>
|
||||||
{/* <Text>Maciej Głowacki</Text> */}
|
|
||||||
{userPrivilige === 'STUDENT' && (
|
|
||||||
<Tooltip title="Wymiana grupami">
|
|
||||||
<Icon alt="transfer" src={TransferIcon} onClick={handleTransfer} />
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
{/* <Icon alt="change_language" src={isPolish ? EnglishIcon : PolishIcon} onClick={onLangChange} /> */}
|
|
||||||
<Tooltip title="Wyloguj">
|
|
||||||
<Icon alt="logout" src={LogoutIcon} onClick={logout} />
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
{/* <Profile anchorEl={anchorEl} handleClose={handleCloseProfile} /> */}
|
{/* <Text>Maciej Głowacki</Text> */}
|
||||||
|
{/* <Icon alt="transfer" src={Transfer} onClick={handleTransfer} /> */}
|
||||||
|
{/* <Icon alt="change_language" src={isPolish ? EnglishIcon : PolishIcon} onClick={onLangChange} /> */}
|
||||||
|
<Icon alt="profile" src={ProfileIcon} onClick={handleProfile} />
|
||||||
|
<Profile anchorEl={anchorEl} handleClose={handleCloseProfile} />
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
</Topbar>
|
</Topbar>
|
||||||
);
|
);
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
import React, { ChangeEvent, useContext, useEffect, MouseEvent, useState } from 'react';
|
import React from 'react';
|
||||||
import Modal from '@material-ui/core/Modal';
|
import Modal from '@material-ui/core/Modal';
|
||||||
import Fade from '@material-ui/core/Fade';
|
import Fade from '@material-ui/core/Fade';
|
||||||
|
import Input from '@material-ui/core/Input';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { FormControl, MenuItem, Select, useControlled, useEventCallback } from '@material-ui/core';
|
|
||||||
import { axiosInstance } from '../utils/axiosInstance';
|
|
||||||
import { Group } from '../types';
|
|
||||||
import { coursesContext } from '../contexts/CoursesProvider';
|
|
||||||
import { Dropdown } from './Dropdown';
|
|
||||||
import { DropdownModal } from './DropdownModal';
|
|
||||||
import { dayMapping } from '../constants';
|
|
||||||
import TransferIcon from '../assets/switch.svg';
|
|
||||||
import DeleteIcon from '@material-ui/icons/Delete';
|
|
||||||
import InformationIcon from '../assets/information.svg';
|
|
||||||
|
|
||||||
interface TransferProps {
|
interface TransferProps {
|
||||||
handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
||||||
isTransferOpen: boolean;
|
isOpen: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
@ -30,47 +21,35 @@ const useStyles = makeStyles({
|
|||||||
|
|
||||||
const TransferStyled = styled.div`
|
const TransferStyled = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
flex-direction: row;
|
||||||
align-items: center;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
min-width: 35%;
|
min-width: 35%;
|
||||||
height: 70%;
|
height: 70%;
|
||||||
background: white;
|
padding-top: 40px;
|
||||||
|
background: #006b96;
|
||||||
|
box-shadow: 0px 0px 0px 4px #006b96;
|
||||||
|
border: 4px solid #ffc400;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
border-radius: 5px;
|
border-top-left-radius: 5px;
|
||||||
`;
|
border-bottom-right-radius: 5px;
|
||||||
|
text-transform: uppercase;
|
||||||
const BinIcon = styled(DeleteIcon)`
|
letter-spacing: 0.3ch;
|
||||||
max-width: 30px;
|
|
||||||
min-width: 30px;
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover {
|
|
||||||
fill: white;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const InputWrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex: 1;
|
|
||||||
margin-top:40px;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TransferGiveStyled = styled.div`
|
const TransferGiveStyled = styled.div`
|
||||||
flex: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-transform: uppercase;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TransferReceiveStyled = styled.div`
|
const TransferReceiveStyled = styled.div`
|
||||||
flex: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-transform: uppercase;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TransferTextStyled = styled.div`
|
const TransferTextStyled = styled.div`
|
||||||
@ -89,323 +68,45 @@ const TransferInputStyled = styled.div`
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
text-transform: none;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const SaveWrapper = styled.div`
|
export const Transfer = ({ handleClose, isOpen }: TransferProps) => {
|
||||||
margin-top: 40px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const SaveButton = styled.div`
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
user-select: none;
|
|
||||||
background-color: #43a047;
|
|
||||||
border-radius: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
height: 40px;
|
|
||||||
width: 150px;
|
|
||||||
font-size: 12px;
|
|
||||||
letter-spacing: 0.1ch;
|
|
||||||
line-height: normal;
|
|
||||||
&:hover {
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
background-color: #54c457;
|
|
||||||
}
|
|
||||||
|
|
||||||
text-transform: uppercase;
|
|
||||||
box-shadow: 3px 3px 5px 0px rgba(189,189,189,1);
|
|
||||||
`;
|
|
||||||
|
|
||||||
const ExchangesWrapper = styled.div`
|
|
||||||
flex: 4;
|
|
||||||
overflow-y: scroll;
|
|
||||||
width: 100%;
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 5px;
|
|
||||||
border-style: none;
|
|
||||||
}
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
border-radius: 10px;
|
|
||||||
background-color: #4b4b4b;
|
|
||||||
}
|
|
||||||
border-top: 1px solid #b8b8b8;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const ExchangesRow = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Icon = styled.img`
|
|
||||||
width: 20px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Information = styled.img`
|
|
||||||
width: 35px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Exchange = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background-color: #b5d2e0;
|
|
||||||
border-radius: 2px;
|
|
||||||
width: 280px;
|
|
||||||
margin: 10px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0.5rem;
|
|
||||||
line-height:2;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const ExchangeTitle = styled.p`
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
margin:0;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const ExchangeParagraph = styled.p`
|
|
||||||
font-size: 13px;
|
|
||||||
color: #1a1a1a;
|
|
||||||
margin:0;
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const Transfer = ({ handleClose, isTransferOpen }: TransferProps) => {
|
|
||||||
const { basket, tour, selectBasketCourses } = useContext(coursesContext)!;
|
|
||||||
// const basketCourseGroups = useMemo(() => selectBasketCourseGroups(course.name), []);
|
|
||||||
const basketCourses = selectBasketCourses();
|
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
// const groups = selectGroups();
|
|
||||||
const [input, setInput] = useState('');
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
const [assignmentsClasses, setAssignmentsClasses] = useState<Array<any>>([]);
|
|
||||||
const [selectedAssignmentsClasses, setSelectedAssignmentsClasses] = useState<any>('');
|
|
||||||
const [selectedGroup, setSelectedGroup] = useState<any>('');
|
|
||||||
const [groups, setGroups] = useState<any>([]);
|
|
||||||
const [exchanges, setExchanges] = useState<any>(null);
|
|
||||||
const [save, setSave] = useState(false);
|
|
||||||
// const allGroups
|
|
||||||
const handleSelectedAssignmentsGroupChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
|
||||||
setSelectedAssignmentsClasses(event.target.value as any);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleGroupsChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
|
||||||
setSelectedGroup(event.target.value as any);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleChange = (event: ChangeEvent<HTMLInputElement>) => setInput(event.target.value);
|
|
||||||
const handleShowDropdown = () => setOpen(true);
|
|
||||||
|
|
||||||
const handleCloseDropdown = () => setOpen(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (selectedAssignmentsClasses) {
|
|
||||||
const allGroups = basketCourses.filter((el) => el.name === selectedAssignmentsClasses.name);
|
|
||||||
const allClasses = allGroups[0]?.classes;
|
|
||||||
if (allClasses) {
|
|
||||||
const filteredClasses = allClasses.filter((el: any) => {
|
|
||||||
return el.time !== selectedAssignmentsClasses.time;
|
|
||||||
});
|
|
||||||
setGroups(filteredClasses);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [selectedAssignmentsClasses]);
|
|
||||||
|
|
||||||
const getExchanges = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/all`);
|
|
||||||
setExchanges(data);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const getAssignmentsGroups = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/assignments`);
|
|
||||||
const classes = data.filter((el: any) => el.type === 'CLASS');
|
|
||||||
setAssignmentsClasses(classes);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
getExchanges();
|
|
||||||
getAssignmentsGroups();
|
|
||||||
}, [isTransferOpen, save]);
|
|
||||||
|
|
||||||
const createExchange = async (groupsIds: Array<number>) => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance.post(
|
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange`,
|
|
||||||
JSON.stringify({ assignment: groupsIds[0], group: groupsIds[1] }),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
setSelectedGroup('');
|
|
||||||
setSelectedAssignmentsClasses('');
|
|
||||||
setSave(!save);
|
|
||||||
};
|
|
||||||
|
|
||||||
const deleteExchange = async (id: number) => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance.delete(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/${id}`);
|
|
||||||
getExchanges();
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal
|
<Modal
|
||||||
className={classes.wrapper}
|
className={classes.wrapper}
|
||||||
open={isTransferOpen}
|
open={isOpen}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
aria-labelledby="simple-modal-title"
|
aria-labelledby="simple-modal-title"
|
||||||
aria-describedby="simple-modal-description"
|
aria-describedby="simple-modal-description"
|
||||||
>
|
>
|
||||||
<Fade in={isTransferOpen}>
|
<Fade in={isOpen}>
|
||||||
{tour === 'FIRST_TOUR' ? (
|
<TransferStyled>
|
||||||
<TransferStyled>
|
<TransferGiveStyled>
|
||||||
<Information src={InformationIcon}></Information>
|
<TransferTextStyled>Oddam</TransferTextStyled>
|
||||||
<p>Wymiana przedmiotami jest dostępna dopiero podczas drugiej tury</p>
|
<TransferInputStyled>
|
||||||
<p>Wymianie podlegają tylko zaakceptowane grupy przedmiotów</p>
|
{' '}
|
||||||
<p>Wymiana grupami odbywa się tylko w obrębie danego przedmiotu</p></TransferStyled>
|
<Input
|
||||||
) : (
|
placeholder="Wyszukaj..."
|
||||||
<TransferStyled>
|
inputProps={{ 'aria-label': 'description' }}
|
||||||
<InputWrapper>
|
className="top-bar__input-field"
|
||||||
<TransferGiveStyled>
|
/>
|
||||||
<TransferTextStyled>Oddam</TransferTextStyled>
|
</TransferInputStyled>
|
||||||
<TransferInputStyled>
|
</TransferGiveStyled>
|
||||||
<FormControl>
|
<TransferReceiveStyled>
|
||||||
<Select
|
<TransferTextStyled>Przyjmę</TransferTextStyled>
|
||||||
labelId="demo-simple-select-label"
|
<TransferInputStyled>
|
||||||
id="assignments-groups"
|
{' '}
|
||||||
value={selectedAssignmentsClasses}
|
<Input
|
||||||
onChange={handleSelectedAssignmentsGroupChange}
|
placeholder="Wyszukaj..."
|
||||||
placeholder="Wyszukaj..."
|
inputProps={{ 'aria-label': 'description' }}
|
||||||
style={{ width: '200px' }}
|
className="top-bar__input-field"
|
||||||
>
|
/>
|
||||||
{assignmentsClasses.map((el: any, index: number) => {
|
</TransferInputStyled>
|
||||||
return (
|
</TransferReceiveStyled>
|
||||||
<MenuItem
|
</TransferStyled>
|
||||||
key={index}
|
|
||||||
value={el}
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
textAlign: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{`${el.name} `}
|
|
||||||
<br></br>
|
|
||||||
{`(${dayMapping[el.day]} ${el.time} - ${el.endTime})`}
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
</TransferInputStyled>
|
|
||||||
</TransferGiveStyled>
|
|
||||||
<SaveWrapper>
|
|
||||||
{' '}
|
|
||||||
<SaveButton
|
|
||||||
onClick={() => {
|
|
||||||
createExchange([selectedAssignmentsClasses.id, selectedGroup.id]);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Zaproponuj wymianę
|
|
||||||
</SaveButton>
|
|
||||||
</SaveWrapper>
|
|
||||||
<TransferReceiveStyled>
|
|
||||||
<TransferTextStyled>Przyjmę</TransferTextStyled>
|
|
||||||
<TransferInputStyled>
|
|
||||||
<FormControl disabled={selectedAssignmentsClasses ? false : true}>
|
|
||||||
<Select
|
|
||||||
labelId="demo-simple-select-label"
|
|
||||||
id="assignments-groups"
|
|
||||||
value={selectedGroup}
|
|
||||||
onChange={handleGroupsChange}
|
|
||||||
placeholder="Wyszukaj..."
|
|
||||||
style={{ width: '200px' }}
|
|
||||||
>
|
|
||||||
{groups.map((el: any, index: number) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={index}
|
|
||||||
value={el}
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
textAlign: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{`${selectedAssignmentsClasses.name} `}
|
|
||||||
<br></br>
|
|
||||||
{`(${dayMapping[el.day]} ${el.time} - ${el.endTime})`}
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</Select>
|
|
||||||
</FormControl>
|
|
||||||
</TransferInputStyled>
|
|
||||||
</TransferReceiveStyled>
|
|
||||||
</InputWrapper>
|
|
||||||
<ExchangesWrapper>
|
|
||||||
{exchanges ? (
|
|
||||||
exchanges.map((name: any, index: number) => (
|
|
||||||
<ExchangesRow key={index}>
|
|
||||||
{' '}
|
|
||||||
<Exchange>
|
|
||||||
<ExchangeTitle>{name.courseName}</ExchangeTitle>
|
|
||||||
<ExchangeParagraph>{name.ownedAssignment.lecturer} </ExchangeParagraph>
|
|
||||||
<ExchangeParagraph> {dayMapping[name.ownedAssignment.day]} </ExchangeParagraph>
|
|
||||||
<ExchangeParagraph>
|
|
||||||
{name.ownedAssignment.time} - {name.ownedAssignment.endTime}
|
|
||||||
</ExchangeParagraph>
|
|
||||||
</Exchange>
|
|
||||||
<Icon alt="transfer" src={TransferIcon} />
|
|
||||||
<Exchange>
|
|
||||||
<ExchangeTitle>{name.courseName}</ExchangeTitle>
|
|
||||||
<ExchangeParagraph>{name.desiredGroup.lecturer} </ExchangeParagraph>
|
|
||||||
<ExchangeParagraph> {dayMapping[name.desiredGroup.day]} </ExchangeParagraph>
|
|
||||||
<ExchangeParagraph>
|
|
||||||
{name.desiredGroup.time} - {name.desiredGroup.endTime}
|
|
||||||
</ExchangeParagraph>
|
|
||||||
</Exchange>{' '}
|
|
||||||
<BinIcon
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
const id = Number(e.currentTarget.id);
|
|
||||||
deleteExchange(id);
|
|
||||||
}}
|
|
||||||
id={name.id}
|
|
||||||
></BinIcon>
|
|
||||||
</ExchangesRow>
|
|
||||||
))
|
|
||||||
) : (
|
|
||||||
<div></div>
|
|
||||||
)}
|
|
||||||
</ExchangesWrapper>
|
|
||||||
</TransferStyled>
|
|
||||||
)}
|
|
||||||
</Fade>
|
</Fade>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { cleanup, fireEvent, waitForElement, screen } from '@testing-library/react';
|
|
||||||
import '@testing-library/jest-dom/extend-expect';
|
|
||||||
import { customRender } from '../../customRender';
|
|
||||||
import Topbar from '../Topbar';
|
|
||||||
import { Statistics } from '../Statistics';
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
delete window.location;
|
|
||||||
window.location = { replace: jest.fn() };
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
window.location = location;
|
|
||||||
});
|
|
||||||
|
|
||||||
test('renders component', async () => {
|
|
||||||
customRender(<Statistics/>);
|
|
||||||
expect(screen.getByText(/Studentów bez zaakceptowanego pełengo planu/i)).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('renders component', async () => {
|
|
||||||
customRender(<Statistics/>);
|
|
||||||
expect(screen.getByText(/Zapisanych sutdentów do grup/i)).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
@ -22,10 +22,20 @@ test('input should display default placeholder for student', async () => {
|
|||||||
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
||||||
setTimeout(()=>{const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
setTimeout(()=>{const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
||||||
expect(input).toBeInTheDocument();},2000);
|
expect(input).toBeInTheDocument();},2000);
|
||||||
|
// fireEvent.change(input, { target: { value: '122' } });
|
||||||
|
// console.log(debug());
|
||||||
|
// const textNode = await waitForElement(() => getByText('asdasdsa'));
|
||||||
|
// console.log(debug());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('input should display changed value', async () => {
|
test('input should display changed value', async () => {
|
||||||
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
const { getByPlaceholderText, getByText, debug } = customRender(<Topbar handleTransfer={() => {}} />);
|
||||||
setTimeout(()=>{ const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
setTimeout(()=>{ const input = getByPlaceholderText('Wyszukaj przedmioty...');
|
||||||
fireEvent.change(input, { target: { value: '122' } });expect(input.value).toBe("122");},2000);
|
fireEvent.change(input, { target: { value: '122' } });expect(input.value).toBe("122");},2000);
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(debug());
|
||||||
|
// console.log(debug());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import React, { useState, useEffect, createContext, ReactNode } from 'react';
|
import React, { useState, useEffect, createContext, ReactNode } from 'react';
|
||||||
import { LoggedUser } from '../types';
|
import { LoggedUser } from '../types';
|
||||||
import { axiosInstance, getNewTokens } from '../utils/axiosInstance';
|
import { axiosInstance } from '../utils/axiosInstance';
|
||||||
|
|
||||||
|
|
||||||
export interface CASContext {
|
export interface CASContext {
|
||||||
user: LoggedUser | undefined;
|
user: LoggedUser | undefined;
|
||||||
@ -37,15 +36,13 @@ export const CASProvider = ({ children }: CASProviderProps) => {
|
|||||||
const { data: user } = await axiosInstance.get<LoggedUser & { token: string; refreshToken: string }>(
|
const { data: user } = await axiosInstance.get<LoggedUser & { token: string; refreshToken: string }>(
|
||||||
`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`,
|
`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`,
|
||||||
);
|
);
|
||||||
|
console.log('token response: ', user);
|
||||||
setUser({ authorityRole: user.authorityRole, email: user.email, id: user.id });
|
setUser({ authorityRole: user.authorityRole, email: user.email, id: user.id });
|
||||||
localStorage.setItem('userToken', user.token);
|
localStorage.setItem('userToken', user.token);
|
||||||
localStorage.setItem('userPrivilige', user.authorityRole);
|
localStorage.setItem('userPrivilige', user.authorityRole);
|
||||||
localStorage.setItem('refreshToken', user.refreshToken);
|
localStorage.setItem('refreshToken', user.refreshToken);
|
||||||
setIsFetchingToken(false);
|
setIsFetchingToken(false);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
getNewTokens();
|
|
||||||
}
|
|
||||||
const token = localStorage.getItem('userToken');
|
const token = localStorage.getItem('userToken');
|
||||||
const refreshToken = localStorage.getItem('refreshToken');
|
const refreshToken = localStorage.getItem('refreshToken');
|
||||||
const role = localStorage.getItem('userPrivilige');
|
const role = localStorage.getItem('userPrivilige');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, createContext, useEffect, ReactNode } from 'react';
|
import React, { useState, createContext, useEffect, ReactNode } from 'react';
|
||||||
import { Course, Group, Basket, GroupType, SchedulerEvent, TimetableHistory } from '../types';
|
import { Course, Group, Basket, GroupType, SchedulerEvent } from '../types';
|
||||||
import { useSnackbar } from 'notistack';
|
import { useSnackbar } from 'notistack';
|
||||||
import { axiosInstance } from '../utils/axiosInstance';
|
import { axiosInstance } from '../utils/axiosInstance';
|
||||||
import CloseIcon from '@material-ui/icons/Close';
|
import CloseIcon from '@material-ui/icons/Close';
|
||||||
@ -16,31 +16,22 @@ const StyledCloseIcon = styled(CloseIcon)`
|
|||||||
interface CourseContext {
|
interface CourseContext {
|
||||||
courses: Array<Course>;
|
courses: Array<Course>;
|
||||||
basket: Array<Basket>;
|
basket: Array<Basket>;
|
||||||
timetableHistory: Array<TimetableHistory>;
|
|
||||||
hoveredGroup: Group | undefined | null;
|
hoveredGroup: Group | undefined | null;
|
||||||
userID: string;
|
userID: string;
|
||||||
isDataLoading: boolean;
|
isDataLoading: boolean;
|
||||||
historyBasket: Array<Basket>;
|
|
||||||
tour: string;
|
|
||||||
isSavingLoading: boolean;
|
|
||||||
getCurrentTour: () => void;
|
|
||||||
addCourseToBasket: (courses: Course) => void;
|
addCourseToBasket: (courses: Course) => void;
|
||||||
changeHoveredGroup: (group: Group | null) => void;
|
changeHoveredGroup: (group: Group | null) => void;
|
||||||
changeGroupInBasket: (group: any, courseId: number) => void;
|
changeGroupInBasket: (group: Group, courseId: number) => void;
|
||||||
restoreGroupInBasket: (restoreGroup: Group, courseId: number) => void;
|
restoreGroupInBasket: (restoreGroup: Group, courseId: number) => void;
|
||||||
deleteFromBasket: (id: number) => void;
|
deleteFromBasket: (id: number) => void;
|
||||||
saveBasket: (userID: string) => Promise<void>;
|
saveBasket: (userID: string) => Promise<void>;
|
||||||
changeStudent: (studentId: string) => void;
|
changeStudent: (studentId: string) => void;
|
||||||
selectSchedulerEvents: () => Array<SchedulerEvent>;
|
selectSchedulerEvents: () => Array<SchedulerEvent>;
|
||||||
selectHistorySchedulerEvents: () => Array<SchedulerEvent>;
|
|
||||||
selectBasketNames: () => Array<string>;
|
selectBasketNames: () => Array<string>;
|
||||||
selectBasketCourses: () => Array<Course>;
|
selectBasketCourses: () => Array<Course>;
|
||||||
selectBasketCourseGroups: (courseName: string) => { lecture: Group | undefined; classes: Group | undefined };
|
selectBasketCourseGroups: (courseId: number) => { lecture: Group | undefined; classes: Group | undefined };
|
||||||
selectGroups: () => Array<Group>;
|
|
||||||
getNewestStudentTimetable: (studentId: string) => void;
|
getNewestStudentTimetable: (studentId: string) => void;
|
||||||
getStudentTimetablesHistory: (studentId: string) => void;
|
|
||||||
changeDataLoading: (isLoading: boolean) => void;
|
changeDataLoading: (isLoading: boolean) => void;
|
||||||
setHistoryBasketFromHistoryGroups: (groupsIds: Array<number>) => void;
|
|
||||||
}
|
}
|
||||||
export const coursesContext = createContext<CourseContext | undefined>(undefined);
|
export const coursesContext = createContext<CourseContext | undefined>(undefined);
|
||||||
|
|
||||||
@ -55,13 +46,9 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
//fetch courses with groups
|
//fetch courses with groups
|
||||||
const [courses, setCourses] = useState<Array<Course>>([]);
|
const [courses, setCourses] = useState<Array<Course>>([]);
|
||||||
const [basket, setBasket] = useState<Array<Basket>>([]);
|
const [basket, setBasket] = useState<Array<Basket>>([]);
|
||||||
const [historyBasket, setHistoryBasket] = useState<Array<Basket>>([]);
|
|
||||||
const [timetableHistory, setTimetableHistory] = useState<Array<TimetableHistory>>([]);
|
|
||||||
const [userID, setUserID] = useState('');
|
const [userID, setUserID] = useState('');
|
||||||
const [hoveredGroup, setHoveredGroup] = useState<Group | undefined | null>(null);
|
const [hoveredGroup, setHoveredGroup] = useState<Group | undefined | null>(null);
|
||||||
const [isDataLoading, setIsDataLoading] = useState(false);
|
const [isDataLoading, setIsDataLoading] = useState(false);
|
||||||
const [tour, setTour] = useState('');
|
|
||||||
const [isSavingLoading, setIsSavingLoading] = useState(false);
|
|
||||||
|
|
||||||
const selectBasketIds = () => {
|
const selectBasketIds = () => {
|
||||||
const classesIds = basket.map((course) => course?.classes?.id).filter((course) => course !== undefined);
|
const classesIds = basket.map((course) => course?.classes?.id).filter((course) => course !== undefined);
|
||||||
@ -81,32 +68,22 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
|
|
||||||
const selectSchedulerEvents = () => {
|
const selectSchedulerEvents = () => {
|
||||||
return basket.reduce((res, el) => {
|
return basket.reduce((res, el) => {
|
||||||
const { name, symbol } = el;
|
|
||||||
if (el.classes) {
|
|
||||||
res.push({ ...el.classes, name, symbol});
|
|
||||||
}
|
|
||||||
if (el.lecture) {
|
|
||||||
res.push({ ...el.lecture, name, symbol });
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}, [] as Array<SchedulerEvent>);
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectHistorySchedulerEvents = () => {
|
|
||||||
return historyBasket.reduce((res, el) => {
|
|
||||||
const { name } = el;
|
const { name } = el;
|
||||||
if (el.classes) {
|
if (el.classes) {
|
||||||
|
console.log('element kurwa is: ', el);
|
||||||
res.push({ ...el.classes, name });
|
res.push({ ...el.classes, name });
|
||||||
}
|
}
|
||||||
if (el.lecture) {
|
if (el.lecture) {
|
||||||
|
console.log('element kurwa is: ', el);
|
||||||
|
|
||||||
res.push({ ...el.lecture, name });
|
res.push({ ...el.lecture, name });
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}, [] as Array<SchedulerEvent>);
|
}, [] as Array<SchedulerEvent>);
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectBasketCourseGroups = (courseName: string) => {
|
const selectBasketCourseGroups = (courseId: number) => {
|
||||||
const course = basket.find(({ name }) => name === courseName);
|
const course = basket.find(({ id }) => id === courseId);
|
||||||
if (course !== undefined) {
|
if (course !== undefined) {
|
||||||
return { lecture: course.lecture, classes: course.classes };
|
return { lecture: course.lecture, classes: course.classes };
|
||||||
} else {
|
} else {
|
||||||
@ -114,11 +91,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectGroups = () => {
|
|
||||||
const groups = [];
|
|
||||||
return (courses as unknown) as Array<Group>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const changeHoveredGroup = (group: Group | null) => setHoveredGroup(group);
|
const changeHoveredGroup = (group: Group | null) => setHoveredGroup(group);
|
||||||
|
|
||||||
const changeDataLoading = (isLoading: boolean) => setIsDataLoading(isLoading);
|
const changeDataLoading = (isLoading: boolean) => setIsDataLoading(isLoading);
|
||||||
@ -127,7 +99,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
const courseToBasket: Basket = {
|
const courseToBasket: Basket = {
|
||||||
name: course.name,
|
name: course.name,
|
||||||
id: course.id,
|
id: course.id,
|
||||||
symbol: course.symbol,
|
|
||||||
classes: course.classes !== undefined ? course.classes[0] : undefined,
|
classes: course.classes !== undefined ? course.classes[0] : undefined,
|
||||||
lecture: course.lectures !== undefined ? course.lectures[0] : undefined,
|
lecture: course.lectures !== undefined ? course.lectures[0] : undefined,
|
||||||
};
|
};
|
||||||
@ -140,12 +111,10 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
setUserID(studentId);
|
setUserID(studentId);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getNewestStudentTimetable(studentId);
|
getNewestStudentTimetable(studentId);
|
||||||
getStudentTimetablesHistory(studentId);
|
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveBasket = async (userID: string) => {
|
const saveBasket = async (userID: string) => {
|
||||||
setIsSavingLoading(true);
|
|
||||||
const basketIds = selectBasketIds();
|
const basketIds = selectBasketIds();
|
||||||
const action = (key: any) => (
|
const action = (key: any) => (
|
||||||
<>
|
<>
|
||||||
@ -168,28 +137,26 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('error: ', e);
|
console.log('error: ', e);
|
||||||
enqueueSnackbar('Zapisywanie niemożliwe w czasie bezturowym', {
|
enqueueSnackbar('Zapisywanie planu nie powiodło się', {
|
||||||
variant: 'error',
|
variant: 'error',
|
||||||
action,
|
action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getStudentTimetablesHistory(userID);
|
|
||||||
setIsSavingLoading(false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeGroupInBasket = (choosenGroup: any, courseId: number) => {
|
const changeGroupInBasket = (choosenGroup: Group, courseId: number) => {
|
||||||
const basketCourse = basket.filter((course) => course.id === courseId)[0];
|
const basketCourse = basket.filter((course) => course.id === courseId)[0];
|
||||||
if (choosenGroup.lecture && choosenGroup.classes) {
|
const { type } = choosenGroup;
|
||||||
const prev = choosenGroup.prev === 'lecture' ? choosenGroup.lecture : choosenGroup.classes;
|
if (type === GroupType.CLASS) {
|
||||||
setBasket(
|
setBasket(
|
||||||
basket.map((basket) =>
|
basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, classes: choosenGroup } : basket)),
|
||||||
basket.id === basketCourse.id
|
);
|
||||||
? { ...basket, lecture: choosenGroup.lecture, classes: choosenGroup.classes }
|
} else if (type === GroupType.LECTURE) {
|
||||||
: basket,
|
setBasket(
|
||||||
),
|
basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, lecture: choosenGroup } : basket)),
|
||||||
);
|
);
|
||||||
changeHoveredGroup(prev);
|
|
||||||
}
|
}
|
||||||
|
changeHoveredGroup(choosenGroup);
|
||||||
};
|
};
|
||||||
|
|
||||||
const restoreGroupInBasket = (restoreGroup: Group, courseId: number) => {
|
const restoreGroupInBasket = (restoreGroup: Group, courseId: number) => {
|
||||||
@ -212,6 +179,8 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/schedule`,
|
`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/schedule`,
|
||||||
);
|
);
|
||||||
const basket = data === '' ? [] : data;
|
const basket = data === '' ? [] : data;
|
||||||
|
console.log('basket is: ', basket);
|
||||||
|
console.log('mordo weź');
|
||||||
setBasket(basket);
|
setBasket(basket);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@ -231,76 +200,30 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStudentTimetablesHistory = async (studentId: string) => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get<Array<TimetableHistory> | []>(
|
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/${studentId}?groups=true`,
|
|
||||||
);
|
|
||||||
setTimetableHistory(data);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchCourses = async () => {
|
const fetchCourses = async () => {
|
||||||
try {
|
try {
|
||||||
const { data: courses } = await axiosInstance.get<Array<Course>>(
|
const { data: courses } = await axiosInstance.get<Array<Course>>(
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/courses/all?groups=true&takenPlaces=true`,
|
`${process.env.REACT_APP_API_URL}/api/v1/courses/all?groups=true&takenPlaces=true`,
|
||||||
);
|
);
|
||||||
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('sortedCourses: ', sortedCourses);
|
||||||
setCourses(sortedCourses);
|
setCourses(sortedCourses);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setHistoryBasketFromHistoryGroups = (groupsIds: Array<number>) => {
|
|
||||||
const basket: Array<Basket> = [];
|
|
||||||
for (const groupId of groupsIds) {
|
|
||||||
for (const course of courses) {
|
|
||||||
const { lectures, classes, name, id } = course;
|
|
||||||
let basketElement: Basket = { name: name, id: id };
|
|
||||||
if (lectures) {
|
|
||||||
for (const lecture of lectures) {
|
|
||||||
if (groupId === lecture.id) {
|
|
||||||
basketElement = { ...basketElement, lecture: lecture };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (classes) {
|
|
||||||
for (const singleClass of classes) {
|
|
||||||
if (groupId === singleClass.id) {
|
|
||||||
basketElement = { ...basketElement, classes: singleClass };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (basketElement.classes !== undefined || basketElement.lecture !== undefined) {
|
|
||||||
basket.push(basketElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setHistoryBasket(basket);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCurrentTour = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/configurator/config/tour`);
|
|
||||||
setTour(data.currentTour);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsDataLoading(true);
|
setIsDataLoading(true);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getCurrentTour();
|
|
||||||
fetchCourses();
|
fetchCourses();
|
||||||
getNewestTimetable();
|
getNewestTimetable();
|
||||||
setIsDataLoading(false);
|
setIsDataLoading(false);
|
||||||
}, 600);
|
}, 600);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
console.log("123,",userID,courses,basket)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<coursesContext.Provider
|
<coursesContext.Provider
|
||||||
value={{
|
value={{
|
||||||
@ -308,12 +231,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
courses,
|
courses,
|
||||||
basket,
|
basket,
|
||||||
hoveredGroup,
|
hoveredGroup,
|
||||||
timetableHistory,
|
|
||||||
isDataLoading,
|
isDataLoading,
|
||||||
historyBasket,
|
|
||||||
tour,
|
|
||||||
isSavingLoading,
|
|
||||||
getCurrentTour,
|
|
||||||
addCourseToBasket,
|
addCourseToBasket,
|
||||||
changeHoveredGroup,
|
changeHoveredGroup,
|
||||||
changeGroupInBasket,
|
changeGroupInBasket,
|
||||||
@ -321,15 +239,11 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
restoreGroupInBasket,
|
restoreGroupInBasket,
|
||||||
saveBasket,
|
saveBasket,
|
||||||
selectSchedulerEvents,
|
selectSchedulerEvents,
|
||||||
selectHistorySchedulerEvents,
|
|
||||||
selectBasketNames,
|
selectBasketNames,
|
||||||
selectBasketCourses,
|
selectBasketCourses,
|
||||||
selectBasketCourseGroups,
|
selectBasketCourseGroups,
|
||||||
selectGroups,
|
|
||||||
getNewestStudentTimetable,
|
getNewestStudentTimetable,
|
||||||
changeStudent,
|
changeStudent,
|
||||||
getStudentTimetablesHistory,
|
|
||||||
setHistoryBasketFromHistoryGroups,
|
|
||||||
changeDataLoading,
|
changeDataLoading,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { useState, createContext, useEffect, ReactNode, useRef, useContext } from 'react';
|
import React, { useState, createContext, useEffect, ReactNode, useRef, useContext } from 'react';
|
||||||
import { Student } from '../types';
|
import { Student } from '../types';
|
||||||
import { axiosInstance } from '../utils/axiosInstance';
|
import { axiosInstance } from '../utils/axiosInstance';
|
||||||
|
import { CASContext } from './CASProvider';
|
||||||
|
|
||||||
interface StudentContext {
|
interface StudentContext {
|
||||||
students: Array<Student>;
|
students: Array<Student>;
|
||||||
@ -18,12 +19,15 @@ export const StudentsProvider = ({ children }: StudentsProviderProps) => {
|
|||||||
const [students, setStudents] = useState<Array<Student>>([]);
|
const [students, setStudents] = useState<Array<Student>>([]);
|
||||||
const [selectedStudent, setSelectedStudent] = useState<Student | null>(null);
|
const [selectedStudent, setSelectedStudent] = useState<Student | null>(null);
|
||||||
|
|
||||||
|
//not working currently
|
||||||
|
|
||||||
const getStudents = async () => {
|
const getStudents = async () => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance.get<Array<Student>>(
|
const { data } = await axiosInstance.get<Array<Student>>(
|
||||||
`${process.env.REACT_APP_API_URL}/api/v1/users/students`,
|
`${process.env.REACT_APP_API_URL}/api/v1/users/students`,
|
||||||
);
|
);
|
||||||
setStudents(data);
|
setStudents(data);
|
||||||
|
console.log(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
@ -36,6 +40,7 @@ export const StudentsProvider = ({ children }: StudentsProviderProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const userPrivilige = localStorage.getItem('userPrivilige');
|
const userPrivilige = localStorage.getItem('userPrivilige');
|
||||||
|
console.log('mordo privilidż: ', userPrivilige);
|
||||||
userPrivilige === 'DEANERY' && getStudents();
|
userPrivilige === 'DEANERY' && getStudents();
|
||||||
}, 500);
|
}, 500);
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -6,7 +6,6 @@ export enum GroupType {
|
|||||||
export interface Basket {
|
export interface Basket {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
symbol?:string;
|
|
||||||
lecture?: Group;
|
lecture?: Group;
|
||||||
classes?: Group;
|
classes?: Group;
|
||||||
}
|
}
|
||||||
@ -21,14 +20,11 @@ export interface Group {
|
|||||||
type: GroupType;
|
type: GroupType;
|
||||||
capacity?: number;
|
capacity?: number;
|
||||||
takenPlaces: number;
|
takenPlaces: number;
|
||||||
isAccepted:boolean;
|
|
||||||
grNr: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Course {
|
export interface Course {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
symbol:string;
|
|
||||||
lectures?: Array<Group>;
|
lectures?: Array<Group>;
|
||||||
classes?: Array<Group>;
|
classes?: Array<Group>;
|
||||||
}
|
}
|
||||||
@ -57,24 +53,4 @@ export interface SchedulerEvent {
|
|||||||
capacity?: number;
|
capacity?: number;
|
||||||
takenPlaces: number;
|
takenPlaces: number;
|
||||||
name: string;
|
name: string;
|
||||||
isAccepted:boolean;
|
|
||||||
grNr?: number;
|
|
||||||
symbol?:string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TimetableHistory {
|
|
||||||
commisionDate: Date;
|
|
||||||
commiter: {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
surname: string;
|
|
||||||
email: string;
|
|
||||||
};
|
|
||||||
groups: Array<number>;
|
|
||||||
owner: {
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
surname: string;
|
|
||||||
email: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,12 @@ import axios from 'axios';
|
|||||||
export const axiosInstance = axios.create();
|
export const axiosInstance = axios.create();
|
||||||
|
|
||||||
//getting new tokens
|
//getting new tokens
|
||||||
export const getNewTokens = async () => {
|
const getNewTokens = async () => {
|
||||||
try {
|
try {
|
||||||
const refreshToken = localStorage.getItem('refreshToken');
|
const refreshToken = localStorage.getItem('refreshToken');
|
||||||
const { data } = await axiosInstance.get(
|
const { data } = await axiosInstance.get(
|
||||||
`${process.env.REACT_APP_API_URL}/token/refresh?refreshToken=${refreshToken}`,
|
`${process.env.REACT_APP_API_URL}/token/refresh?refreshToken=${refreshToken}`,
|
||||||
);
|
);
|
||||||
localStorage.setItem('userPrivilige',data.authorityRole);
|
|
||||||
localStorage.setItem('userToken', data.token);
|
localStorage.setItem('userToken', data.token);
|
||||||
localStorage.setItem('refreshToken', data.refreshToken);
|
localStorage.setItem('refreshToken', data.refreshToken);
|
||||||
return data.token;
|
return data.token;
|
||||||
@ -38,6 +37,7 @@ axiosInstance.interceptors.response.use(
|
|||||||
},
|
},
|
||||||
async (error) => {
|
async (error) => {
|
||||||
const originalRequest = error.config;
|
const originalRequest = error.config;
|
||||||
|
console.log("original request is: ", originalRequest)
|
||||||
if (error.response.status === 403 && !originalRequest._retry) {
|
if (error.response.status === 403 && !originalRequest._retry) {
|
||||||
originalRequest._retry = true;
|
originalRequest._retry = true;
|
||||||
const access_token = await getNewTokens();
|
const access_token = await getNewTokens();
|
||||||
|
@ -4130,11 +4130,6 @@ data-urls@^1.0.0, data-urls@^1.1.0:
|
|||||||
whatwg-mimetype "^2.2.0"
|
whatwg-mimetype "^2.2.0"
|
||||||
whatwg-url "^7.0.0"
|
whatwg-url "^7.0.0"
|
||||||
|
|
||||||
date-fns@^2.16.1:
|
|
||||||
version "2.16.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.16.1.tgz#05775792c3f3331da812af253e1a935851d3834b"
|
|
||||||
integrity sha512-sAJVKx/FqrLYHAQeN7VpJrPhagZc9R4ImZIWYRFZaaohR3KzmuK88touwsSwSVT8Qcbd4zoDsnGfX4GFB4imyQ==
|
|
||||||
|
|
||||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
|
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
|
||||||
version "2.6.9"
|
version "2.6.9"
|
||||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||||
|