Skip to content

Commit bc08e56

Browse files
authored
Merge 389f20b into 8584167
2 parents 8584167 + 389f20b commit bc08e56

File tree

12 files changed

+101
-70
lines changed

12 files changed

+101
-70
lines changed

package-lock.json

Lines changed: 45 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"react-dom": "^18.2.0",
5252
"react-infinite-scroller": "^1.2.6",
5353
"react-leaflet": "^4.2.1",
54-
"react-router-dom": "^7.5.2"
54+
"react-router-dom": "^7.9.1"
5555
},
5656
"babel": {
5757
"plugins": [

public/app.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/app.js.LICENSE.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@
4343
* LICENSE file in the root directory of this source tree.
4444
*/
4545

46-
/**
47-
* react-router v7.5.3
48-
*
49-
* Copyright (c) Remix Software Inc.
50-
*
51-
* This source code is licensed under the MIT license found in the
52-
* LICENSE.md file in the root directory of this source tree.
53-
*
54-
* @license MIT
55-
*/
56-
5746
/** @license React v16.13.1
5847
* react-is.production.min.js
5948
*

src/app.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import {
33
RouteObject,
44
RouterProvider,
55
createBrowserRouter,
6+
useRouteError,
67
} from 'react-router-dom';
78

9+
import { Global } from '@emotion/react';
810
import { TsmlUI } from './components';
11+
import { errorCss, globalCss } from './styles';
912

1013
// locate element
1114
const element = document.getElementById('tsml-ui');
@@ -30,10 +33,24 @@ if (element) {
3033
timezone={element.getAttribute('data-timezone') || undefined}
3134
/>
3235
),
36+
errorElement: <ErrorBoundary />,
3337
},
3438
]);
3539

3640
createRoot(element).render(<RouterProvider router={router} />);
3741
} else {
3842
console.warn('TSML UI could not find a div#tsml-ui element');
3943
}
44+
45+
function ErrorBoundary() {
46+
const error = useRouteError();
47+
const message = error instanceof Error ? error.message : 'Unknown error';
48+
return (
49+
<>
50+
<Global styles={globalCss} />
51+
<div>
52+
<div css={errorCss}>{message}</div>
53+
</div>
54+
</>
55+
);
56+
}

src/components/Controls.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FormEvent, MouseEvent, useEffect, useRef, useState } from 'react';
22

33
import { useNavigate } from 'react-router-dom';
44

5-
import { analyticsEvent, formatUrl } from '../helpers';
5+
import { analyticsEvent, formatSearch, formatUrl } from '../helpers';
66
import { useData, useInput, useSettings } from '../hooks';
77
import {
88
controlsCss,
@@ -152,7 +152,7 @@ export default function Controls() {
152152
aria-label={strings.modes[input.mode]}
153153
css={modes.length > 1 ? controlsInputFirstCss : controlsInputCss}
154154
disabled={input.mode === 'me'}
155-
onChange={e => setSearch(e.target.value)}
155+
onChange={e => setSearch(formatSearch(e.target.value))}
156156
placeholder={strings.modes[input.mode]}
157157
ref={searchInput}
158158
spellCheck="false"

src/helpers/format-search.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// sanitize search input
2+
export const formatSearch = (search: string) =>
3+
search.replace(/[.*+?^${}()|[\]\\]/g, '');

src/helpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export * from './format-conference-provider';
66
export * from './format-directions-url';
77
export * from './format-feedback-email';
88
export * from './format-ics';
9+
export * from './format-search';
910
export * from './format-slug';
1011
export * from './format-string';
1112
export * from './format-url';

src/helpers/load-meeting-data.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { DateTime, WeekdayNumbers } from 'luxon';
33
import { flattenAndSortIndexes } from './flatten-and-sort-indexes';
44
import { formatAddress } from './format-address';
55
import { formatConferenceProvider } from './format-conference-provider';
6+
import { formatSearch } from './format-search';
67
import { formatSlug } from './format-slug';
78
import { states } from './states';
89
import { streamlineRegionsIndex } from './streamline-regions-index';
@@ -425,21 +426,23 @@ export function loadMeetingData(
425426
: undefined;
426427

427428
// build search string
428-
const search = [
429-
district,
430-
formatted_address,
431-
group,
432-
group_notes,
433-
location,
434-
location_notes,
435-
name,
436-
notes,
437-
regions,
438-
]
439-
.flat()
440-
.filter(e => e)
441-
.join('\t')
442-
.toLowerCase();
429+
const search = formatSearch(
430+
[
431+
district,
432+
formatted_address,
433+
group,
434+
group_notes,
435+
location,
436+
location_notes,
437+
name,
438+
notes,
439+
regions,
440+
]
441+
.flat()
442+
.filter(e => e)
443+
.join('\t')
444+
.toLowerCase()
445+
);
443446

444447
meetings[slug] = {
445448
address,

src/hooks/filter.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
7777
if (input.mode === 'search') {
7878
if (input.search) {
7979
const orTerms = input.search
80-
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
8180
.replaceAll(' OR ', '|')
8281
.toLowerCase()
8382
.split('|')

0 commit comments

Comments
 (0)