From b2533b7eae1999cba8884a2c3c99411317038f2c Mon Sep 17 00:00:00 2001 From: Vincent Wilson Date: Wed, 8 Jun 2022 13:22:11 -0400 Subject: [PATCH] fix: campus formatting (#2524) --- ApollosStorybook/ios/Podfile.lock | 8 +++---- .../src/MapView/MapView.stories.js | 24 +++++++++++++++++++ .../__snapshots__/MapView.tests.js.snap | 3 +-- .../apollos-ui-mapview/src/MapView/index.js | 7 +++++- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/ApollosStorybook/ios/Podfile.lock b/ApollosStorybook/ios/Podfile.lock index f9bf6bcc5..9d361e01d 100644 --- a/ApollosStorybook/ios/Podfile.lock +++ b/ApollosStorybook/ios/Podfile.lock @@ -279,7 +279,7 @@ PODS: - React-jsinspector (0.67.1) - React-logger (0.67.1): - glog - - react-native-apollos-player (3.6.0): + - react-native-apollos-player (3.8.0): - React - react-native-config (0.11.7): - React @@ -673,7 +673,7 @@ SPEC CHECKSUMS: boost: a7c83b31436843459a1961bfd74b96033dc77234 BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 + DoubleConversion: cde416483dac037923206447da6e1454df403714 FBLazyVector: cf409c74423d3507bda74bda1dc41e903ec2cd5b FBReactNativeSpec: ef0ce762fdb37900abb01e008cce5f0ef2cce6b7 Flipper: 30e8eeeed6abdc98edaf32af0cda2f198be4b733 @@ -686,7 +686,7 @@ SPEC CHECKSUMS: Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 FlipperKit: d8d346844eca5d9120c17d441a2f38596e8ed2b9 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 + glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OneSignalXCFramework: 10648e60ff3d335fbffa62d9b44b700b56d49b51 OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b @@ -704,7 +704,7 @@ SPEC CHECKSUMS: React-jsiexecutor: 1af5de75a4c834c05d53a77c1512e5aa6c18412f React-jsinspector: ab80bcdb02f28cdfc0dbbaea6db1241565d59002 React-logger: b08f354e4c928ff794ca477347fea0922aaf11c3 - react-native-apollos-player: 6c8da72f7a0e72bdd46fa9f8f0f8276ea6e5e221 + react-native-apollos-player: c804e3831edc4122327757aef90c4a128d7fd2ae react-native-config: 55548054279d92e0e4566ea15a8b9b81028ec342 react-native-geolocation: c956aeb136625c23e0dce0467664af2c437888c9 react-native-geolocation-service: c0efb872258ed9240f1003a70fca9e9757e5c785 diff --git a/packages/apollos-ui-mapview/src/MapView/MapView.stories.js b/packages/apollos-ui-mapview/src/MapView/MapView.stories.js index f61a01e85..9fd431423 100644 --- a/packages/apollos-ui-mapview/src/MapView/MapView.stories.js +++ b/packages/apollos-ui-mapview/src/MapView/MapView.stories.js @@ -29,6 +29,30 @@ const campuses = [ state: 'OH', street1: '120 E 8th St', }, + { + city: '', + distanceFromLocation: 2037.6461577685534, + id: 'Campus:4f68015ba18662a7409d1219a4ce013f', + image: 'https://www.placecage.com/c/220/220', + latitude: null, + longitude: null, + name: 'Online Campus', + postalCode: '', + state: '', + street1: '', + }, + { + city: '', + distanceFromLocation: 2037.6461577685534, + id: 'Campus:4f68015ba18662a7409d1219a4ce013f', + image: 'https://www.placecage.com/c/220/220', + latitude: null, + longitude: null, + name: 'Another Online Campus', + postalCode: '', + state: '', + street1: 'Find us at Newspring.cc', + }, ]; const currentCampus = { diff --git a/packages/apollos-ui-mapview/src/MapView/__snapshots__/MapView.tests.js.snap b/packages/apollos-ui-mapview/src/MapView/__snapshots__/MapView.tests.js.snap index 98aa741a3..f66d4b891 100644 --- a/packages/apollos-ui-mapview/src/MapView/__snapshots__/MapView.tests.js.snap +++ b/packages/apollos-ui-mapview/src/MapView/__snapshots__/MapView.tests.js.snap @@ -1277,8 +1277,7 @@ Cincinnati, OH 45202-2118 } } > - -Digital Campus, + Digital Campus diff --git a/packages/apollos-ui-mapview/src/MapView/index.js b/packages/apollos-ui-mapview/src/MapView/index.js index d619179bf..bfc8fe4ba 100644 --- a/packages/apollos-ui-mapview/src/MapView/index.js +++ b/packages/apollos-ui-mapview/src/MapView/index.js @@ -176,7 +176,12 @@ class MapView extends Component { } getCampusAddress = (campus) => - `${campus.street1}\n${campus.city}, ${campus.state} ${campus.postalCode}`; + [ + [campus.street1, campus.city].filter(Boolean).join('\n'), + [campus.state, campus.postalCode].filter(Boolean).join(' '), + ] + .filter(Boolean) + .join(', '); scrollToIndex = (index) => { const cardScrollPosition = index * this.cardScrollPositionOffset;