Cleanup, refactored, various changes
This commit is contained in:
@@ -39,7 +39,6 @@ export default function AirportTablePanel({ setAirport }: { setAirport: (airport
|
||||
<Table.Td>{airport.icao}</Table.Td>
|
||||
<Table.Td>{airport.full_name}</Table.Td>
|
||||
<Table.Td>{airportCategoryToText(airport.category)}</Table.Td>
|
||||
<Table.Td>{airport.continent}</Table.Td>
|
||||
<Table.Td>{airport.iso_country}</Table.Td>
|
||||
<Table.Td>{airport.iso_region}</Table.Td>
|
||||
<Table.Td>{airport.municipality}</Table.Td>
|
||||
@@ -64,7 +63,6 @@ export default function AirportTablePanel({ setAirport }: { setAirport: (airport
|
||||
<Table.Th>ICAO</Table.Th>
|
||||
<Table.Th>Full Name</Table.Th>
|
||||
<Table.Th>Category</Table.Th>
|
||||
<Table.Th>Continent</Table.Th>
|
||||
<Table.Th>ISO Country</Table.Th>
|
||||
<Table.Th>ISO Region</Table.Th>
|
||||
<Table.Th>Municipality</Table.Th>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { createAirport } from "@/api/airport";
|
||||
import { Airport, AirportCategory } from "@/api/airport.types";
|
||||
import { Card, TextInput, Select, Group, Flex, Space, Button } from "@mantine/core";
|
||||
import { useForm } from "@mantine/form";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function CreateAirportPanel() {
|
||||
const form = useForm<Airport>({
|
||||
@@ -11,7 +10,6 @@ export default function CreateAirportPanel() {
|
||||
category: AirportCategory.SMALL,
|
||||
full_name: '',
|
||||
elevation_ft: 0,
|
||||
continent: '',
|
||||
iso_country: '',
|
||||
iso_region: '',
|
||||
municipality: '',
|
||||
@@ -64,12 +62,6 @@ export default function CreateAirportPanel() {
|
||||
{...form.getInputProps('elevation_ft')}
|
||||
/>
|
||||
<Group>
|
||||
<TextInput
|
||||
required
|
||||
label='Continent'
|
||||
placeholder='NA'
|
||||
{...form.getInputProps('continent')}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
label='ISO Country'
|
||||
@@ -82,13 +74,13 @@ export default function CreateAirportPanel() {
|
||||
placeholder='US-VA'
|
||||
{...form.getInputProps('iso_region')}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
label='Municipality'
|
||||
placeholder='Manassas'
|
||||
{...form.getInputProps('municipality')}
|
||||
/>
|
||||
</Group>
|
||||
<TextInput
|
||||
required
|
||||
label='Municipality'
|
||||
placeholder='Manassas'
|
||||
{...form.getInputProps('municipality')}
|
||||
/>
|
||||
<Group>
|
||||
<TextInput
|
||||
required
|
||||
|
||||
@@ -11,7 +11,6 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
|
||||
category: airport?.category || AirportCategory.SMALL,
|
||||
full_name: airport?.full_name || '',
|
||||
elevation_ft: airport?.elevation_ft || 0,
|
||||
continent: airport?.continent || '',
|
||||
iso_country: airport?.iso_country || '',
|
||||
iso_region: airport?.iso_region || '',
|
||||
municipality: airport?.municipality || '',
|
||||
@@ -73,12 +72,6 @@ export default function UpdateAirportModal({ airport, setAirport }: { airport: A
|
||||
{...form.getInputProps('elevation_ft')}
|
||||
/>
|
||||
<Group>
|
||||
<TextInput
|
||||
required
|
||||
label='Continent'
|
||||
placeholder='NA'
|
||||
{...form.getInputProps('continent')}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
label='ISO Country'
|
||||
|
||||
@@ -62,7 +62,7 @@ export default function MapTiles() {
|
||||
metars.forEach((metar) => {
|
||||
airportData.forEach((airport) => {
|
||||
if (metar.station_id == airport.icao) {
|
||||
airport.metar = metar;
|
||||
airport.latest_metar = metar;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -82,16 +82,18 @@ export default function MapTiles() {
|
||||
className: 'metar-marker-icon'
|
||||
});
|
||||
}
|
||||
if (airport.metar?.flight_category == 'VFR') {
|
||||
if (airport.latest_metar?.flight_category == 'VFR') {
|
||||
return innerIcon({ tag: 'V', color: 'green' });
|
||||
} else if (airport.metar?.flight_category == 'MVFR') {
|
||||
} else if (airport.latest_metar?.flight_category == 'MVFR') {
|
||||
return innerIcon({ tag: 'M', color: 'blue' });
|
||||
} else if (airport.metar?.flight_category == 'IFR') {
|
||||
} else if (airport.latest_metar?.flight_category == 'IFR') {
|
||||
return innerIcon({ tag: 'I', color: 'red' });
|
||||
} else if (airport.metar?.flight_category == 'LIFR') {
|
||||
} else if (airport.latest_metar?.flight_category == 'LIFR') {
|
||||
return innerIcon({ tag: 'L', color: 'purple' });
|
||||
} else {
|
||||
} else if (airport.latest_metar?.flight_category == 'UNKN') {
|
||||
return innerIcon({ tag: 'U', color: 'black', size: 'xs' });
|
||||
} else {
|
||||
return innerIcon({tag: ' ', color: 'black', size: 'xs' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function MetarModal({ airport, isOpen, onClose }: MetarModalProps
|
||||
</span>
|
||||
<div className='min-w-0 flex-1'>
|
||||
<Divider style={{ paddingTop: '0.1em' }} />
|
||||
{airport.metar && <MetarInfo metar={airport.metar} />}
|
||||
{airport.latest_metar && <MetarInfo metar={airport.latest_metar} />}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
@@ -164,8 +164,8 @@ function MetarInfo({ metar }: { metar: Metar }) {
|
||||
</Grid.Col>
|
||||
<Grid.Col className='gutter-row' span={12}>
|
||||
<Grid style={{ paddingTop: '1em', paddingBottom: '1em' }} gutter={48}>
|
||||
{metar.wx_string &&
|
||||
metar.wx_string.split(' ').map((wx) => (
|
||||
{metar.weather_phenomena &&
|
||||
metar.weather_phenomena.map((wx) => (
|
||||
<Grid.Col span={1}>
|
||||
<MetarIcon wx={wx} />
|
||||
</Grid.Col>
|
||||
|
||||
Reference in New Issue
Block a user