Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="با ما همراه شوید تا باهم کرونا را شکست دهیم. اپلیکیشن اطلاع رسانی و آمارگیری مردمی به همراه نقشه کشوری ابتلای کرونا"
/>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no, shrink-to-fit=no"
/>
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
Expand Down
35 changes: 23 additions & 12 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,50 @@ body {
}

body {
user-select: none;
outline: none;
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
-webkit-touch-callout: none;
scroll-snap-coordinate: 0 0;
scroll-snap-type: mandatory;
-webkit-overflow-scrolling: touch;
user-select: none;
overflow-x: hidden;
position: fixed !important;
overscroll-behavior-x: none !important;
top: 0;
bottom: 0;
left: 0;
right: 0;
text-rendering: optimizeLegibility;
-webkit-touch-callout: none;
}

#root {
/* position: relative;*/
/* touch-action: manipulation;*/
/* -webkit-touch-callout: none;*/
position: relative;
touch-action: manipulation;
-webkit-touch-callout: none;
}

html {
/* -webkit-tap-highlight-color: rgba(255, 255, 255, 0);*/
/* -webkit-tap-highlight-color: transparent;*/
/* height: 100vh;*/
/* overflow: hidden;*/
-webkit-tap-highlight-color: transparent;
height: 100vh;
width: 100vw;
overflow: hidden;
}

html,
body {
height: 100%;
}

body {
margin: 0;
}

*,
*:focus,
*:active {
outline: none;
outline: none !important;
}

.app-container {
Expand Down
1 change: 0 additions & 1 deletion src/components/AppHeader/HeaderStyle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
button {
border-color: transparent;
background-color: transparent;
outline: none;
padding: 0;
}
z-index: 10;
Expand Down
3 changes: 0 additions & 3 deletions src/components/Map/MapStyle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
align-items: start;

.map-button-wrapper {
button {
outline: none;
}
position: fixed;
z-index: 10;
display: flex;
Expand Down
39 changes: 38 additions & 1 deletion src/components/MyActivities/MyActivitiesActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const createHealthEvent = (data, history) => {
};
};

export const createQrEvent = (data, history) => {
export const createQrMeetEvent = (data, history) => {
return (dispatch, getState) => {
dispatch({ type: ActionTypes.ADD_MEETING_EVENT_REQUEST });

Expand Down Expand Up @@ -155,6 +155,43 @@ export const createQrEvent = (data, history) => {
};
};

export const createQrPlaceEvent = (data, history) => {
return (dispatch, getState) => {
dispatch({ type: ActionTypes.ADD_PLACE_EVENT_REQUEST });

let now = new Date();

createEventInBulk(
3,
data,
getState().MyActivities.user.people[0].id,
getState().MyActivities.token,
now
)
.then((response) => {
if (response.status === 201) {
dispatch({
type: ActionTypes.ADD_PLACE_EVENT_SUCCESS,
eventResult: response.data,
eventCounter: +getState().MyActivities.eventCounter + 1,
createTime: now,
});
dispatch(showNav());

history.push('/my-activities');
} else {
//TODO:باید پیاده سازی شود
throw response;
}
})
.catch(() => {
dispatch({
type: ActionTypes.ADD_PLACE_EVENT_FAILURE,
});
});
};
};

const createEventInBulk = (type, data, personId, token, now) => {
let year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now);
let month = new Intl.DateTimeFormat('en', { month: 'numeric' }).format(now);
Expand Down
31 changes: 31 additions & 0 deletions src/components/MyActivities/MyActivitiesReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const initialState = {
success: false,
error: false,
},
qrPlaceEvent: {
loading: false,
success: false,
error: false,
},
};

export function MyActivitiesReducer(state = initialState, action) {
Expand Down Expand Up @@ -124,6 +129,32 @@ export function MyActivitiesReducer(state = initialState, action) {
error: true,
},
};
case ActionTypes.ADD_PLACE_EVENT_REQUEST:
return {
...state,
qrPlaceEvent: {
...state.qrPlaceEvent,
loading: true,
},
};
case ActionTypes.ADD_PLACE_EVENT_SUCCESS:
return {
...state,
eventResult: action.eventResult,
eventCounter: action.eventCounter,
qrPlaceEvent: {
...state.qrPlaceEvent,
success: true,
},
};
case ActionTypes.ADD_PLACE_EVENT_FAILURE:
return {
...state,
qrPlaceEvent: {
...state.qrPlaceEvent,
error: true,
},
};
default:
return state;
}
Expand Down
1 change: 0 additions & 1 deletion src/components/MyActivities/MyActivitiesStyle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
float: left;
background-color: transparent;
border: none;
outline: none;
padding: 1rem 1rem 1rem 0;
}
}
16 changes: 14 additions & 2 deletions src/components/MyActivities/pages/QrCode/QrScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { KeyboardBackspace } from '@material-ui/icons';
import { useHistory } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { showNav } from '../../../../redux/actions/CommonActions';
import { createQrEvent } from '../../MyActivitiesActions';
import {
createQrMeetEvent,
createQrPlaceEvent,
} from '../../MyActivitiesActions';
import './QrCode.scss';
import logo from '../../../../logo-header.png';

Expand All @@ -17,7 +20,16 @@ export default function QrScanner() {
if (data) {
// It is assumed that QR code has always the form person:code
if (/^person:[a-z0-9]+$/i.test(data)) {
dispatch(createQrEvent({ id: data.split(':')[1] }, history));
dispatch(createQrMeetEvent({ id: data.split(':')[1] }, history));
} else {
// check if place
const place = data.split('\n');
const location = place.find((value) => value.includes('GEO'));
if (location) {
const latitude = location.split('GEO')[1].split(',')[0];
const longitude = location.split('GEO')[1].split(',')[1];
dispatch(createQrPlaceEvent({ latitude, longitude }, history));
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/redux/actions/ActionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ export const ADD_MEETING_EVENT_REQUEST = 'ADD_MEETING_EVENT_REQUEST';
export const ADD_MEETING_EVENT_SUCCESS = 'ADD_MEETING_EVENT_SUCCESS';
export const ADD_MEETING_EVENT_FAILURE = 'ADD_MEETING_EVENT_FAILURE';

export const ADD_PLACE_EVENT_REQUEST = 'ADD_PLACE_EVENT_REQUEST';
export const ADD_PLACE_EVENT_SUCCESS = 'ADD_PLACE_EVENT_SUCCESS';
export const ADD_PLACE_EVENT_FAILURE = 'ADD_PLACE_EVENT_FAILURE';
export const NEW_VERSION_AVAILABLE = 'NEW_VERSION_AVAILABLE';
24 changes: 24 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,11 @@
resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.5.tgz#38dfaacae8623b37cc0b0d27398e574e3fc28b1e"
integrity sha512-cpmwBRcHJmmZx0OGU7aPVwGWGbs4iKwVYchk9iuMtxNCA2zorwdaTz4GkLgs2WGxiRZRFKnV1k6tRUHX7tBMxg==

"@types/js-cookie@2.2.6":
version "2.2.6"
resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.6.tgz#f1a1cb35aff47bc5cfb05cb0c441ca91e914c26f"
integrity sha512-+oY0FDTO2GYKEV0YPvSshGq9t7YozVkgvXLty7zogQNuCxBhT9/3INX9Q7H1aRZ4SUDRXAKlJuA4EA5nTt7SNw==

"@types/json-schema@^7.0.3":
version "7.0.4"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
Expand Down Expand Up @@ -9985,6 +9990,25 @@ react-use@>=12.0.0:
ts-easing "^0.2.0"
tslib "^1.10.0"

react-use@^14.2.0:
version "14.2.0"
resolved "https://registry.yarnpkg.com/react-use/-/react-use-14.2.0.tgz#abac033fae5e358599b7e38084ff11b02e5d4868"
integrity sha512-vwC7jsBsiDENLrXGPqIH3W4mMS2j24h5jp4ol3jiiUQzZhCaG+ihumrShJxBI59hXso1pLHAePRQAg/fJjDcaQ==
dependencies:
"@types/js-cookie" "2.2.6"
"@xobotyi/scrollbar-width" "1.9.5"
copy-to-clipboard "^3.2.0"
fast-deep-equal "^3.1.1"
fast-shallow-equal "^1.0.0"
js-cookie "^2.2.1"
nano-css "^5.2.1"
resize-observer-polyfill "^1.5.1"
screenfull "^5.0.0"
set-harmonic-interval "^1.0.1"
throttle-debounce "^2.1.0"
ts-easing "^0.2.0"
tslib "^1.10.0"

react@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
Expand Down