Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI fixes #100

Merged
merged 107 commits into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
86286be
feat: shift admin-panel to main portal
ayanchoudhary Mar 16, 2021
4faeef3
Merge pull request #82 from sdslabs/development
ayanchoudhary Mar 30, 2021
9b17184
added admin page and sidebar UI
Apr 25, 2021
244f897
link get requests of apis with sidebar
mhk19 Apr 25, 2021
c968865
fix route and add authorization header in apis
mhk19 Apr 25, 2021
47f7fb6
fix case when requests is empty
mhk19 Apr 25, 2021
742a16f
show tabs of user requests and uploads sorted by depts and courses
mhk19 Apr 25, 2021
c8b2fbb
added user requests table and icon buttons
Apr 25, 2021
15e1a90
Merge branch 'feat/admin-WIP' of github.com:sdslabs/studyportal-axion…
mhk19 Apr 25, 2021
945a064
feat: added reducers and constants for handling navigation
Apr 26, 2021
652e1fa
Merge branch 'admin-WIP' into feat/admin-WIP
Apr 26, 2021
5e08352
feat: linked data flow with reducers for side bar
Apr 26, 2021
86fdd42
feat: modified switch tab logic
Apr 26, 2021
691a6d5
feat: linked userRequests table from backend and added filetype-filte…
Apr 26, 2021
5a4838a
integrate delete request api with frontend
mhk19 Apr 28, 2021
d55858b
feat: add course table
May 28, 2021
f15777e
feat: add user uploads table
May 28, 2021
2e6d1b7
add support to upload file for filerequest
mhk19 May 29, 2021
9cdf959
Merge branch 'feat/admin-WIP' of github.com:sdslabs/studyportal-axion…
mhk19 May 29, 2021
622faf7
add support to approve and reject courserequest
mhk19 May 29, 2021
4ff691e
add support to approve and reject uploads
mhk19 May 29, 2021
b222c2b
fix: Notifications bug & UI of upload btn in useRequestTable
May 30, 2021
cae08a4
refactor: add dedicated click handlers and avoid duplicate API calls
May 30, 2021
d6d9897
[WIP]add support to download uploads
mhk19 May 31, 2021
e305ab6
Merge branch 'feat/admin-WIP' of github.com:sdslabs/studyportal-axion…
mhk19 May 31, 2021
07030b5
add support to preview uploads
mhk19 Jun 3, 2021
59c46c5
delete the admin folder since everything has been shifted to main folder
mhk19 Jun 3, 2021
fe36a0d
feat: shift admin-panel to main portal
ayanchoudhary Mar 16, 2021
e66b52e
added admin page and sidebar UI
Apr 25, 2021
86de2f4
link get requests of apis with sidebar
mhk19 Apr 25, 2021
93f1c18
fix route and add authorization header in apis
mhk19 Apr 25, 2021
92f5939
fix case when requests is empty
mhk19 Apr 25, 2021
06f7340
show tabs of user requests and uploads sorted by depts and courses
mhk19 Apr 25, 2021
eab37b7
added user requests table and icon buttons
Apr 25, 2021
34a1263
feat: added reducers and constants for handling navigation
Apr 26, 2021
e506b70
feat: linked data flow with reducers for side bar
Apr 26, 2021
b1f875b
feat: modified switch tab logic
Apr 26, 2021
2a19fe8
feat: linked userRequests table from backend and added filetype-filte…
Apr 26, 2021
7b8d3a2
integrate delete request api with frontend
mhk19 Apr 28, 2021
deaf83b
feat: add course table
May 28, 2021
0a773cd
feat: add user uploads table
May 28, 2021
3e47c85
add support to upload file for filerequest
mhk19 May 29, 2021
36df34f
add support to approve and reject courserequest
mhk19 May 29, 2021
caf5f11
add support to approve and reject uploads
mhk19 May 29, 2021
6406c6b
fix: Notifications bug & UI of upload btn in useRequestTable
May 30, 2021
750f5c3
refactor: add dedicated click handlers and avoid duplicate API calls
May 30, 2021
c6e9974
[WIP]add support to download uploads
mhk19 May 31, 2021
46c4ae2
add support to preview uploads
mhk19 Jun 3, 2021
c9c9877
delete the admin folder since everything has been shifted to main folder
mhk19 Jun 3, 2021
b19bd6c
wip use hooks in notification.js
mhk19 Jun 10, 2021
0fc6bdc
fix: moved notification state logic to redux
Jun 11, 2021
010f373
feat: added lottie animations for empty screens
Jun 11, 2021
be2cf36
make the filetype uniform
mhk19 Jun 13, 2021
523180d
Merge branch 'admin-WIP' of github.com:sdslabs/studyportal-axion into…
mhk19 Jun 13, 2021
a00ae0d
remove console log statements
mhk19 Jun 20, 2021
84a82bc
import nexus url from config
mhk19 Jun 20, 2021
9a841fe
refactor: split large files into smaller ones & used mixins
Jun 20, 2021
b5e335d
feat: added route based navigation
Jun 20, 2021
e2cd339
fix: security concerns with target='_blank'
Jul 4, 2021
a0fbdf6
refactor: added reset action for admin menu
Jul 4, 2021
aa4a873
feat: added error page for admin router
Jul 4, 2021
4cb3aa4
refactor: renamed admin routes
SaurabhS78 Jul 4, 2021
5f1e4f4
Merge pull request #87 from sdslabs/admin-WIP
mhk19 Jul 6, 2021
ab2a8b4
fixes #96
mhk19 Sep 1, 2021
eab8d3f
fix margin of downloads
mhk19 Sep 1, 2021
a5cbcdd
fixes #89
mhk19 Sep 1, 2021
8516ef1
fixes #90
mhk19 Sep 1, 2021
1939bff
fixes #99
mhk19 Sep 1, 2021
28c30ab
remove unused package dependency
mhk19 Sep 1, 2021
61dc3f4
Merge branch 'ui-fixes' of github.com:sdslabs/studyportal-axion into …
mhk19 Sep 1, 2021
fb12dee
preview the file instead of download on clicking the file name
mhk19 Sep 1, 2021
8e6d9d9
add proptypes in courseHandle
mhk19 Sep 1, 2021
78bb652
change account avatar. fixes #97
mhk19 Sep 1, 2021
009b9c0
fix lint
mhk19 Sep 1, 2021
805df47
reset all the forms after submission
mhk19 Sep 1, 2021
508435e
fix: wrong date ordinal issue
yashre-bh Sep 2, 2021
04cb1fb
feat: revamp notifications UI
SaurabhS78 Sep 2, 2021
212d668
update logo to dark variant
SaurabhS78 Sep 2, 2021
651c92b
fix: date ordinal issue
yashre-bh Sep 3, 2021
9e06293
fix: changes requested for date ordinal
yashre-bh Sep 3, 2021
7bce5fb
Merge pull request #104 from sdslabs/date-typo
mhk19 Sep 4, 2021
e98d140
integrate delete all notifications api and fix user id in user reducer
mhk19 Sep 6, 2021
60aa9a5
remove console.log statements
mhk19 Sep 6, 2021
8e872e0
prevent adding request for courses which already exist and allow requ…
mhk19 Sep 6, 2021
6df16f3
updated fonts
SaurabhS78 Sep 6, 2021
a73b4da
add search course api for dept sidebar
mhk19 Sep 6, 2021
6d2a00d
add search course api for mycourse
mhk19 Sep 6, 2021
ea7c2a6
added dynamic loaders for admin panel
SaurabhS78 Sep 6, 2021
3f59601
remove checkboxes. fixes #108
mhk19 Sep 7, 2021
c3180af
shorten the names and add tooltips wherever necessary
mhk19 Sep 7, 2021
416434c
increase length limit for course name in admin sidebar
mhk19 Sep 7, 2021
8539567
Merge pull request #109 from sdslabs/fonts-revamp
mhk19 Sep 7, 2021
d12e3b5
close upload and request modal on clicking 'check activity log' even …
mhk19 Sep 7, 2021
052d93b
add toggleuploadmodal in props of customfileuploader
mhk19 Sep 7, 2021
3a17cbf
shorten file name in activity card
mhk19 Sep 7, 2021
60e87ac
limit the size of table in user uploadtable of admin panel so that th…
mhk19 Sep 7, 2021
8541b07
Merge branch 'ui-fixes' into admin-loader
SaurabhS78 Sep 7, 2021
c986fed
Merge pull request #106 from sdslabs/feat/notifs-v2
ayanchoudhary Sep 7, 2021
93755c6
feat: add mini loaders and toasts
Sep 10, 2021
e337ea3
resolve merge conflicts
Sep 10, 2021
8cf6f4f
fix the number of requests sent on course page.. right now there are 2
mhk19 Sep 10, 2021
d3e86ab
Merge pull request #110 from sdslabs/admin-loader
ayanchoudhary Sep 10, 2021
9dc9934
fix: landing page heading in safari browsers
SaurabhS78 Sep 14, 2021
768f64a
ui: added unsupported screen banner for mobiles and tablets
SaurabhS78 Oct 5, 2021
855a181
Merge pull request #112 from sdslabs/fix/ui-safari
mhk19 Oct 6, 2021
682dde3
fix: minor css issues in mobileBanner
SaurabhS78 Oct 7, 2021
0b881ab
Merge pull request #113 from sdslabs/mobile-banner
mhk19 Oct 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[] generate download link from a utils function

[x] make no activity page
[x] changes in sidebar
[x] fonts and spacing changes
3,918 changes: 2,271 additions & 1,647 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"antd": "^4.13.1",
"axios": "^0.19.2",
"jquery": "^3.4.1",
Expand All @@ -17,10 +19,12 @@
"node-sass": "^4.13.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-lottie": "^1.2.3",
"react-redux": "^7.1.1",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.1",
"react-select": "^4.2.1",
"react-swipeable-views": "^0.13.9",
"react-toastify": "^7.0.3",
"redux": "^4.0.4",
"websocket": "^1.0.31"
Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import ErrorPage from 'pages/error';
import MyCourseRouter from 'routers/MyCourseRouter';
import ActivityRouter from 'routers/ActivityRouter';
import DepartmentRouter from 'routers/DepartmentRouter';
import AdminRouter from 'routers/AdminRouter';
import { Router, Switch, Route } from 'react-router-dom';
import { createBrowserHistory } from 'history';
import { getDepartmentsList } from 'api/departmentApi';
import { getUser } from 'utils/getUser';
import { ADD_DEPARTMENTS, RESET_APP } from './constants/action-types';
import { ADD_DEPARTMENTS, RESET_APP } from 'constants/action-types';
import AdminRouter from 'routers/AdminRouter';

function mapStateToProps(state) {
return {
Expand Down
37 changes: 37 additions & 0 deletions src/actions/adminPanelActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
SWITCH_SUB_MENU,
SWITCH_MAIN_MENU,
SWITCH_TAB,
SET_TABLE_DATA,
RESET_ADMIN_MENU,
TOGGLE_ADMIN_LOADER,
} from 'constants/action-types';

export const SwitchMainMenu = (data) => ({
type: SWITCH_MAIN_MENU,
payload: data,
});

export const SwitchSubMenu = (data) => ({
type: SWITCH_SUB_MENU,
payload: data,
});

export const SwitchTab = (data) => ({
type: SWITCH_TAB,
payload: data,
});

export const SetTableData = (data) => ({
type: SET_TABLE_DATA,
payload: data,
});

export const ResetAdminMenu = () => ({
type: RESET_ADMIN_MENU,
});

export const ToggleAdminLoader = (data) => ({
type: TOGGLE_ADMIN_LOADER,
payload: data,
});
81 changes: 81 additions & 0 deletions src/api/courseRequestApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { axiosInstance } from './axiosInstance';
import { CONFIG } from 'config/config';
import $ from 'jquery';

function getCourseRequests(token) {
return axiosInstance
.get('/admin/courserequests/', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function approveCourseRequest(id, token) {
return axiosInstance
.put(
'/admin/courserequests',
{ request: id, status: 2 },
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
)
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function addCourse(id, token) {
const status = 3;
return $.ajax({
method: 'PUT',
url: `${CONFIG.nexusRoot}/admin/courserequests`,
data: { request: id, status: status },
dataType: 'json',
beforeSend(xhr) {
xhr.setRequestHeader('Authorization', `Bearer ${token}`);
},
}).done((res) => {
return res;
});
}

function rejectCourseRequest(id, token) {
return axiosInstance
.delete('/admin/courserequests', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
data: {
request: id,
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

export { getCourseRequests, approveCourseRequest, addCourse, rejectCourseRequest };
87 changes: 87 additions & 0 deletions src/api/fileRequestApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { axiosInstance } from './axiosInstance';
import { CONFIG } from 'config/config';
import $ from 'jquery';

function getFileRequests(token) {
return axiosInstance
.get('/admin/filerequests/', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function approveFileRequest(id, token) {
return axiosInstance
.put(
'/admin/filerequests',
{ request: id, status: 2 },
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
)
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function uploadFile(id, file, name, filetype, token) {
const status = 3;
var formData = new FormData();
formData.append('request', id);
formData.append('file', file, name);
formData.append('name', name);
formData.append('filetype', filetype);
formData.append('status', status);
return $.ajax({
method: 'PUT',
url: `${CONFIG.nexusRoot}/admin/filerequests`,
data: formData,
processData: false,
contentType: false,
beforeSend(xhr) {
xhr.setRequestHeader('Authorization', `Bearer ${token}`);
},
}).done((res) => {
return res;
});
}

function rejectFileRequest(id, token) {
return axiosInstance
.delete('/admin/filerequests/', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
data: {
request: id,
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}
export { getFileRequests, approveFileRequest, uploadFile, rejectFileRequest };
15 changes: 13 additions & 2 deletions src/api/notificationApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@ function getNewNotification(token) {
}
function deleteNotification(notification) {
return axiosInstance
.delete('/notifications', { params: { notification } })
.delete('/notifications', { params: { notification: notification, userid: 'null' } })
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}
function deleteAllNotifications(userid) {
return axiosInstance
.delete('/notifications', { params: { notification: 'null', userid: userid } })
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
Expand All @@ -40,4 +51,4 @@ function deleteNotification(notification) {
});
}

export { getNewNotification, getAllNotifications, deleteNotification };
export { getNewNotification, getAllNotifications, deleteNotification, deleteAllNotifications };
14 changes: 13 additions & 1 deletion src/api/searchApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,16 @@ function getSearchResults(query) {
});
}

export { getSearchResults };
function getSearchCourseResults(query, dept, user) {
return axiosInstance
.get(`/filtercourse`, { params: { q: query, format: 'json', dept: dept, user: user } })
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

export { getSearchResults, getSearchCourseResults };
86 changes: 86 additions & 0 deletions src/api/uploadsApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { axiosInstance } from './axiosInstance';

function getUploads(token) {
return axiosInstance
.get('/admin/uploads/', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function approveUpload(id, token) {
return axiosInstance
.put(
'/admin/uploads',
{ file_id: id, status: 2 },
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
)
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function addUpload(id, token) {
return axiosInstance
.put(
'/admin/uploads',
{ upload: id, status: 3 },
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
},
)
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

function deleteUpload(id, token) {
return axiosInstance
.delete('/admin/uploads', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
data: {
upload: id,
},
})
.then((response) => {
const res = JSON.parse(response.request.response);
return res;
})
.catch((error) => {
return Promise.reject(error);
});
}

export { getUploads, approveUpload, addUpload, deleteUpload };
Loading