phlask-map icon indicating copy to clipboard operation
phlask-map copied to clipboard

Adds fallbacks for resource title display

Open ravimakhijapi opened this issue 1 year ago • 0 comments

Addresses issue #462, where we want to improve the display the resource title/subtitle(s) when there is missing data.

Notes for reviewers:

  • There was one additional case that came up that was not present in the Figma designs. Namely, there are instances in the data where the name and lat/long are present, but the address is missing. I am currently handling this analogously and screenshots are below.
  • I noticed that there are instances where lat/long are present, but name and address are missing. In spot checking one instance, I did not see the corresponding pin on the map. Hence, we may need to update the code to display pins for this case, though that may warrant a separate issue.
  • There may be some minor differences in the current implementation design and the Figma designs. Please let me know what if anything should be changed, as I wasn't sure which would be better in this case.
  • I am assuming that lat/long will always be present, and this matches my inspection of the data (722 resources). If this doesn't hold in general, we would have to add a bit more code to handle the new cases.

Verification

Given four resources, if we assume that lat/long is always present, then there are four possible combinations for available data. Below are examples from the data of each, and screenshots of how they are currently being handled with this PR.

Examples with lat, long provided

  • name, address, and lat/long present
    • example: 39.96225, -75.21102
  • name and lat/long only
    • example: 39.945175, -75.160115
  • address and lat/long only
    • example: 39.9618, -75.1362
  • lat/long only
    • **** not displaying on the map?
    • example: 39.9510869813, -75.1718175251

Examples - screenshots and all the resource details


name, address, and lat/long present

all_present-desktop all_present-mobile

{
  "address": "4400 Haverford Avenue",
  "city": "Philadelphia",
  "creator": "phlask",
  "date_created": "2024-06-22T17:39:10.895514+00:00",
  "description": "1st floor / Lab area ; 2nd floor / outside employee restroom",
  "entry_type": "UNSURE",
  "last_modified": "2024-06-22T17:39:10.895514+00:00",
  "last_modifier": "phlask",
  "latitude": 39.96225,
  "longitude": -75.21102,
  "name": "Health Center #4",
  "resource_type": "WATER",
  "source": {
    "type": "MIGRATION"
  },
  "state": "PA",
  "status": "OPERATIONAL",
  "verification": {
    "last_modified": "2024-06-22T17:39:10.895514+00:00",
    "last_modifier": "phlask",
    "verified": false
  },
  "version": 1,
  "water": {
    "dispenser_type": [
      "DRINKING_FOUNTAIN"
    ]
  },
  "zip_code": "19104",
  "id": "0"
}

name and lat/long only

address_missing-desktop address_missing-mobile

{
  "city": "Philadelphia",
  "creator": "phlask",
  "date_created": "2024-06-22T17:39:31.391472+00:00",
  "description": "Dawn to Dusk",
  "entry_type": "UNSURE",
  "gp_id": "ChIJC-YRICTGxokRzSqdkj3Y6JI",
  "last_modified": "2024-06-22T17:39:31.391472+00:00",
  "last_modifier": "phlask",
  "latitude": 39.945175,
  "longitude": -75.160115,
  "name": "Louis Kahn Park",
  "resource_type": "WATER",
  "source": {
    "type": "MIGRATION"
  },
  "state": "PA",
  "status": "OPERATIONAL",
  "verification": {
    "last_modified": "2024-06-22T17:39:31.391472+00:00",
    "last_modifier": "phlask",
    "verified": false
  },
  "version": 1,
  "water": {
    "dispenser_type": [
      "DRINKING_FOUNTAIN"
    ]
  },
  "zip_code": "19107",
  "id": "3"
}

address and lat/long only

name_missing-desktop name_missing-mobile

{
  "address": "Delaware Av ES 25ft S/O Poplar St F/N - 2",
  "city": "Philadelphia",
  "creator": "phlask",
  "date_created": "2024-06-22T17:39:48.227967+00:00",
  "description": "",
  "entry_type": "UNSURE",
  "last_modified": "2024-06-22T17:39:48.227967+00:00",
  "last_modifier": "phlask",
  "latitude": 39.9618,
  "longitude": -75.1362,
  "name": "",
  "resource_type": "WATER",
  "source": {
    "type": "MIGRATION"
  },
  "state": "PA",
  "status": "OPERATIONAL",
  "verification": {
    "last_modified": "2024-06-22T17:39:48.227967+00:00",
    "last_modifier": "phlask",
    "verified": false
  },
  "version": 1,
  "water": {
    "dispenser_type": [
      "DRINKING_FOUNTAIN"
    ]
  },
  "zip_code": "19123",
  "id": "4"
}

lat/long only

Note that the lat/long only example does not have a screenshot since the pin does not appear to be on the map. This may be a bug and/or need to be handled with some additional code.

{
  "city": "Philadelphia",
  "creator": "phlask",
  "date_created": "2024-06-22T17:41:33.918293+00:00",
  "description": "This is a Ginkgo under the genus \"Ginkgo\" and species \"biloba\". The planting site ID is 368958, and the tree ID is 280906.",
  "entry_type": "UNSURE",
  "last_modified": "2024-06-22T17:41:33.918293+00:00",
  "last_modifier": "phlask",
  "latitude": 39.9510869813,
  "longitude": -75.1718175251,
  "resource_type": "FORAGE",
  "source": {
    "type": "MIGRATION"
  },
  "state": "PA",
  "status": "OPERATIONAL",
  "verification": {
    "last_modified": "2024-06-22T17:41:33.918293+00:00",
    "last_modifier": "phlask",
    "verified": false
  },
  "version": 1,
  "zip_code": "19103",
  "id": "405"
}

attn: @lxh5395, @tomporvaz, @vontell

ravimakhijapi avatar Aug 08 '24 20:08 ravimakhijapi