Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,553 changes: 2,371 additions & 182 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsml-ui",
"version": "1.7.11",
"version": "1.7.12",
"private": false,
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions public/data/times.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,15 @@
"types": ["O", "SM"],
"formatted_address": "123 Main St, Anytown, OK 12345, USA",
"conference_url": "https://zoom.us/d/1234567"
},
{
"slug": "approximate",
"name": "Approximate Inactive Test",
"day": "0",
"time": "08:00",
"end_time": "10:00",
"group": "Online Group",
"types": ["O", "NA"],
"formatted_address": "Anytown, OK 12345, USA"
}
]
2 changes: 1 addition & 1 deletion public/tests/japan.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<body>
<div
id="tsml-ui"
data-src="https://docs.google.com/spreadsheets/d/10LODHcORFjdXkltRL0gI-nCPjCOpO9tv91uKyLfvMEs/edit?usp=sharing"
data-src="https://docs.google.com/spreadsheets/d/1JSqXehcLk91qffMHRIx-8ddryYEC-vnrqb6aGHmApys/edit?usp=sharing"
data-mapbox="pk.eyJ1Ijoiam9zaHJlaXNuZXIiLCJhIjoiY2tvYXA0YnZxMGRldDJxbzdta25uNGphdiJ9.eay-UKgIT99ALmdw08xBPw"
data-google="AIzaSyCS9M8Dqk5cMFqA7xvUrQEzT1u5IvcbT7c"
data-timezone="Asia/Tokyo"
Expand Down
3 changes: 1 addition & 2 deletions src/helpers/format-address.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//get address from formatted_address
export function formatAddress(formatted_address = '') {
const address = formatted_address.split(', ');
return address.length > 3 ? address[0] : undefined;
return formatted_address.replace(/,.*/, '');
}
3 changes: 2 additions & 1 deletion src/helpers/load-meeting-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export function loadMeetingData(
if (!formatted_address) {
formatted_address = [
meeting.address,
meeting.city,
[meeting.state, meeting.postal_code].join(' ').trim(),
meeting.country,
]
Expand Down Expand Up @@ -128,7 +129,7 @@ export function loadMeetingData(
} else if (typeof meeting.approximate === 'boolean') {
approximate = meeting.approximate;
} else {
approximate = !address;
approximate = formatted_address.split(',').length < 4;
}

// if approximate is specified, it overrules formatAddress
Expand Down
12 changes: 8 additions & 4 deletions test/__tests__/format-address.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { formatAddress } from '../../src/helpers/format-address';

describe('formatAddress', () => {
it('returns first part of address if length > 3', () => {
expect(formatAddress('foo, bar, baz, qux')).toStrictEqual('foo');
it('returns first part of address if USA address', () => {
expect(formatAddress('123 Main St, Buffalo, NY 12345, USA')).toStrictEqual(
'123 Main St'
);
});

it.each([undefined, 'foo, bar, baz'])('yields null with %s', input => {
expect(formatAddress(input)).toStrictEqual(undefined);
it('returns first part of address in Australia', () => {
expect(
formatAddress('123 Main St, Melbourne VIC 1234, Australia')
).toStrictEqual('123 Main St');
});
});
4 changes: 2 additions & 2 deletions test/__tests__/load-meeting-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ describe('loadMeetingData', () => {
'test-meeting': {
address: '123 Main St',
approximate: false,
formatted_address: '123 Main St, OK, USA',
formatted_address: '123 Main St, Anytown, OK, USA',
isActive: true,
isInPerson: true,
isOnline: false,
isTempClosed: false,
name: 'Test Meeting',
regions: ['Anytown'],
search: '123 main st, ok, usa\ttest meeting\tanytown',
search: '123 main st, anytown, ok, usa\ttest meeting\tanytown',
slug: 'test-meeting',
types: ['in-person', 'active'],
},
Expand Down