✨ 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
72 lines
2.8 KiB
JavaScript
72 lines
2.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.IoAdapter = void 0;
|
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
const websockets_1 = require("@nestjs/websockets");
|
|
const constants_1 = require("@nestjs/websockets/constants");
|
|
const rxjs_1 = require("rxjs");
|
|
const operators_1 = require("rxjs/operators");
|
|
const socket_io_1 = require("socket.io");
|
|
/**
|
|
* @publicApi
|
|
*/
|
|
class IoAdapter extends websockets_1.AbstractWsAdapter {
|
|
create(port, options) {
|
|
if (!options) {
|
|
return this.createIOServer(port);
|
|
}
|
|
const { namespace, server, ...opt } = options;
|
|
return server && (0, shared_utils_1.isFunction)(server.of)
|
|
? server.of(namespace)
|
|
: namespace
|
|
? this.createIOServer(port, opt).of(namespace)
|
|
: this.createIOServer(port, opt);
|
|
}
|
|
createIOServer(port, options) {
|
|
if (this.httpServer && port === 0) {
|
|
return new socket_io_1.Server(this.httpServer, options);
|
|
}
|
|
return new socket_io_1.Server(port, options);
|
|
}
|
|
bindMessageHandlers(socket, handlers, transform) {
|
|
const disconnect$ = (0, rxjs_1.fromEvent)(socket, constants_1.DISCONNECT_EVENT).pipe((0, operators_1.share)(), (0, operators_1.first)());
|
|
handlers.forEach(({ message, callback }) => {
|
|
const source$ = (0, rxjs_1.fromEvent)(socket, message).pipe((0, operators_1.mergeMap)((payload) => {
|
|
const { data, ack } = this.mapPayload(payload);
|
|
return transform(callback(data, ack)).pipe((0, operators_1.filter)((response) => !(0, shared_utils_1.isNil)(response)), (0, operators_1.map)((response) => [response, ack]));
|
|
}), (0, operators_1.takeUntil)(disconnect$));
|
|
source$.subscribe(([response, ack]) => {
|
|
if (response.event) {
|
|
return socket.emit(response.event, response.data);
|
|
}
|
|
(0, shared_utils_1.isFunction)(ack) && ack(response);
|
|
});
|
|
});
|
|
}
|
|
mapPayload(payload) {
|
|
if (!Array.isArray(payload)) {
|
|
if ((0, shared_utils_1.isFunction)(payload)) {
|
|
return { data: undefined, ack: payload };
|
|
}
|
|
return { data: payload };
|
|
}
|
|
const lastElement = payload[payload.length - 1];
|
|
const isAck = (0, shared_utils_1.isFunction)(lastElement);
|
|
if (isAck) {
|
|
const size = payload.length - 1;
|
|
return {
|
|
data: size === 1 ? payload[0] : payload.slice(0, size),
|
|
ack: lastElement,
|
|
};
|
|
}
|
|
return { data: payload };
|
|
}
|
|
close(server) {
|
|
if (this.forceCloseConnections && server.httpServer === this.httpServer) {
|
|
return;
|
|
}
|
|
return super.close(server);
|
|
}
|
|
}
|
|
exports.IoAdapter = IoAdapter;
|