Implement transponder code (squawk) lookup and textual descriptions
Resolves #30 - Add comprehensive squawk code lookup database with emergency, standard, military, and special codes - Implement squawk.Database with 20+ common transponder codes including: * Emergency codes: 7700 (General Emergency), 7600 (Radio Failure), 7500 (Hijacking) * Standard codes: 1200/7000 (VFR), operational codes by region * Special codes: 1277 (SAR), 1255 (Fire Fighting), military codes - Add SquawkDescription field to Aircraft struct and JSON marshaling - Integrate squawk database into merger for automatic description population - Update frontend with color-coded squawk display and tooltips: * Red for emergency codes with warning symbols * Orange for special operations * Gray for military codes * Green for standard operational codes - Add comprehensive test coverage for squawk lookup functionality Features: - Visual emergency code identification for safety - Educational descriptions for aviation enthusiasts - Configurable lookup system for regional variations - Hover tooltips with full code explanations - Graceful fallback for unknown codes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a63d8d5cd7
commit
62ace55fe1
6 changed files with 700 additions and 3 deletions
|
|
@ -679,4 +679,62 @@ body {
|
|||
#aircraft-table td {
|
||||
padding: 0.5rem 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Squawk Code Styling */
|
||||
.squawk-emergency {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
cursor: help;
|
||||
border: 1px solid #b52532;
|
||||
}
|
||||
|
||||
.squawk-special {
|
||||
background: #fd7e14;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
cursor: help;
|
||||
border: 1px solid #e06911;
|
||||
}
|
||||
|
||||
.squawk-military {
|
||||
background: #6c757d;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
cursor: help;
|
||||
border: 1px solid #565e64;
|
||||
}
|
||||
|
||||
.squawk-standard {
|
||||
background: #28a745;
|
||||
color: white;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
cursor: help;
|
||||
border: 1px solid #1e7e34;
|
||||
}
|
||||
|
||||
/* Hover effects for squawk codes */
|
||||
.squawk-emergency:hover {
|
||||
background: #c82333;
|
||||
}
|
||||
|
||||
.squawk-special:hover {
|
||||
background: #e8590c;
|
||||
}
|
||||
|
||||
.squawk-military:hover {
|
||||
background: #5a6268;
|
||||
}
|
||||
|
||||
.squawk-standard:hover {
|
||||
background: #218838;
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ export class UIManager {
|
|||
row.innerHTML = `
|
||||
<td><span class="type-badge ${type}">${icao}</span></td>
|
||||
<td>${aircraft.Callsign || '-'}</td>
|
||||
<td>${aircraft.Squawk || '-'}</td>
|
||||
<td>${this.formatSquawk(aircraft)}</td>
|
||||
<td>${altitude ? `${altitude} ft` : '-'}</td>
|
||||
<td>${aircraft.GroundSpeed || '-'} kt</td>
|
||||
<td>${distance ? distance.toFixed(1) : '-'} km</td>
|
||||
|
|
@ -180,6 +180,33 @@ export class UIManager {
|
|||
return 'signal-poor';
|
||||
}
|
||||
|
||||
formatSquawk(aircraft) {
|
||||
if (!aircraft.Squawk) return '-';
|
||||
|
||||
// If we have a description, format it nicely
|
||||
if (aircraft.SquawkDescription) {
|
||||
// Check if it's an emergency code (contains warning emoji)
|
||||
if (aircraft.SquawkDescription.includes('⚠️')) {
|
||||
return `<span class="squawk-emergency" title="${aircraft.SquawkDescription}">${aircraft.Squawk}</span>`;
|
||||
}
|
||||
// Check if it's a special code (contains special emoji)
|
||||
else if (aircraft.SquawkDescription.includes('🔸')) {
|
||||
return `<span class="squawk-special" title="${aircraft.SquawkDescription}">${aircraft.Squawk}</span>`;
|
||||
}
|
||||
// Check if it's a military code (contains military emoji)
|
||||
else if (aircraft.SquawkDescription.includes('🔰')) {
|
||||
return `<span class="squawk-military" title="${aircraft.SquawkDescription}">${aircraft.Squawk}</span>`;
|
||||
}
|
||||
// Standard codes
|
||||
else {
|
||||
return `<span class="squawk-standard" title="${aircraft.SquawkDescription}">${aircraft.Squawk}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
// No description available, show just the code
|
||||
return aircraft.Squawk;
|
||||
}
|
||||
|
||||
updateSourceFilter() {
|
||||
const select = document.getElementById('source-filter');
|
||||
if (!select) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue