Skip to content

Commit e46fc0c

Browse files
Revert "Feature : Added events search (#14)" (#96)
1 parent 1fd6b32 commit e46fc0c

File tree

4 files changed

+4
-105
lines changed

4 files changed

+4
-105
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Create a new directory named `dist` in the root directory and run :
4343
npm run getEvents
4444
```
4545

46-
Copy `events.json` from `dist` to `src` directory.
46+
Copy `events.json` from `dist` to root directory.
4747

4848
### Run development server
4949

src/App.jsx

+3-21
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,17 @@ import parse from 'html-react-parser';
77
import timeGridPlugin from '@fullcalendar/timegrid';
88
import rrulePlugin from '@fullcalendar/rrule';
99

10-
import SearchHeader from './components/SearchHeader';
11-
import './App.css';
12-
1310
import useEscKey from './hooks/useEscKey';
1411

1512
import Icon from '@mdi/react';
1613
import { mdiCalendarRange, mdiMapMarkerOutline, mdiClose } from '@mdi/js';
17-
18-
import eventData from './events.json'
14+
import './App.css';
1915

2016
const htmlRegex = /<\/*html-blob>/;
2117

2218
function App() {
2319
const calendarRef = createRef();
2420

25-
const eventsArray = Array.from(eventData)
26-
const [events, setEvents] = useState(eventsArray)
27-
2821
const [ loading, setLoading ] = useState(true);
2922
const [ showEventDetails, setShowEventDetails ] = useState(false);
3023
const [ eventDetails, setEventDetails ] = useState(false);
@@ -58,16 +51,6 @@ function App() {
5851
setPopupPosition({left: position.left + 'px', top: position.top + 'px'})
5952
}
6053

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-
7154
const handleEventClick = useCallback((clickInfo) => {
7255
window.outerWidth > 600 && createPopupPosition(clickInfo.jsEvent)
7356
setEventDetails(clickInfo.event);
@@ -191,7 +174,7 @@ function App() {
191174
aspectRatio={aspectRatio}
192175
handleWindowResize={true}
193176
windowResize={windowResize}
194-
events={events}
177+
events="events.json"
195178
headerToolbar={{
196179
left : 'prev,next today',
197180
center : 'title',
@@ -205,11 +188,10 @@ function App() {
205188
eventClick={handleEventClick}
206189
loading={(isLoading) => setLoading(isLoading)}
207190
/>
208-
),[aspectRatio, initialView, events]);
191+
),[aspectRatio, initialView]);
209192

210193
return (
211194
<div className="App main">
212-
<SearchHeader filterEvents={filterEvents} />
213195
<div className="finos-calendar">{renderFullCalendar}</div>
214196
{showEventDetails && renderEventDetails()}
215197
{loading && <div className="finos-calendar-overlay" />}

src/components/SearchHeader.css

-54
This file was deleted.

src/components/SearchHeader.jsx

-29
This file was deleted.

0 commit comments

Comments
 (0)