diff --git a/ui/src/components/Metars/SkyConditions.tsx b/ui/src/components/Metars/SkyConditions.tsx
index db1dc32..b872192 100644
--- a/ui/src/components/Metars/SkyConditions.tsx
+++ b/ui/src/components/Metars/SkyConditions.tsx
@@ -1,36 +1,12 @@
'use client';
-import { Metar, SkyCondition } from '@/api/metar.types';
-import { Box } from '@mantine/core';
-import {
- Customized,
- Label,
- LabelList,
- Line,
- LineChart,
- ReferenceLine,
- ResponsiveContainer,
- XAxis,
- YAxis
-} from 'recharts';
+import { Metar } from '@/api/metar.types';
+import { Box, Text } from '@mantine/core';
+import { CartesianGrid, LabelList, Line, LineChart, XAxis, YAxis } from 'recharts';
export default function SkyConditions({ metar }: { metar: Metar }) {
- function skyConditionColor(skyCondition: SkyCondition) {
- if (skyCondition.sky_cover == 'CLR') {
- return '#FFFFFF';
- } else if (skyCondition.sky_cover == 'FEW') {
- return '#19c4e6';
- } else if (skyCondition.sky_cover == 'SCT') {
- return '#6119e6';
- } else if (skyCondition.sky_cover == 'BKN') {
- return '#e6c019';
- } else if (skyCondition.sky_cover == 'OVC') {
- return '#e68019';
- } else {
- return '#e6194b';
- }
- }
- if (metar.sky_condition && metar.sky_condition.length > 0) {
+ if (metar.sky_condition && metar.sky_condition.length > 0 && metar.sky_condition[0].sky_cover != 'CLR') {
+ let maxHeight = 5000;
const data: any = [
{
name: 'start'
@@ -42,30 +18,60 @@ export default function SkyConditions({ metar }: { metar: Metar }) {
metar.sky_condition.forEach((skyCondition, index) => {
data[0][index] = skyCondition.cloud_base_ft_agl;
data[1][index] = skyCondition.cloud_base_ft_agl;
+ if (skyCondition.cloud_base_ft_agl > maxHeight) {
+ maxHeight = skyCondition.cloud_base_ft_agl;
+ }
});
+ maxHeight = Math.ceil((maxHeight % 1000 == 0 ? maxHeight + 1 : maxHeight) / 1000) * 1000;
+ let interval;
+ if (maxHeight <= 5000) {
+ interval = 1;
+ } else if (maxHeight <= 10000) {
+ interval = 2;
+ } else if (maxHeight <= 15000) {
+ interval = 3;
+ } else if (maxHeight <= 20000) {
+ interval = 5;
+ } else {
+ interval = 10;
+ }
return (
-
- (dataMax < 1000 ? 1000 : Math.ceil(dataMax / 1000) * 1000)]} />
- {metar.sky_condition.map((skyCondition, index) => (
-
-
+ Sky Conditions
+
+
+
+
+ {metar.sky_condition.map((skyCondition, index) => (
+ renderCustomizedLabel(props, skyCondition.sky_cover)}
- />
-
- ))}
-
+ dot={false}
+ isAnimationActive={false}
+ >
+ renderCustomizedLabel(props, skyCondition.sky_cover)}
+ />
+
+ ))}
+
+
);
} else {
- return <>>;
+ return (
+
+ Sky Conditions
+ Clear
+
+ );
}
}