Skip to content

Commit 489eef1

Browse files
vaibhavdarenAuraOfDivinitynisarg1499Rupeshiya
authored
Bugs UI (#559)
* Implements markdown and priview functionality * Parsing content within comment * Comment notifications (#501) * Initial * Addition of comments section * requested changes * Changes for Jitsi UI (#518) * css changes for jitsi box ui change * edited jitsi.scss for jitsi ui and reverted changes of comment.scss * changes made for making same fonts * added modals in jitsi ui * removed unnecessary code from jitsi.scss * fixing dev branch issues (#525) * implemented user activity and fix inconsistencies (#527) * Settings integrate and deploy configuration (#530) * integrated settings page and user activity modification * configure to deploy * Insights (#529) * Adding reactGA * Insights section * removing /hompage path * Requested changes * initial changes * Fetching data from the backend and integrating redux * Fixing modal issues (#531) * social links fix (#545) * fix issues (#555) * Fixing proposal functionality issues (#553) Co-authored-by: Asel <peirisasel373@gmail.com> Co-authored-by: Nisarg Shah <nisshah1499@gmail.com> Co-authored-by: Rupesh Krishna Jha <rupeshiya@gmail.com>
1 parent f2b9369 commit 489eef1

File tree

114 files changed

+4930
-1095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4930
-1095
lines changed

.env.development

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#.env.development
2+
REACT_APP_API_ENDPOINT = "http://localhost:5000"

.env.production

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#.env.production
2+
REACT_APP_API_ENDPOINT = "https://codeuino-donut-development.herokuapp.com"

.env.staging

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# NODE_ENV will always be set to "production" for a build
2+
# more details at https://create-react-app.dev/docs/deployment/#customizing-environment-variables-for-arbitrary-build-environments
3+
4+
REACT_APP_CUSTOM_NODE_ENV = "staging"
5+
REACT_APP_API_ENDPOINT = "https://codeuino-donut-development.herokuapp.com"

package-lock.json

Lines changed: 974 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,32 @@
1111
"@testing-library/react": "^9.4.0",
1212
"@testing-library/user-event": "^7.2.1",
1313
"@tinymce/tinymce-react": "^3.6.0",
14+
"antd": "^4.4.2",
1415
"axios": "^0.19.1",
1516
"boostrap": "^2.0.0",
17+
"chart.js": "^2.9.3",
18+
"dotenv": "^8.2.0",
19+
"env-cmd": "^10.1.0",
1620
"html-react-parser": "^0.13.0",
21+
"http-proxy-middleware": "^1.0.5",
1722
"jwt-decode": "^2.2.0",
1823
"markdown-it": "^11.0.0",
24+
"moment": "^2.27.0",
1925
"node-sass": "^4.13.0",
2026
"react": "^16.12.0",
2127
"react-bootstrap": "^1.0.0-beta.16",
28+
"react-chartjs-2": "^2.9.0",
2229
"react-content-loader": "^5.0.4",
2330
"react-cookies": "^0.1.1",
31+
"react-datepicker": "^3.1.3",
2432
"react-dom": "^16.12.0",
2533
"react-dropzone": "^11.0.1",
34+
"react-ga": "^3.1.2",
2635
"react-icons": "^3.10.0",
2736
"react-images": "^1.1.7",
2837
"react-lottie": "^1.2.3",
2938
"react-markdown-editor-lite": "^1.1.4",
39+
"react-moment": "^0.9.7",
3040
"react-redux": "^7.2.0",
3141
"react-responsive": "^8.0.3",
3242
"react-router-dom": "^5.1.2",
@@ -36,12 +46,14 @@
3646
"react-toastify": "^6.0.5",
3747
"redux": "^4.0.5",
3848
"redux-thunk": "^2.3.0",
39-
"socket.io-client": "^2.3.0"
49+
"showdown": "^1.9.1",
50+
"socket.io-client": "^2.3.0",
51+
"styled-components": "^5.1.1"
4052
},
41-
"proxy": "http://localhost:5000",
4253
"scripts": {
4354
"start": "react-scripts start",
4455
"build": "CI=false && react-scripts build && ./build.sh",
56+
"build:staging": "env-cmd -f .env.staging react-scripts build && ./build.sh",
4557
"test": "react-scripts test",
4658
"eject": "react-scripts eject"
4759
},

public/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
content="Web site created using create-react-app"
1111
/>
1212
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13-
<link href="https://fonts.googleapis.com/css?family=Playfair+Display&display=swap" rel="stylesheet">
13+
<link
14+
href="https://fonts.googleapis.com/css?family=Playfair+Display&display=swap"
15+
rel="stylesheet"
16+
/>
1417
<!--
1518
manifest.json provides metadata used when your web app is installed on a
1619
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1720
-->
1821
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
22+
<script src="https://apis.google.com/js/client:platform.js"></script>
1923
<!--
2024
Notice the use of %PUBLIC_URL% in the tags above.
2125
It will be replaced with the URL of the `public` folder during the build.
@@ -29,7 +33,7 @@
2933
</head>
3034
<body>
3135
<noscript>You need to enable JavaScript to run this app.</noscript>
32-
<script src='https://meet.jit.si/external_api.js'></script>
36+
<script src="https://meet.jit.si/external_api.js"></script>
3337
<div id="root"></div>
3438
<!--
3539
This HTML file is a template.

src/App.js

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
import React, { Component } from "react";
1+
import React, { Component, useEffect } from "react";
22
import Router from "./router";
33
import "./App.css";
4-
54
import { Provider } from "react-redux";
65
import store from "./store";
76
import jwt_decode from "jwt-decode";
87
import { setAuthToken } from "./utils/setAuthToken";
98
import { setCurrentUser, logoutUser } from "./actions/authAction";
109
import "./css/main.scss";
10+
import ReactGA from "react-ga";
1111

12-
class App extends Component {
13-
componentDidMount() {
14-
// check if user already loggedIn
15-
const token = JSON.parse(localStorage.getItem("jwtToken"));
16-
console.log("CHECKING TOKEN ", token);
17-
if (token) {
18-
const decodedData = jwt_decode(token);
19-
// set auth token in axios header
20-
setAuthToken(token);
21-
// set user in the state
22-
setCurrentUser(decodedData);
23-
// check if token is valid or expired
24-
const currentTime = Date.now() / 1000; // in ms
25-
const expiryTime = decodedData.iat + 10800000; // 24 hrs
26-
if (expiryTime <= currentTime) {
27-
store.dispatch(logoutUser());
28-
// now redirect to home page
29-
window.location.href = "/";
30-
}
31-
}
32-
}
33-
render() {
34-
return (
35-
<Provider store={store}>
36-
<React.Fragment>
37-
<link
38-
rel="stylesheet"
39-
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
40-
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
41-
crossOrigin="anonymous"
42-
/>
43-
<Router />
44-
</React.Fragment>
45-
</Provider>
46-
);
12+
// check if user already loggedIn
13+
const token = localStorage.getItem("jwtToken");
14+
console.log("CHECKING TOKEN ", token);
15+
if (token) {
16+
const decodedData = jwt_decode(token);
17+
// set auth token in axios header
18+
setAuthToken(token);
19+
// set user in the state
20+
setCurrentUser(decodedData);
21+
// check if token is valid or expired
22+
const currentTime = Date.now() / 1000; // in ms
23+
const expiryTime = decodedData.iat + 10800000; // 24 hrs
24+
if (expiryTime <= currentTime) {
25+
store.dispatch(logoutUser());
26+
window.location.href = "/";
4727
}
4828
}
49-
document.title = "Donut";
5029

30+
function App() {
31+
useEffect(() => {
32+
ReactGA.initialize("UA-173245995-1");
33+
});
34+
return (
35+
<Provider store={store}>
36+
<React.Fragment>
37+
<link
38+
rel="stylesheet"
39+
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
40+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
41+
crossOrigin="anonymous"
42+
/>
43+
<Router />
44+
</React.Fragment>
45+
</Provider>
46+
);
47+
}
48+
49+
document.title = "Donut";
5150
export default App;

src/actions/adminAction.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { SET_ADMIN, GET_ADMIN } from './types'
55
import { setAuthToken } from '../utils/setAuthToken'
66
import jwt_decode from 'jwt-decode';
77
import { setCurrentUser } from './authAction'
8+
import { BASE_URL } from './baseApi'
89

910

1011
export const createAdmin = (adminInfo) => async (dispatch) => {
1112
try {
12-
const res = await axios.post('/user/', adminInfo)
13+
const res = await axios.post(`${BASE_URL}/user/`, adminInfo)
1314
setRequestStatus(false)
1415
if (res.status === 201) {
1516
setRequestStatus(true)
@@ -25,14 +26,14 @@ export const createAdmin = (adminInfo) => async (dispatch) => {
2526

2627
export const loginAdmin = (adminInfo, history) => async (dispatch) => {
2728
try {
28-
const res = await axios.post('/auth/login/', adminInfo)
29+
const res = await axios.post(`${BASE_URL}/auth/login/`, adminInfo)
2930
dispatch(setRequestStatus(false));
3031
if (res.status === 200) {
3132

3233
const token = res.data.token;
3334
dispatch(setRequestStatus(true));
3435

35-
localStorage.setItem("jwtToken", JSON.stringify(token));
36+
localStorage.setItem("jwtToken", (token));
3637
setAuthToken(token);
3738

3839
// update state with user

src/actions/analyticsAction.js

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import axios from "axios";
2+
import { errorHandler } from "../utils/errorHandler";
3+
import { setRequestStatus } from "../utils/setRequestStatus";
4+
import {
5+
GET_BROWSER_ANALYTICS,
6+
GET_COUNTRY_ANALYTICS,
7+
GET_DEVICE_ANALYTICS,
8+
GET_MOSTVIEWED_ANALYTICS,
9+
GET_PROPOSALVIEW_ANALYTICS
10+
} from "../actions/types";
11+
import moment from "moment";
12+
13+
// GET BROWSER ANALYTICS
14+
export const getBrowserAnalytics = (
15+
startingDate,
16+
endingDate,
17+
proposalId
18+
) => async (dispatch) => {
19+
try {
20+
let data = {
21+
startDate: moment(startingDate).format("YYYY-MM-DD"),
22+
endDate: moment(endingDate).format("YYYY-MM-DD"),
23+
proposalId: proposalId,
24+
};
25+
const res = await axios.post("/analytics/browser", data);
26+
dispatch(setRequestStatus(false));
27+
if (res.status === 200) {
28+
dispatch(setRequestStatus(true));
29+
dispatch({
30+
type: GET_BROWSER_ANALYTICS,
31+
payload: res.data.analytics || res.data.msg,
32+
});
33+
}
34+
} catch (error) {
35+
dispatch(errorHandler(error));
36+
}
37+
};
38+
39+
// GET MOSTVIEWED ANALYTICS
40+
export const getMostViewedAnalytics = (startingDate, endingDate) => async (
41+
dispatch
42+
) => {
43+
try {
44+
let data = {
45+
startDate: moment(startingDate).format("YYYY-MM-DD"),
46+
endDate: moment(endingDate).format("YYYY-MM-DD"),
47+
};
48+
const res = await axios.post("/analytics/mostviewed", data);
49+
dispatch(setRequestStatus(false));
50+
if (res.status === 200) {
51+
dispatch(setRequestStatus(true));
52+
dispatch({
53+
type: GET_MOSTVIEWED_ANALYTICS,
54+
payload: res.data.analytics || res.data.msg,
55+
});
56+
}
57+
} catch (error) {
58+
dispatch(errorHandler(error));
59+
}
60+
};
61+
62+
// GET PROPOSAL VIEW ANALYTICS
63+
export const getProposalviewAnalytics = (
64+
startingDate,
65+
endingDate,
66+
proposalId
67+
) => async (dispatch) => {
68+
try {
69+
let data = {
70+
startDate: moment(startingDate).format("YYYY-MM-DD"),
71+
endDate: moment(endingDate).format("YYYY-MM-DD"),
72+
proposalId: proposalId,
73+
};
74+
const res = await axios.post("/analytics/views", data);
75+
dispatch(setRequestStatus(false));
76+
if (res.status === 200) {
77+
dispatch(setRequestStatus(true));
78+
console.log(res.data.analytics)
79+
dispatch({
80+
type: GET_PROPOSALVIEW_ANALYTICS,
81+
payload: res.data.analytics || res.data.msg,
82+
});
83+
}
84+
} catch (error) {
85+
dispatch(errorHandler(error));
86+
}
87+
};
88+
89+
// GET COUNTRIES ANALYTICS
90+
export const getCountryAnalytics = (
91+
startingDate,
92+
endingDate,
93+
proposalId
94+
) => async (dispatch) => {
95+
try {
96+
let data = {
97+
startDate: moment(startingDate).format("YYYY-MM-DD"),
98+
endDate: moment(endingDate).format("YYYY-MM-DD"),
99+
proposalId: proposalId,
100+
};
101+
const res = await axios.post("/analytics/countries", data);
102+
dispatch(setRequestStatus(false));
103+
if (res.status === 200) {
104+
dispatch(setRequestStatus(true));
105+
dispatch({
106+
type: GET_COUNTRY_ANALYTICS,
107+
payload: res.data.analytics || res.data.msg,
108+
});
109+
}
110+
} catch (error) {
111+
dispatch(errorHandler(error));
112+
}
113+
};
114+
115+
// GET DEVICE ANALYTICS
116+
export const getDeviceAnalytics = (
117+
startingDate,
118+
endingDate,
119+
proposalId
120+
) => async (dispatch) => {
121+
try {
122+
let data = {
123+
startDate: moment(startingDate).format("YYYY-MM-DD"),
124+
endDate: moment(endingDate).format("YYYY-MM-DD"),
125+
proposalId: proposalId,
126+
};
127+
const res = await axios.post("/analytics/device", data);
128+
dispatch(setRequestStatus(false));
129+
if (res.status === 200) {
130+
dispatch(setRequestStatus(true));
131+
dispatch({
132+
type: GET_DEVICE_ANALYTICS,
133+
payload: res.data.analytics || res.data.msg,
134+
});
135+
}
136+
} catch (error) {
137+
dispatch(errorHandler(error));
138+
}
139+
};

0 commit comments

Comments
 (0)