BinaryStudioAcademy / bsa-2023-towhub

1 stars 12 forks source link

th-216: Truck filters functionality #380

Closed h0wter closed 1 year ago

h0wter commented 1 year ago

Added the ability to sort by price, capacity, and distance to user. Since there is no option to filter by distance, I made it so that after each change of location the list is filtered by distance. Trucks that failed to calculate the distance are not displayed in the list.

In the getAllOpenedWithTrucks method of shift.repository, I used a nested query to get an array of trucks by 'Active' status. Instead I can do filtering of the result by that status. I don't know which option is better, hope you can advise.

UPD. Created a separate Autocomplete component to avoid using the @react-google-maps/api library, replaced it in location-input.tsx so the functionality in the application is unchanged.

filters_1 filters_2 filters_3