full frontend refactor

This commit is contained in:
2026-01-25 10:26:23 +01:00
parent 317ee96ba3
commit 559a4c3e9f
18 changed files with 2803 additions and 1224 deletions

View File

@@ -185,6 +185,8 @@ defmodule MoundHunters.Repo do
def update_tile_availability do
tile_dir = Application.get_env(:mound_hunters, :tile_output_dir)
mound_dir = Path.join(tile_dir, "MOUND")
png_dir = Path.join(tile_dir, "PNG")
jpg_dir = Path.join(tile_dir, "JPG")
Logger.info("Scanning tile availability in: #{mound_dir}")
@@ -199,8 +201,8 @@ defmodule MoundHunters.Repo do
tile = tile_to_map(tile_record)
tile_id = tile.id
jpg_path = Path.join(mound_dir, "#{tile_id}.jpg")
png_path = Path.join(mound_dir, "#{tile_id}.png")
jpg_path = Path.join(jpg_dir, "#{tile_id}.jpg")
png_path = Path.join(png_dir, "#{tile_id}.png")
jpg_available = File.exists?(jpg_path)
png_available = File.exists?(png_path)
@@ -263,10 +265,13 @@ defmodule MoundHunters.Repo do
case MoundHunters.MoundParser.parse_header(file_path) do
{:ok, header} ->
# Convert Web Mercator coordinates to lat/lng
min_lng = header.min_x
max_lng = header.max_x
min_lat = header.min_y
max_lat = header.max_y
bounds =
MoundHunters.MoundParser.bounds_web_mercator_to_latlon(%{
min_x: header.min_x,
max_x: header.max_x,
min_y: header.min_y,
max_y: header.max_y
})
# Check for jpg and png availability
tile_dir = Application.get_env(:mound_hunters, :tile_output_dir)
@@ -276,10 +281,10 @@ defmodule MoundHunters.Repo do
attrs = %{
id: tile_id,
min_lat: min_lat,
max_lat: max_lat,
min_lng: min_lng,
max_lng: max_lng,
min_lat: bounds.min_lat,
max_lat: bounds.max_lat,
min_lng: bounds.min_lng,
max_lng: bounds.max_lng,
status: :ready,
error_message: nil,
jpg_available: jpg_available,