File size: 1,601 Bytes
fbf7aed
 
59275a8
a93666a
 
 
 
59275a8
6d4c624
fbf7aed
 
a93666a
 
a68b13b
a93666a
6d4c624
 
a93666a
 
 
 
 
 
 
fbf7aed
 
 
a93666a
 
 
 
 
 
 
 
a68b13b
 
 
 
 
 
 
 
a93666a
 
 
59275a8
a68b13b
 
 
5a0f249
 
a68b13b
fbf7aed
 
 
 
6d4c624
 
fbf7aed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// import logo from './logo.svg';
import './App.css';
import WikiMap from './components/Map';
import React, { useState, 
  // useEffect,
  //  useCallback
   } from 'react';



function App() {
  const [searchQuery, setSearchQuery] = useState('');
  const [submittedQuery, setSubmittedQuery] = useState('');
  const [contentType, setContentType] = useState('summary'); // 'summary' or 'full'

  const handleMapClick = (lat, lng) => {
    console.log(`Map clicked at latitude: ${lat}, longitude: ${lng}`);
  };

  const handleSearch = (e) => {
    e.preventDefault(); 
    setSubmittedQuery(searchQuery);
    console.log(`Search query: ${searchQuery}`);
  };

  return (
    <div className="App">
      <div className="search-container">
        <form onSubmit={handleSearch}>
          <input
            type="text"
            placeholder="Search for a location"
            value={searchQuery}
            onChange={(e) => setSearchQuery(e.target.value)}
          />
          <select 
            value={contentType}
            onChange={(e) => setContentType(e.target.value)}
            style={{ margin: '0 10px' }}
          >
            <option value="summary">Summary</option>
            <option value="full">Full Content</option>
          </select>
          <button type="submit">Search</button>
        </form>
      </div>
      <WikiMap 
        onMapClick={handleMapClick} 
        searchQuery={submittedQuery}
        contentType={contentType}
        setSearchQuery={setSearchQuery}
        setSubmittedQuery={setSubmittedQuery}
      />
    </div>
  );
}



export default App;