This commit is contained in:
2025-10-15 23:57:26 +05:30
parent adeccc24fb
commit b66ab53df4
5 changed files with 14 additions and 20 deletions

View File

@@ -1,19 +1,22 @@
// spot-worker.js - Web Worker pour traiter les spots
self.onmessage = function(e) {
const { type, data } = e.data;
const { type, data, messageId } = e.data;
switch(type) {
case 'FILTER_SPOTS':
const filtered = filterSpots(data.spots, data.filters, data.watchlist);
self.postMessage({ type: 'FILTERED_SPOTS', data: filtered });
// ✅ AJOUTER messageId à la réponse
self.postMessage({ type: 'FILTERED_SPOTS', data: filtered, messageId });
break;
case 'SORT_SPOTS':
const sorted = sortSpots(data.spots, data.sortBy, data.sortOrder);
self.postMessage({ type: 'SORTED_SPOTS', data: sorted });
// ✅ AJOUTER messageId à la réponse
self.postMessage({ type: 'SORTED_SPOTS', data: sorted, messageId });
break;
default:
console.error('Unknown worker message type:', type);
}

View File

@@ -211,7 +211,9 @@
wsStatus = 'connecting';
try {
ws = new WebSocket('ws://localhost:8080/api/ws');
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHost = window.location.host; // Prend automatiquement l'IP:port depuis l'URL
ws = new WebSocket(`${wsProtocol}//${wsHost}/api/ws`);
ws.onopen = () => {
console.log('WebSocket connected');

View File

@@ -4,7 +4,6 @@
export let spotFilters;
export let spots;
export let watchlist;
export let isFiltering = false;
const dispatch = createEventDispatcher();
@@ -80,16 +79,6 @@
<div class="bg-slate-800/50 backdrop-blur rounded-lg p-2 border border-slate-700/50 mb-3">
<div class="flex items-center gap-1 flex-wrap">
<!-- ✅ AJOUTER le spinner ici -->
{#if isFiltering}
<div class="inline-flex items-center gap-2 text-xs text-blue-400 mr-3">
<svg class="animate-spin h-3 w-3" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
Filtering...
</div>
{/if}
<span class="text-xs font-bold text-slate-400 mr-2">TYPE:</span>

View File

@@ -9,7 +9,7 @@
const dispatch = createEventDispatcher();
let container;
const itemHeight = 45;
const itemHeight = 43;
function handleSpotClick(spot) {
dispatch('clickSpot', {

View File

@@ -1 +1 @@
["H44MS","5X2I","PY0FB","PY0FBS","XT2AW","ZL7IO","YJ0CA","FW5K","J38","E6AD","E51MWA","PJ6Y","5J0EA","5K0UA","VP2M","5X1XA","C5R","C5LT","EL2BG","4X6TT","V85NPV","YI1MB","C21TS","XV9","TJ1GD"]
["H44MS","5X2I","PY0FB","PY0FBS","XT2AW","ZL7IO","YJ0CA","FW5K","E6AD","E51MWA","PJ6Y","5J0EA","5K0UA","VP2M","5X1XA","C5R","C5LT","EL2BG","4X6TT","V85NPV","YI1MB","C21TS","XV9","TJ1GD","3B8M","Z66IPA","C8K","5H3MB"]