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 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { formatClasses as cx } from '../helpers/format';
import { formatClasses as cx } from '../helpers';
import Icon, { icons } from './Icon';

type ButtonProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { analyticsEvent } from '.';
import { analyticsEvent } from '../analytics';

window.gtag = jest.fn();
window.ga = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDistance } from './calculate-distances';
import { getDistance } from '../calculate-distances';
import { settings } from '../settings';
import type { Meeting } from '../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatAddress } from './format-address';
import { formatAddress } from '../format-address';

describe('formatAddress', () => {
it('returns first part of address if length > 3', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatArray } from './format-array';
import { formatArray } from '../format-array';

describe('formatArray', () => {
it.each`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatClasses } from './format-classes';
import { formatClasses } from '../format-classes';

describe('formatClasses', () => {
it.each`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { settings } from '../settings';
import { formatConferenceProvider } from './format-conference-provider';
import { formatConferenceProvider } from '../format-conference-provider';

describe('formatConferenceProvider', () => {
it.each(['foo', 'https://', 'https://foo.com'])(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatDirectionsUrl } from './format-directions-url';
import { formatDirectionsUrl } from '../format-directions-url';

describe('formatDirectionsUrl', () => {
const { formatted_address, latitude, longitude } = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { settings } from '../settings';
import { getQueryString } from '../query-string';
import { formatFeedbackEmail } from '.';
import { formatFeedbackEmail } from '../format-feedback-email';
import { Meeting } from '../../types';

jest.mock('./format-url', () => ({
jest.mock('../format-url', () => ({
formatUrl: jest.fn().mockReturnValue('https://foo.com'),
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DateTime } from 'luxon';

import { formatIcs } from '.';
import { formatIcs } from '../format-ics';
import { Meeting } from '../../types';

//TODO: Only requiring the parts needed for this test, should
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatSlug } from '.';
import { formatSlug } from '../format-slug';

describe('formatSlug', () => {
it('removes accents', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatString } from '.';
import { formatString } from '../format-string';

describe('formatString', () => {
it('works with mixed params', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatUrl } from '.';
import { formatUrl } from '../format-url';

describe('formatUrl', () => {
it('works with no params', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { JSONData } from '../../types';
import { flattenDays, loadMeetingData } from './load-meeting-data';
import { flattenDays, loadMeetingData } from '../load-meeting-data';

describe('loadMeetingData', () => {
it('loads data correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getQueryString, setQueryString } from './query-string';
import { getQueryString, setQueryString } from '../query-string';
import { stringify } from 'querystring';
import { settings } from './settings';
import { formatUrl } from './format';
import { settings } from '../settings';
import { formatUrl } from '../format-url';

jest.mock('./settings', () => ({
jest.mock('../settings', () => ({
settings: { filters: [], params: [] },
}));

jest.mock('./format', () => ({
jest.mock('../format-url', () => ({
formatUrl: jest.fn().mockReturnValue('foo'),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JSONData } from '../../types';
import {
GoogleSheetData,
translateGoogleSheet,
} from './translate-google-sheet';
} from '../translate-google-sheet';

describe('translateGoogleSheet', () => {
const sheetId = 'abc123';
Expand Down
24 changes: 24 additions & 0 deletions src/helpers/__tests__/user-agent.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { iOS } from '../user-agent';

let platformGetter: jest.SpyInstance<string, []>;
let userAgentGetter: jest.SpyInstance<string, []>;

describe('iOS', () => {
beforeEach(() => {
platformGetter = jest.spyOn(window.navigator, 'platform', 'get');
userAgentGetter = jest.spyOn(window.navigator, 'userAgent', 'get');
});

it('detects iOS', () => {
platformGetter.mockReturnValue('iPhone');
const isIOS = iOS();
expect(isIOS).toBe(true);
});

it('detects Mac', () => {
platformGetter.mockReturnValue('MacIntel');
userAgentGetter.mockReturnValue('Mac');
const isIOS = iOS();
expect(isIOS).toBe(false);
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Index, Meeting, State } from '../../types';
import { settings, strings } from '../settings';
import type { Index, Meeting, State } from '../types';
import { settings, strings } from './settings';
import { flattenAndSortIndexes } from './flatten-and-sort-indexes';
import { formatString as i18n } from '../format';
import { formatString as i18n } from './format-string';

//calculate distances
export function calculateDistances(
Expand Down
6 changes: 0 additions & 6 deletions src/helpers/data/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DateTime } from 'luxon';

import type { State } from '../../types';
import { settings } from '../settings';
import type { State } from '../types';
import { settings } from './settings';
import { getIndexByKey } from './get-index-by-key';
import { calculateDistances } from './calculate-distances';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Index } from '../../types';
import type { Index } from '../types';

//recursive function to make sorted array from object index
export function flattenAndSortIndexes(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { settings } from '../settings';
import { settings } from './settings';

//get name of provider from url
export function formatConferenceProvider(url: string) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meeting } from '../../types';
import { iOS } from '../user-agent';
import type { Meeting } from '../types';
import { iOS } from './user-agent';

//create a link for directions
export function formatDirectionsUrl({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meeting } from '../../types';
import { getQueryString } from '../query-string';
import { strings } from '../settings';
import { Meeting } from '../types';
import { getQueryString } from './query-string';
import { strings } from './settings';
import { formatArray } from './format-array';
import { formatString as i18n } from './format-string';
import { formatUrl } from './format-url';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DateTime } from 'luxon';

import { Meeting } from '../../types';
import { iOS } from '../user-agent';
import { Meeting } from '../types';
import { iOS } from './user-agent';

//format ICS file for add to calendar
export function formatIcs(meeting: Meeting) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { settings } from '../settings';
import { settings } from './settings';

//format an internal link with correct query params
export function formatUrl(input: Partial<TSMLReactConfig['defaults']>) {
Expand Down
10 changes: 0 additions & 10 deletions src/helpers/format/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Index } from '../../types';
import type { Index } from '../types';

//find an index by key
export function getIndexByKey(
Expand Down
19 changes: 17 additions & 2 deletions src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
export * from './analytics';
export * from './data';
export * from './format';
export * from './calculate-distances';
export * from './filter-meeting-data';
export * from './flatten-and-sort-indexes';
export * from './format-address';
export * from './format-array';
export * from './format-classes';
export * from './format-conference-provider';
export * from './format-directions-url';
export * from './format-feedback-email';
export * from './format-ics';
export * from './format-slug';
export * from './format-string';
export * from './format-url';
export * from './get-index-by-key';
export * from './load-meeting-data';
export * from './query-string';
export * from './settings';
export * from './translate-google-sheet';
export * from './user-agent';
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { DateTime } from 'luxon';
import type {
JSONData,
JSONDataFlat,
State,
Meeting,
Index,
} from '../../types';

import { formatAddress, formatConferenceProvider, formatSlug } from '../format';
import { settings, strings } from '../settings';
import type { JSONData, JSONDataFlat, State, Meeting, Index } from '../types';

import { formatAddress } from './format-address';
import { formatConferenceProvider } from './format-conference-provider';
import { formatSlug } from './format-slug';
import { settings, strings } from './settings';
import { flattenAndSortIndexes } from './flatten-and-sort-indexes';

//set up meeting data; this is only run once when the app loads
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/query-string.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { settings } from './settings';
import { formatUrl } from './format';
import { formatUrl } from './format-url';
import type { State } from '../types';

//load input values from query string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DateTime } from 'luxon';

import type { JSONData } from '../../types';
import { formatSlug } from '../format';
import { en, es, fr, ja, sv } from '../../i18n';
import { settings } from '../../helpers';
import type { JSONData } from '../types';
import { formatSlug } from './format-slug';
import { en, es, fr, ja, sv } from '../i18n';
import { settings } from './settings';

export type GoogleSheetData = {
values: string[][];
Expand Down