Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
updated map.tsx and dependency issues
  • Loading branch information
tijin-abe-thomas committed Oct 26, 2023
commit 7e3fa0a0faaea9a819faae02675d6f925d9b64f3
14 changes: 11 additions & 3 deletions xaea12/app/components/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ type DirectionsResult = google.maps.DirectionsResult;
type MapOptions = google.maps.MapOptions;
type heatMapOptions = google.maps.visualization.HeatmapLayerOptions

interface BusinessDataItem {
coordinates: {
lat: number;
lng: number;
};
weekly_sum: number;
}

export default function Map() {
const mapRef = useRef<GoogleMap>();
const center = useMemo<LatLngLiteral>(
Expand All @@ -35,14 +43,14 @@ export default function Map() {
[]
);

const [businessData, setBusinessData] = useState([]);
const [businessData, setBusinessData] = useState<BusinessDataItem[]>([]);

useEffect(() => {
async function fetchData() {
try {
const response = await fetch('/api/popular_times'); // Replace with your actual Flask API endpoint
const response = await fetch('/api/popular_times');
if (response.ok) {
const data = await response.json();
const data = await response.json() as BusinessDataItem[];
setBusinessData(data);
} else {
console.error('Failed to fetch business data');
Expand Down
Loading