Files
Laca-City/frontend/node_modules/react-query/es/devtools/utils.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

91 lines
3.1 KiB
JavaScript

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import React from 'react';
import { useTheme } from './theme';
import useMediaQuery from './useMediaQuery';
export var isServer = typeof window === 'undefined';
export function getQueryStatusColor(query, theme) {
return query.state.isFetching ? theme.active : !query.getObserversCount() ? theme.gray : query.isStale() ? theme.warning : theme.success;
}
export function getQueryStatusLabel(query) {
return query.state.isFetching ? 'fetching' : !query.getObserversCount() ? 'inactive' : query.isStale() ? 'stale' : 'fresh';
}
export function styled(type, newStyles, queries) {
if (queries === void 0) {
queries = {};
}
return /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var style = _ref.style,
rest = _objectWithoutPropertiesLoose(_ref, ["style"]);
var theme = useTheme();
var mediaStyles = Object.entries(queries).reduce(function (current, _ref2) {
var key = _ref2[0],
value = _ref2[1];
// eslint-disable-next-line react-hooks/rules-of-hooks
return useMediaQuery(key) ? _extends({}, current, typeof value === 'function' ? value(rest, theme) : value) : current;
}, {});
return /*#__PURE__*/React.createElement(type, _extends({}, rest, {
style: _extends({}, typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles, style, mediaStyles),
ref: ref
}));
});
}
export function useIsMounted() {
var mountedRef = React.useRef(false);
var isMounted = React.useCallback(function () {
return mountedRef.current;
}, []);
React[isServer ? 'useEffect' : 'useLayoutEffect'](function () {
mountedRef.current = true;
return function () {
mountedRef.current = false;
};
}, []);
return isMounted;
}
/**
* This hook is a safe useState version which schedules state updates in microtasks
* to prevent updating a component state while React is rendering different components
* or when the component is not mounted anymore.
*/
export function useSafeState(initialState) {
var isMounted = useIsMounted();
var _React$useState = React.useState(initialState),
state = _React$useState[0],
setState = _React$useState[1];
var safeSetState = React.useCallback(function (value) {
scheduleMicrotask(function () {
if (isMounted()) {
setState(value);
}
});
}, [isMounted]);
return [state, safeSetState];
}
/**
* Displays a string regardless the type of the data
* @param {unknown} value Value to be stringified
*/
export var displayValue = function displayValue(value) {
var name = Object.getOwnPropertyNames(Object(value));
var newValue = typeof value === 'bigint' ? value.toString() + "n" : value;
return JSON.stringify(newValue, name);
};
/**
* Schedules a microtask.
* This can be useful to schedule state updates after rendering.
*/
function scheduleMicrotask(callback) {
Promise.resolve().then(callback).catch(function (error) {
return setTimeout(function () {
throw error;
});
});
}