zeroed-some/localtoast / 560003e

Browse files

satisfy the linter

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
560003e9158bafe8998e035f21230afbf7c42a79
Parents
a04af33
Tree
a8c5f96

5 changed files

StatusFile+-
M frontend/app/page.tsx 8 7
M frontend/components/Map.tsx 1 1
M frontend/components/RestaurantPanel.tsx 1 1
M frontend/components/ReviewModal.tsx 1 1
M frontend/components/SearchPanel.tsx 1 1
frontend/app/page.tsxmodified
@@ -2,8 +2,8 @@
2
 
2
 
3
 import { useState, useEffect } from 'react';
3
 import { useState, useEffect } from 'react';
4
 import dynamic from 'next/dynamic';
4
 import dynamic from 'next/dynamic';
5
-import { MapPin, Plus, Loader2 } from 'lucide-react';
5
+import { Plus, Loader2 } from 'lucide-react';
6
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
6
+import { useMutation } from '@tanstack/react-query';
7
 import { Providers } from './providers';
7
 import { Providers } from './providers';
8
 import { Loading } from '@/components/Loading';
8
 import { Loading } from '@/components/Loading';
9
 import ReviewModal from '@/components/ReviewModal';
9
 import ReviewModal from '@/components/ReviewModal';
@@ -23,7 +23,6 @@ function HomePage() {
23
   const [searchResultsMinimized, setSearchResultsMinimized] = useState(false);
23
   const [searchResultsMinimized, setSearchResultsMinimized] = useState(false);
24
   const [searchResults, setSearchResults] = useState<PlaceSearchResult[]>([]);
24
   const [searchResults, setSearchResults] = useState<PlaceSearchResult[]>([]);
25
   const [restaurants, setRestaurants] = useState<Restaurant[]>([]);
25
   const [restaurants, setRestaurants] = useState<Restaurant[]>([]);
26
-  const queryClient = useQueryClient();
27
 
26
 
28
   // Get user's location
27
   // Get user's location
29
   useEffect(() => {
28
   useEffect(() => {
@@ -58,8 +57,9 @@ function HomePage() {
58
       }
57
       }
59
       alert('Toast rating added! 🍞');
58
       alert('Toast rating added! 🍞');
60
     },
59
     },
61
-    onError: (error: any) => {
60
+    onError: (error: unknown) => {
62
-      alert(error.response?.data?.error || 'Failed to add rating');
61
+      const err = error as any;
62
+      alert(err.response?.data?.error || 'Failed to add rating');
63
     },
63
     },
64
   });
64
   });
65
 
65
 
@@ -79,8 +79,9 @@ function HomePage() {
79
       setShowSearchResults(true);
79
       setShowSearchResults(true);
80
       setSelectedRestaurant(null); // Close any open restaurant panel
80
       setSelectedRestaurant(null); // Close any open restaurant panel
81
     },
81
     },
82
-    onError: () => {
82
+    onError: (error: unknown) => {
83
-      alert('Failed to search for places');
83
+      const err = error as any;
84
+      alert(err.response?.data?.error || 'Failed to search for places');
84
     },
85
     },
85
   });
86
   });
86
 
87
 
frontend/components/Map.tsxmodified
@@ -9,7 +9,7 @@ import { Restaurant } from '@/lib/api';
9
 
9
 
10
 // Fix for default markers in React-Leaflet
10
 // Fix for default markers in React-Leaflet
11
 if (typeof window !== 'undefined') {
11
 if (typeof window !== 'undefined') {
12
-  delete (L.Icon.Default.prototype as any)._getIconUrl;
12
+  delete (L.Icon.Default.prototype as Record<string, any>)._getIconUrl;
13
   L.Icon.Default.mergeOptions({
13
   L.Icon.Default.mergeOptions({
14
     iconRetinaUrl: '/leaflet/marker-icon-2x.png',
14
     iconRetinaUrl: '/leaflet/marker-icon-2x.png',
15
     iconUrl: '/leaflet/marker-icon.png',
15
     iconUrl: '/leaflet/marker-icon.png',
frontend/components/RestaurantPanel.tsxmodified
@@ -26,7 +26,7 @@ export default function RestaurantPanel({ restaurant, onClose, onAddRating }: Re
26
       setShowRatingForm(false);
26
       setShowRatingForm(false);
27
       setRating(5);
27
       setRating(5);
28
       setReview('');
28
       setReview('');
29
-    } catch (error) {
29
+    } catch (_error) {
30
       // Error handling done in parent
30
       // Error handling done in parent
31
     } finally {
31
     } finally {
32
       setIsSubmitting(false);
32
       setIsSubmitting(false);
frontend/components/ReviewModal.tsxmodified
@@ -23,7 +23,7 @@ export default function ReviewModal({ restaurant, onClose, onSubmit }: ReviewMod
23
     try {
23
     try {
24
       await onSubmit({ rating, review });
24
       await onSubmit({ rating, review });
25
       onClose();
25
       onClose();
26
-    } catch (error) {
26
+    } catch {
27
       // Error handling done in parent
27
       // Error handling done in parent
28
     } finally {
28
     } finally {
29
       setIsSubmitting(false);
29
       setIsSubmitting(false);
frontend/components/SearchPanel.tsxmodified
@@ -1,7 +1,7 @@
1
 'use client';
1
 'use client';
2
 
2
 
3
 import { useState } from 'react';
3
 import { useState } from 'react';
4
-import { X, ThumbsUp, ThumbsDown, MessageSquare, MapPin, Star } from 'lucide-react';
4
+import { ThumbsUp, ThumbsDown, MessageSquare, MapPin } from 'lucide-react';
5
 import { PlaceSearchResult } from '@/lib/api';
5
 import { PlaceSearchResult } from '@/lib/api';
6
 
6
 
7
 interface SearchPanelProps {
7
 interface SearchPanelProps {