@@ -7,24 +7,17 @@ import parse from 'html-react-parser';
7
7
import timeGridPlugin from '@fullcalendar/timegrid' ;
8
8
import rrulePlugin from '@fullcalendar/rrule' ;
9
9
10
- import SearchHeader from './components/SearchHeader' ;
11
- import './App.css' ;
12
-
13
10
import useEscKey from './hooks/useEscKey' ;
14
11
15
12
import Icon from '@mdi/react' ;
16
13
import { mdiCalendarRange , mdiMapMarkerOutline , mdiClose } from '@mdi/js' ;
17
-
18
- import eventData from './events.json'
14
+ import './App.css' ;
19
15
20
16
const htmlRegex = / < \/ * h t m l - b l o b > / ;
21
17
22
18
function App ( ) {
23
19
const calendarRef = createRef ( ) ;
24
20
25
- const eventsArray = Array . from ( eventData )
26
- const [ events , setEvents ] = useState ( eventsArray )
27
-
28
21
const [ loading , setLoading ] = useState ( true ) ;
29
22
const [ showEventDetails , setShowEventDetails ] = useState ( false ) ;
30
23
const [ eventDetails , setEventDetails ] = useState ( false ) ;
@@ -58,16 +51,6 @@ function App() {
58
51
setPopupPosition ( { left : position . left + 'px' , top : position . top + 'px' } )
59
52
}
60
53
61
- const filterEvents = ( searchTerm ) => {
62
- if ( ! searchTerm ) return setEvents ( eventsArray ) //handles searchbox clear
63
- let matchingEvents = eventsArray . filter ( ( event ) => {
64
- const titleIncludes = event . title ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) )
65
- const descriptionIncludes = event . description ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) )
66
- return titleIncludes || descriptionIncludes
67
- } )
68
- setEvents ( matchingEvents )
69
- }
70
-
71
54
const handleEventClick = useCallback ( ( clickInfo ) => {
72
55
window . outerWidth > 600 && createPopupPosition ( clickInfo . jsEvent )
73
56
setEventDetails ( clickInfo . event ) ;
@@ -191,7 +174,7 @@ function App() {
191
174
aspectRatio = { aspectRatio }
192
175
handleWindowResize = { true }
193
176
windowResize = { windowResize }
194
- events = { events }
177
+ events = " events.json"
195
178
headerToolbar = { {
196
179
left : 'prev,next today' ,
197
180
center : 'title' ,
@@ -205,11 +188,10 @@ function App() {
205
188
eventClick = { handleEventClick }
206
189
loading = { ( isLoading ) => setLoading ( isLoading ) }
207
190
/>
208
- ) , [ aspectRatio , initialView , events ] ) ;
191
+ ) , [ aspectRatio , initialView ] ) ;
209
192
210
193
return (
211
194
< div className = "App main" >
212
- < SearchHeader filterEvents = { filterEvents } />
213
195
< div className = "finos-calendar" > { renderFullCalendar } </ div >
214
196
{ showEventDetails && renderEventDetails ( ) }
215
197
{ loading && < div className = "finos-calendar-overlay" /> }
0 commit comments