-
-
Notifications
You must be signed in to change notification settings - Fork 171
fix: fixed bug from issue #1369 #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,9 @@ import { MapToolbar } from './MapToolbar' | |||||||
| import { SelectedFeature } from './AreaActiveMarker' | ||||||||
| import { useRouter } from 'next/navigation' | ||||||||
| import { useUrlParams } from '@/js/hooks/useUrlParams' | ||||||||
| import Spinner from '@/components/ui/Spinner' | ||||||||
| import { Button } from '@/components/ui/Button' | ||||||||
| import { toast } from 'react-toastify' | ||||||||
|
|
||||||||
| export interface CameraInfo { | ||||||||
| center: { | ||||||||
|
|
@@ -68,6 +71,10 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({ | |||||||
| heatmap: false, | ||||||||
| crags: true | ||||||||
| }) | ||||||||
|
|
||||||||
| const [isLoading, setIsLoading] = useState(true) | ||||||||
| const [hasError, setHasError] = useState(false) | ||||||||
|
|
||||||||
| const router = useRouter() | ||||||||
| const urlParams = useUrlParams() | ||||||||
|
|
||||||||
|
|
@@ -95,6 +102,9 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({ | |||||||
| if (e.target == null) return | ||||||||
| setMapInstance(e.target) | ||||||||
|
|
||||||||
| setIsLoading(false) | ||||||||
| setHasError(false) | ||||||||
|
|
||||||||
| // Only apply jumpTo if initial values are defined | ||||||||
| if (initialCenter != null && initialZoom != null) { | ||||||||
| e.target.jumpTo({ center: initialCenter, zoom: initialZoom ?? 6 }) | ||||||||
|
|
@@ -103,6 +113,39 @@ export const GlobalMap: React.FC<GlobalMapProps> = ({ | |||||||
| } | ||||||||
| }, [initialCenter, initialZoom, initialViewState]) | ||||||||
|
|
||||||||
| useEffect(() => { | ||||||||
| if (!isLoading) return | ||||||||
| const timeout = setTimeout(() => { | ||||||||
| setHasError(true) | ||||||||
| setIsLoading(false) | ||||||||
| toast.error('Map load timeout') | ||||||||
| }, 10000) | ||||||||
| return () => clearTimeout(timeout) | ||||||||
| }, [isLoading]) | ||||||||
|
|
||||||||
| useEffect(() => { | ||||||||
| if (!mapInstance) return | ||||||||
| const handleError = (err: any) => { | ||||||||
|
||||||||
| const handleError = (err: any) => { | |
| const handleError = (err: Error) => { |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing space inside the className string should be removed for cleaner code.
| <div className="absolute inset-0 flex items-center justify-center bg-white/20 "> | |
| <div className="absolute inset-0 flex items-center justify-center bg-white/20"> |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between '&&' and '<Map' reduces readability. Add a space for proper formatting.
| {!hasError &&<Map | |
| {!hasError && <Map |
Copilot
AI
Oct 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The closing JSX brace should be on the same line as '' or properly indented on a new line for better readability.
| </Map>} | |
| </Map> | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace on line 107 should be removed to maintain clean code formatting.