-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: loans map added to lender profile #5438
base: main
Are you sure you want to change the base?
Conversation
import KvMap from '@/components/Kv/KvMap'; | ||
import KvCheckbox from '~/@kiva/kv-components/vue/KvCheckbox'; | ||
|
||
export const getIntervals = (min, max, nbIntervals) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be worth adding a ticket to the epic to extract this to a util and unit test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what specifically are the intervals here? It would probably be good to add a jsdoc comment to this method to explain what it's generating.
return (this.lenderInfo?.statsPerCountry?.values ?? []).map(stat => ({ | ||
label: stat.country?.name ?? '', | ||
value: stat.loanCount ?? '', | ||
lat: stat.country?.geocode?.latitude ?? 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we generally guaranteed that the stat data exists or should we be filtering the array before we map the data?
@@ -12,6 +12,9 @@ | |||
<script> | |||
import { createIntersectionObserver } from '@/util/observerUtils'; | |||
import testDelayedGlobalLibrary from '@/util/timeoutUtils'; | |||
import countriesBorders from '@/assets/data/components/LenderProfile/countries-borders.json'; | |||
import { getIntervals, mapColors } from '@/components/LenderProfile/LenderMap'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like these two methods might better exist here (or in a shared util file).
@@ -12,6 +12,9 @@ | |||
<script> | |||
import { createIntersectionObserver } from '@/util/observerUtils'; | |||
import testDelayedGlobalLibrary from '@/util/timeoutUtils'; | |||
import countriesBorders from '@/assets/data/components/LenderProfile/countries-borders.json'; | |||
import { getIntervals, mapColors } from '@/components/LenderProfile/LenderMap'; | |||
import kvTokensPrimitives from '~/@kiva/kv-tokens/primitives.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everything in this file (ie. KvMap.vue) should be in https://github.com/kiva/kv-ui-elements/blob/main/%40kiva/kv-components/vue/KvMap.vue instead of UI. Havint the country borders json file would be helpful at a global context roo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The related intervals util could be moved as well and unit tested in the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words KvMap has been migrated to kv-ui-elements and all enhancements and additions should go there, then that file imported for use in the page instead of a UI only file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but the suggestion in the ticket is to use this UI file: https://kiva.atlassian.net/browse/MP-415
const loansString = feature.lenderLoans | ||
? `${feature.lenderLoans} loan${feature.lenderLoans > 1 ? 's' : ''}` | ||
: '0 loans'; | ||
const countryString = `${feature.properties.ADMIN} <br/> ${loansString}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is feature.properties.ADMIN
?
@roger-in-kiva @dyersituations I don't think we can use the country-borders json file in it's current state. I'm showing that file is 7.5 mb in size... Was there not a way to use the dynamic data from the map library to highlight countries as needed instead of requiring a file of this size? |
We need the polygons of every country for the case of leaflet usage, for that reason this file is huge... |
Some cases:
![Screenshot 2024-08-12 at 1 53 37 p m](https://private-user-images.githubusercontent.com/94026278/357153794-75fc68c0-37aa-4828-b369-07ac58e2f570.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTM3OTQtNzVmYzY4YzAtMzdhYS00ODI4LWIzNjktMDdhYzU4ZTJmNTcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3MjU2NWEzZGVlYmMzZmI2MDZlNzIyNWZlODQwM2NlNDgxMDRiMjY2MmY4MWU2ZTBhZTE1OTBiNDEzYTQwNTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7QcX98aS_oAuCzdAynPT-MjpY_9wX66i3OCM-HsnWhs)
![Screenshot 2024-08-12 at 1 53 50 p m](https://private-user-images.githubusercontent.com/94026278/357153824-f08ad008-e92c-41ad-8e48-ef01346c7d7b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTM4MjQtZjA4YWQwMDgtZTkyYy00MWFkLThlNDgtZWYwMTM0NmM3ZDdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk2MTYyZmY5NzYzZGZlMTc5NDliZTcyN2JlYTgyYTJjNDk5NmE0YWJkNzE0OTY5ZjQzNmQ5ODJiMDI1MTZmZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kf0vZfQrBQ9eTn_Fm8e9iqsDwSMDslJbImGuwTLM_rU)
![Screenshot 2024-08-12 at 1 54 03 p m](https://private-user-images.githubusercontent.com/94026278/357153868-b7e787c7-e2ba-441b-b3ea-e3610da233fb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTM4NjgtYjdlNzg3YzctZTJiYS00NDFiLWIzZWEtZTM2MTBkYTIzM2ZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkwMDY5YzVkOTdiOWY5YmQzYmM5Njg5YTNjNjY3ZGVhN2FhNjhhZWFjMDg3NzY5M2FjMmIxZWNlMzYyZmU5OTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OKJmv1kcshKKZWpxG-dPZMi0nkoL_G3ss7HH1jfnGgw)
![Screenshot 2024-08-12 at 2 04 41 p m](https://private-user-images.githubusercontent.com/94026278/357154753-dae50aaf-55c0-49da-9a6a-61f44523dc33.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTQ3NTMtZGFlNTBhYWYtNTVjMC00OWRhLTlhNmEtNjFmNDQ1MjNkYzMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMyZDMyZmM3ZWU4OGNiM2VmZTA0ODUxMDlkNDg3Y2E0ZGNiODJjNGZiYTE4YjNjZDk4ZTFlNzVhYzFkMDgwYWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.JrPpcareMA6PDBSrJ5ClCfOLGZr3fHJY8Du_jDs8KDc)
Mouse over country:
![Screenshot 2024-08-12 at 1 54 36 p m](https://private-user-images.githubusercontent.com/94026278/357154185-6efa0a25-03a7-439c-9004-be768d7f589a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTQxODUtNmVmYTBhMjUtMDNhNy00MzljLTkwMDQtYmU3NjhkN2Y1ODlhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFlNzFkYWVlMGFmM2VmZjNjZTMxZTllMjU5NTVjMzY0NzVjNjQ5NzdiYTQyMjRkYjg1MzdjMjY3YzI4YmZkMGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nmjlEg3IT5NjcnORgbAVbB4v8cSGSb-c_C0zdGQxAgg)
Mouse over fundraising loans dot:
![Screenshot 2024-08-12 at 1 54 46 p m](https://private-user-images.githubusercontent.com/94026278/357153954-6dec7e0c-29b2-47d3-af66-9d29d0d1a547.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTM5NTQtNmRlYzdlMGMtMjliMi00N2QzLWFmNjYtOWQyOWQwZDFhNTQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3ZjY3NjUyMGZhZDEzNWI0MDFjZjgwMzgyYTlmYjRlZjA1MTdhZTg0OWZjMjcxYmQ1NTFhNjVjMjE0YzBhNTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XQrakXzkdn4gkx98HbcndEWlCAg9I3qwRsLmCyeSdFs)
Hidden fundraising loans dots:
![Screenshot 2024-08-12 at 2 00 18 p m](https://private-user-images.githubusercontent.com/94026278/357154089-17511a8f-8d59-463c-88d4-776a886c993e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM1MzQxMzAsIm5iZiI6MTcyMzUzMzgzMCwicGF0aCI6Ii85NDAyNjI3OC8zNTcxNTQwODktMTc1MTFhOGYtOGQ1OS00NjNjLTg4ZDQtNzc2YTg4NmM5OTNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEzVDA3MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE1ZmVmNDJiYmZkYTU0N2MzYWIwZTgxOTlkZjhkZTAzYTIwN2MwNzdhMTI0NzhlZDZmYTczNzI0MTcyMTFkMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.psgNupRA09HLVsduiV__KEIYf1c60gB2lyhLWun4_YY)