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

Frontend Release to Main [3.04] #1596

Merged
merged 197 commits into from
Nov 28, 2023
Merged

Frontend Release to Main [3.04] #1596

merged 197 commits into from
Nov 28, 2023

Conversation

one-community
Copy link
Member

Includes 1540 (Loading Unit Test), 1521 (Improve efficiency of time log page), 1554 (unit test pie chart), 1547 (BadgeDevelopmentTable unit test), 1508+602 (🔥 Time Entry Log Modal Issues), 1571 (🔥 Hover Colors Everywhere), 1568 (create unit test for project table.jsx), 1559 (unit test cases paging.jsx), 1558 (TeamsReportCharts_Unit_Test), 1518 (Add Profile Page missing box Shadow Style in User Profile Component), 1501 (unit test cases Modal file) 1503+599 (interactive map), 1579 (BadgeDevelopment_UnitTest), 1586 (🔥 map build), 1528 (TeamReportCharts_Unit_Test), 1530 (TeamReportLogs_Unit_Test), 1488 (Changing Feature Count To Zero Deletes Badge), 1427+577 (add materials page), 1592 (🔥 of failed png files), 1594 (🔥 text of the error message when entering an incorrect location)

leonzh2k added 30 commits June 30, 2023 15:44
Add new protected route which the interactive map of
team locations will eventually be accessed from. Only
users who can see the Reports dropdown can access this route.
Also add the new files to .prettierignore to comply with
Frontend PR#938
This data will eventually be displayed when clicking
markers on the map.
The Team Locations page is intended to be a non-scrollable
page, so the back to top button isn't needed here and
messes with the layout. It's added back when the component
is unmounted so it still works on other pages.
Add map options for better UX, such as starting
the map at a reasonable zoom level, setting the
initial center to be a reasonable place, setting
panning boundaries, etc.
Display markers corresponding to each user. On click,
a popup appears showing their name, job title, and location.
Currently the locations of each marker are randomly chosen,
because geocoding functionality hasn't been implemented yet.
- Add logic to pass each user's human-readable location to
a geocoding API and retrieve the corresponding
latitude and longitude of the location. To reduce number
of API calls, an API call is not made if the location is
obviously invalid (ex. empty string.) For testing purposes
only a maximum of 100 API calls are made currently, since
there is a limit of 2500 calls per day with the test API key.

- Also, add logic to display markers at the user's actual
location in the world, since the correct latlng information
has been obtained. Only users with a valid location are
displayed on the map.

- Change the marker appearance to that of a circle.
Add marker clustering functionality. This is
necessary since it is possible for multiple people
to have the same location, thus their markers will
overlap. The marker clustering plugin prevents this.
As a bonus, it also shows how many markers are
represented by a cluster.
- New package react-leaflet-cluster
Add caching functionality via localStorage
to reduce the number of network requests and
dramatically speed up rendering of markers.
change a localStorage.getItem() call to use
correct arguments
Since we are limited to only 2500 requests/day for
the geocoding API in production, requests must be
kept at a minimum. Here's some of the facts:
- Everybody who has ever contributed to OneCommunity
  will be displayed on the map. This means a lot of
  different locations. A request for each unique
  location will contribute a lot towards this limit.
- A public facing version of this map is planned.
  and for every new user who views the map, there
  will be a ton of API calls made since their
  browser has not cached the data yet.
- The cache is implemented via localStorage, and
  if it is cleared, a bunch of API requests will
  be made again. This means somebody could -
  intentionally or unintentionally, make us reach
  our limit in the span of a few minutes.

Therefore, the current approach of caching the data
in the browser as a rate limiting technique is not
feasible given our siutation. Instead, a better way
is to store the latlng as a property of a user's
profile in the database and only call the API to
update the latlng when a new user is created or when
their location changes. Then, when someone visits
the map, there are zero API calls made since the
locations have been precomputed and stored in the
backend. Therefore:
- remove caching logic
- add mock data similar to how the new response
  from the backend would look like
Refactor logic so that the explicit conditional
check to render or not render a marker based on
whether the location is valid or not is removed,
and instead the array of users is filtered
beforehand to only include users with valid
locations. Makes the JSX cleaner. Also, added
an example user with no valid location to show
how the map code handles it.
Change it to to something more accurate.
Add new protected route which the interactive map of
team locations will eventually be accessed from. Only
users who can see the Reports dropdown can access this route.
Also add the new files to .prettierignore to comply with
Frontend PR#938
This data will eventually be displayed when clicking
markers on the map.
The Team Locations page is intended to be a non-scrollable
page, so the back to top button isn't needed here and
messes with the layout. It's added back when the component
is unmounted so it still works on other pages.
Add map options for better UX, such as starting
the map at a reasonable zoom level, setting the
initial center to be a reasonable place, setting
panning boundaries, etc.
Display markers corresponding to each user. On click,
a popup appears showing their name, job title, and location.
Currently the locations of each marker are randomly chosen,
because geocoding functionality hasn't been implemented yet.
- Add logic to pass each user's human-readable location to
a geocoding API and retrieve the corresponding
latitude and longitude of the location. To reduce number
of API calls, an API call is not made if the location is
obviously invalid (ex. empty string.) For testing purposes
only a maximum of 100 API calls are made currently, since
there is a limit of 2500 calls per day with the test API key.

- Also, add logic to display markers at the user's actual
location in the world, since the correct latlng information
has been obtained. Only users with a valid location are
displayed on the map.

- Change the marker appearance to that of a circle.
Add marker clustering functionality. This is
necessary since it is possible for multiple people
to have the same location, thus their markers will
overlap. The marker clustering plugin prevents this.
As a bonus, it also shows how many markers are
represented by a cluster.
- New package react-leaflet-cluster
EvianTan and others added 29 commits November 19, 2023 18:19
…e_Log_Efficiency

Add curruserId into data
…mentTable_Unit_Test

Shiwani BadgeDevelopmentTable unit test
Removed "btn:hover" with "background-color: #0f8292" property property so that the "btn" styles are reflected from "reactstrap" for consistency.
…ime_Log_Entry_Refresh_Bug

Roberto- Fixes Time Entry Log Modal Issues
…Colors_Everywhere

Jahanzaib Fix Hover Colors Everywhere
…-test-for-ProjectTable.jsx

Jiangwei create unit test for project table.jsx
…Charts_UnitTest

TuanDinh_TeamsReportCharts_Unit_Test
…ng-box-shadow

Shubhankar added missing box shadow style to buttons
…_map

Leon and Oleksandr add interactive map
…ent-unit-test

Sahil_BadgeDevelopment_UnitTest
…harts_Unit_Test

TuanDinh_TeamReportCharts_Unit_Test
…ogs_Unit_Test

TuanDinh_TeamReportLogs_Unit_Test
…ure_Count_To_Zero_Deletes_Badge

Miguel - Changing Feature Count To Zero Deletes Badge
…_files

XiaoW_Hot fix of failed png files
…he-error-message-when-entering-an-incorrect-location

Xiao F Hotfix text of the error message when entering an incorrect location
@one-community one-community merged commit d2f16e4 into main Nov 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.