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

Leon and Oleksandr add interactive map #1503

Merged
merged 108 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
7f3f60a
Add team locations item to Reports dropdown
leonzh2k Jun 30, 2023
4905c6a
add TeamLocations as protected route
leonzh2k Jul 2, 2023
7a81a22
Merge branch 'development' into leon_add_interactive_map
leonzh2k Jul 6, 2023
b525b84
add logic to fetch all user profile data
leonzh2k Jul 6, 2023
c296d5b
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
423bcdf
add logic to display example map
leonzh2k Jul 7, 2023
2366e5d
remove "back to top" button on component render
leonzh2k Jul 13, 2023
f650b64
add reasonable map options
leonzh2k Jul 13, 2023
7b15efb
display markers corresponding to each user
leonzh2k Jul 13, 2023
42d7a58
Make markers appear at user's actual location
leonzh2k Jul 15, 2023
a5f4989
add marker clustering functionality
leonzh2k Jul 15, 2023
9505d38
implement latlng caching functionality
leonzh2k Jul 15, 2023
2a3e63b
Merge branch 'development' into leon_add_interactive_map
leonzh2k Jul 20, 2023
bd6bf5c
Fix map blocking navbar dropdowns
leonzh2k Jul 20, 2023
5a4675f
fix incorrect method call
leonzh2k Jul 20, 2023
31b395a
refactor logic to be more readable
leonzh2k Jul 20, 2023
c3a4939
remove unneeded code used by infeasible approach
leonzh2k Jul 22, 2023
0124862
Dynamically color markers based on active status
leonzh2k Jul 24, 2023
e1ceb97
Add UI box showing number of unique countries
leonzh2k Jul 24, 2023
be5d43e
refactor marker rendering logic to be cleaner
leonzh2k Jul 25, 2023
1b354ba
Change user provided location variable name
leonzh2k Jul 25, 2023
e0d07c5
add TeamLocations as protected route
leonzh2k Jul 2, 2023
64112ec
add logic to fetch all user profile data
leonzh2k Jul 6, 2023
4ce6715
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
b47ac62
add logic to display example map
leonzh2k Jul 7, 2023
58ae369
remove "back to top" button on component render
leonzh2k Jul 13, 2023
eece63f
add reasonable map options
leonzh2k Jul 13, 2023
d9fac88
display markers corresponding to each user
leonzh2k Jul 13, 2023
db82e1a
Make markers appear at user's actual location
leonzh2k Jul 15, 2023
99ffddd
add marker clustering functionality
leonzh2k Jul 15, 2023
5aa302a
implement latlng caching functionality
leonzh2k Jul 15, 2023
02e7ad9
Fix map blocking navbar dropdowns
leonzh2k Jul 20, 2023
e03f2e1
fix incorrect method call
leonzh2k Jul 20, 2023
5d93c9a
refactor logic to be more readable
leonzh2k Jul 20, 2023
93dae68
remove unneeded code used by infeasible approach
leonzh2k Jul 22, 2023
561edfd
Dynamically color markers based on active status
leonzh2k Jul 24, 2023
cca4b76
Add UI box showing number of unique countries
leonzh2k Jul 24, 2023
fcf4517
refactor marker rendering logic to be cleaner
leonzh2k Jul 25, 2023
59b1fcd
Change user provided location variable name
leonzh2k Jul 25, 2023
483288f
feat: saving new location as an object and getting coords from an API…
xaanders Sep 9, 2023
8079c48
merging old branch to a rebased one
xaanders Sep 9, 2023
c6f3293
fix: fixing coordinate name misspelings for basic info-tab and create…
xaanders Sep 14, 2023
2bd89e8
Merge branch 'development' into leon_add_interactive_map
xaanders Sep 14, 2023
b1959a3
feat: editing location data handling
xaanders Sep 16, 2023
24d5fb2
feat: adding new person location modal with form, getting coordinates…
xaanders Sep 23, 2023
de64e1d
fix: title key to jobTitle key name, feat: error boundaries to creati…
xaanders Oct 2, 2023
7fcad12
feat: making reusable popup for edit and adding users, popup modal fo…
xaanders Oct 15, 2023
c33df67
feat: setting edited user
xaanders Oct 15, 2023
a2ab76a
fix: moving logic filter logic to the backend, bug fixes, style adjus…
xaanders Nov 1, 2023
04dd9a0
add TeamLocations as protected route
leonzh2k Jul 2, 2023
e6ff945
add logic to fetch all user profile data
leonzh2k Jul 6, 2023
fb1eb61
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
8f73903
add logic to display example map
leonzh2k Jul 7, 2023
592534e
git attributes
xaanders Nov 1, 2023
09c7a54
remove "back to top" button on component render
leonzh2k Jul 13, 2023
cfc95ae
add reasonable map options
leonzh2k Jul 13, 2023
d29441f
display markers corresponding to each user
leonzh2k Jul 13, 2023
b125510
Make markers appear at user's actual location
leonzh2k Jul 15, 2023
9d2296c
add marker clustering functionality
leonzh2k Jul 15, 2023
b0d2ff1
implement latlng caching functionality
leonzh2k Jul 15, 2023
7910d36
Fix map blocking navbar dropdowns
leonzh2k Jul 20, 2023
fc5ec5f
fix incorrect method call
leonzh2k Jul 20, 2023
0859e79
refactor logic to be more readable
leonzh2k Jul 20, 2023
6b0d2da
remove unneeded code used by infeasible approach
leonzh2k Jul 22, 2023
7fb9e59
Dynamically color markers based on active status
leonzh2k Jul 24, 2023
516afce
Add UI box showing number of unique countries
leonzh2k Jul 24, 2023
b60c02e
refactor marker rendering logic to be cleaner
leonzh2k Jul 25, 2023
e4e0223
Change user provided location variable name
leonzh2k Jul 25, 2023
3d46bbe
feat: saving new location as an object and getting coords from an API…
xaanders Sep 9, 2023
79b69ff
Add team locations item to Reports dropdown
leonzh2k Jun 30, 2023
5981e4f
Add team locations item to Reports dropdown
leonzh2k Jun 30, 2023
fc268e3
add TeamLocations as protected route
leonzh2k Jul 2, 2023
e233039
Make markers appear at user's actual location
leonzh2k Jul 15, 2023
3cc8838
implement latlng caching functionality
leonzh2k Jul 15, 2023
92f9905
fix: moving logic filter logic to the backend, bug fixes, style adjus…
xaanders Nov 1, 2023
b450fa0
fix: renaming popup, dev merging, buttons styling
xaanders Nov 2, 2023
e62c16f
Merge branch 'leon_add_interactive_map' of https://github.com/OneComm…
xaanders Nov 2, 2023
cd70e60
removing mockdata, renaming popup, esLint conflicts resolving, removi…
xaanders Nov 2, 2023
210c22a
add TeamLocations as protected route
leonzh2k Jul 2, 2023
c1bd7fc
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
f56aba1
add logic to display example map
leonzh2k Jul 7, 2023
b2023e2
Add team locations item to Reports dropdown
leonzh2k Jun 30, 2023
ce50025
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
767ff34
resolving conflicts
xaanders Nov 2, 2023
46ba51a
resolving conflicts
xaanders Nov 2, 2023
528b14a
adjusting to dev
xaanders Nov 2, 2023
5d26232
add TeamLocations as protected route
leonzh2k Jul 2, 2023
fc9ec2f
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
f03f08c
add logic to display example map
leonzh2k Jul 7, 2023
94e9a13
Add team locations item to Reports dropdown
leonzh2k Jun 30, 2023
8d9c601
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
3451097
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
9586a14
git attributes
xaanders Nov 1, 2023
8d0f8c7
install react-leaflet and leaflet
leonzh2k Jul 7, 2023
ae5cfe0
conflicts
xaanders Nov 4, 2023
71036e3
Merge branch 'leon_add_interactive_map' of https://github.com/OneComm…
xaanders Nov 4, 2023
d09ed25
Merge branch 'development' into leon_add_interactive_map
xaanders Nov 7, 2023
24d0947
fix: attributes restoring
xaanders Nov 7, 2023
a5948b4
adding path to eslint ignore
xaanders Nov 8, 2023
2a89f9e
mocking the react-leaflet import
xaanders Nov 13, 2023
eaa1e60
Merge branch 'development' into leon_add_interactive_map
xaanders Nov 13, 2023
91e2ca4
Merge branch 'development' into leon_add_interactive_map
xaanders Nov 16, 2023
506115a
total countries fix
xaanders Nov 17, 2023
971bf8d
Merge branch 'development' into leon_add_interactive_map
xaanders Nov 18, 2023
43859f7
fetching api key
xaanders Nov 18, 2023
64500f1
temp
KavyaAlla Nov 18, 2023
7cb07cf
user role fix
xaanders Nov 23, 2023
2dec5eb
Merge branch 'leon_add_interactive_map' of https://github.com/OneComm…
xaanders Nov 23, 2023
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ src/components/SummaryManagement/**
src/components/TaskEditSuggestions/**
src/components/TeamMemberTasks/**
src/components/Teams/**
src/components/TeamLocations/**
src/components/Timelog/**
src/components/UpdatePassword/**
src/components/UserManagement/**
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ src/components/SetupProfile/**
src/components/SummaryBar/**
src/components/SummaryManagement/**
src/components/TaskEditSuggestions/**
src/components/TeamLocations/**
src/components/TeamMemberTasks/**
src/components/Teams/**
src/components/Timelog/**
Expand Down
Binary file modified images/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module.exports = {
// Bundle mapper for d3 import
moduleNameMapper: {
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
'react-leaflet': '<rootDir>/src/_tests_/__mocks__/react-leaflet.js',
'marker-cluster-group': '<rootDir>/src/_tests_/__mocks__/react-leaflet-cluster.js',
},

// The paths to modules that run some code to configure or set up the testing environment before each test
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"joi": "^14.0.6",
"js-levenshtein": "^1.1.6",
"jwt-decode": "^2.2.0",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"moment": "^2.29.2",
"moment-timezone": "^0.5.33",
Expand All @@ -49,6 +50,8 @@
"react-icons": "^4.3.1",
"react-image": "^2.4.0",
"react-input-range": "^1.3.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-moment": "^1.1.1",
"react-multi-select-component": "^4.0.2",
"react-phone-input-2": "^2.14.0",
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/__mocks__/react-leaflet-cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('it should pass', () => {
expect(true).toBe(true);
});
3 changes: 3 additions & 0 deletions src/__tests__/__mocks__/react-leaflet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('it should pass', () => {
expect(true).toBe(true);
});
14 changes: 12 additions & 2 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TIMELOG,
REPORTS,
WEEKLY_SUMMARIES_REPORT,
TEAM_LOCATIONS,
OTHER_LINKS,
USER_MANAGEMENT,
BADGE_MANAGEMENT,
Expand Down Expand Up @@ -148,9 +149,18 @@ export const Header = props => {
<DropdownItem tag={Link} to="/weeklysummariesreport">
{WEEKLY_SUMMARIES_REPORT}
</DropdownItem>
<DropdownItem tag={Link} to="/teamlocations">
{TEAM_LOCATIONS}
</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
) : null}
</UncontrolledDropdown>
) :
<NavItem>
<NavLink tag={Link} to="/teamlocations">
{TEAM_LOCATIONS}
</NavLink>
</NavItem>
}
<NavItem>
<NavLink tag={Link} to={`/timelog/${user.userid}`}>
<i className="fa fa-bell i-large">
Expand Down
51 changes: 41 additions & 10 deletions src/components/SetupProfile/SetupProfileUserEntry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {
collaborationPreference: 'Zoom',
jobTitle: '',
timeZone: '',
location: '',
location: {
userProvided: '',
coords: { lat: '', lng: '' },
country: '',
city: '',
},
timeZoneFilter: '',
token,
});
Expand Down Expand Up @@ -90,6 +95,24 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {
[id]: value,
}));
};
const handleLocation = event => {
const { id, value } = event.target;
setUserProfile(prevProfile => ({
...prevProfile,
[id]: {
...prevProfile.location,
userProvided: value
},
}));
}
const handleToggle = event => {
const { id } = event.target;
const key = id === 'emailPubliclyAccessible' ? 'email' : 'phoneNumber';
setUserProfile(prevProfile => ({
...prevProfile,
privacySettings: { ...prevProfile.privacySettings, [key]: !prevProfile.privacySettings[key] },
}));
};

const phoneChange = phone => {
setUserProfile(prevProfile => ({
Expand All @@ -103,29 +126,37 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {
...prevErrors,
timeZoneFilterClicked: '',
}));

if (!userProfile.location) {
const location = userProfile.location.userProvided;
if (!location) {
alert('Please enter valid location');
return;
}
if (!APIkey) {
console.log('Geocoding API key missing');
return;
}

getUserTimeZone(userProfile.location, APIkey)
getUserTimeZone(location, APIkey)
.then(response => {
if (
response.data.status.code === 200 &&
response.data.results &&
response.data.results.length
) {
let timezone = response.data.results[0].annotations.timezone.name;

let currentLocation = {
userProvided: location,
coords: {
lat: response.data.results[0].geometry.lat,
lng: response.data.results[0].geometry.lng,
},
country: response.data.results[0].components.country,
city: response.data.results[0].components.city,
};
setUserProfile(prevProfile => ({
...prevProfile,
timeZoneFilter: timezone,
timeZone: timezone,
location: currentLocation
}));
} else {
alert('Invalid location or ' + response.data.status.message);
Expand Down Expand Up @@ -271,7 +302,7 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {

// Validate Location

if (userProfile.location.trim() === '') {
if (userProfile.location.userProvided.trim() === '') {
setFormErrors(prevErrors => ({
...prevErrors,
location: 'Location is required',
Expand Down Expand Up @@ -322,7 +353,7 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {
},
jobTitle: userProfile.jobTitle.trim(),
timeZone: userProfile.timeZone.trim(),
location: userProfile.location.trim(),
location: userProfile.location,
token,
};

Expand Down Expand Up @@ -558,9 +589,9 @@ const SetupProfileUserEntry = ({ token, userEmail }) => {
name="location"
id="location"
placeholder="Location"
value={userProfile.location}
value={userProfile.location.userProvided}
onChange={e => {
handleChange(e);
handleLocation(e);
}}
invalid={formErrors.location !== ''}
/>
Expand Down
Binary file modified src/components/SummaryBar/suggestions_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading