diff --git a/README.md b/README.md index c53652a..daf2caa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# (S)pothole +# ![Spothole](/webassets/img/logo.png) **Work in progress.** diff --git a/core/constants.py b/core/constants.py index 843d772..bed3313 100644 --- a/core/constants.py +++ b/core/constants.py @@ -4,9 +4,6 @@ from data.band import Band SOFTWARE_NAME = "(S)pothole by M0TRT" SOFTWARE_VERSION = "0.1" -# Sources -SOURCES = ["POTA", "SOTA", "WWFF", "GMA", "WWBOTA", "HEMA", "ParksNPeaks", "Cluster", "RBN", "APRS-IS"] - # Special Interest Groups SIGS = ["POTA", "SOTA", "WWFF", "GMA", "WWBOTA", "HEMA", "MOTA", "ARLHS", "SiOTA", "WCA"] diff --git a/data/spot.py b/data/spot.py index 944c2ce..8c3a289 100644 --- a/data/spot.py +++ b/data/spot.py @@ -182,10 +182,11 @@ class Spot: # Last resort for getting a position, use the DXCC entity. if self.dx_call and not self.latitude: latlon = infer_latlon_from_callsign_dxcc(self.dx_call) - self.latitude = latlon[0] - self.longitude = latlon[1] - self.grid = infer_grid_from_callsign_dxcc(self.dx_call) - self.location_source = "DXCC" + if latlon: + self.latitude = latlon[0] + self.longitude = latlon[1] + self.grid = infer_grid_from_callsign_dxcc(self.dx_call) + self.location_source = "DXCC" # Location is "good" if it is from a spot, or from QRZ if the callsign doesn't contain a slash, so the operator # is likely at home. diff --git a/server/webserver.py b/server/webserver.py index 49cb9cd..ef91567 100644 --- a/server/webserver.py +++ b/server/webserver.py @@ -8,7 +8,7 @@ import pytz from bottle import run, response, template from core.config import MAX_SPOT_AGE -from core.constants import BANDS, ALL_MODES, MODE_TYPES, SIGS, SOURCES, CONTINENTS +from core.constants import BANDS, ALL_MODES, MODE_TYPES, SIGS, CONTINENTS from core.utils import serialize_everything @@ -125,6 +125,7 @@ class WebServer: "modes": ALL_MODES, "mode_types": MODE_TYPES, "sigs": SIGS, - "sources": SOURCES, + # Sources are filtered for only ones that are enabled in config, no point letting the user toggle things that aren't even available. + "sources": list(map(lambda p: p["name"], filter(lambda p: p["enabled"], self.status_data["providers"]))), "continents": CONTINENTS, "max_spot_age": MAX_SPOT_AGE} diff --git a/views/webpage_home.tpl b/views/webpage_home.tpl index 41a936d..507c5c9 100644 --- a/views/webpage_home.tpl +++ b/views/webpage_home.tpl @@ -7,8 +7,8 @@

- - + +

@@ -43,7 +43,7 @@
-
+
diff --git a/webassets/css/style.css b/webassets/css/style.css index 91086f4..bed8e5b 100644 --- a/webassets/css/style.css +++ b/webassets/css/style.css @@ -55,4 +55,8 @@ div.appearing-panel { div.status-card { max-width: 18rem; +} + +p.filter-card-text { + line-height: 2.5em !important; } \ No newline at end of file diff --git a/webassets/js/code.js b/webassets/js/code.js index 7a3a363..a451715 100644 --- a/webassets/js/code.js +++ b/webassets/js/code.js @@ -58,6 +58,9 @@ function updateTable() { // Format the mode mode_string = s["mode"]; + if (s["mode"] == null) { + mode_string = "???" + } if (s["mode_source"] == "BANDPLAN") { mode_string = mode_string + "" } @@ -151,12 +154,19 @@ function loadOptions() { options = jsonData; // Separately store colour lookups for bands - options["bands"].forEach(m => { - band_colors[m["name"]] = m["color"] + options["bands"].forEach(b => { + band_colors[b["name"]] = b["color"]; }); + // Add CSS for band toggle buttons + addBandToggleButtonCSS(options["bands"]); + // Populate the filters panel - $("#filters-container").text(JSON.stringify(options)); + $("#filters-container").append(generateFilterCard("DX Continent", "dx_continent", options["continents"])); + $("#filters-container").append(generateFilterCard("DE Continent", "de_continent", options["continents"])); + $("#filters-container").append(generateFilterCard("Modes", "mode_type", options["mode_types"])); + $("#filters-container").append(generateFilterCard("Sources", "source", options["sources"])); + $("#filters-container").append(generateBandsFilterCard("Bands", "band", options["bands"])); // Load spots and set up the timer loadSpots(); @@ -164,6 +174,48 @@ function loadOptions() { }); } +// Dynamically add CSS code for the band toggle buttons to be in the appropriate colour +function addBandToggleButtonCSS(band_options) { + var $style = $('