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

feat: loans map added to lender profile #5438

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

roger-in-kiva
Copy link
Collaborator

  • loans map added to lender profile

Some cases:
Screenshot 2024-08-12 at 1 53 37 p m
Screenshot 2024-08-12 at 1 53 50 p m
Screenshot 2024-08-12 at 1 54 03 p m
Screenshot 2024-08-12 at 2 04 41 p m

Mouse over country:
Screenshot 2024-08-12 at 1 54 36 p m

Mouse over fundraising loans dot:
Screenshot 2024-08-12 at 1 54 46 p m

Hidden fundraising loans dots:
Screenshot 2024-08-12 at 2 00 18 p m

@roger-in-kiva roger-in-kiva requested a review from a team August 12, 2024 18:05
import KvMap from '@/components/Kv/KvMap';
import KvCheckbox from '~/@kiva/kv-components/vue/KvCheckbox';

export const getIntervals = (min, max, nbIntervals) => {
Copy link
Collaborator

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.

Copy link
Collaborator

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,
Copy link
Collaborator

@dyersituations dyersituations Aug 12, 2024

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';
Copy link
Collaborator

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';
Copy link
Collaborator

@mcstover mcstover Aug 12, 2024

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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}`;
Copy link
Collaborator

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?

@mcstover
Copy link
Collaborator

@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?

@roger-in-kiva
Copy link
Collaborator Author

@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...
Let me see if we can use some dynamic data from the map library, if not we need to follow this approach as well.

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.

None yet

3 participants