From c7f025fde230fd99d885ec4235c623c8bbc89947 Mon Sep 17 00:00:00 2001 From: ofiber Date: Mon, 3 Jun 2024 15:45:36 -0400 Subject: [PATCH] -- --- Components/Layout/MainLayout.razor.css | 38 +++++--------------------- Components/Pages/Home.razor | 18 ++++++++++-- Components/Pages/Home.razor.css | 29 +++++++++++--------- Components/Pages/Results.razor.css | 27 +++++++----------- MetarParser.cs | 9 +----- 5 files changed, 50 insertions(+), 71 deletions(-) diff --git a/Components/Layout/MainLayout.razor.css b/Components/Layout/MainLayout.razor.css index 038baf1..1b6cbec 100644 --- a/Components/Layout/MainLayout.razor.css +++ b/Components/Layout/MainLayout.razor.css @@ -1,41 +1,17 @@ .page { - position: relative; - display: flex; - flex-direction: column; + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + right: 0; + bottom: 0; } main { flex: 1; } -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - -.top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - - .top-row ::deep a, .top-row ::deep .btn-link { - white-space: nowrap; - margin-left: 1.5rem; - text-decoration: none; - } - - .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { - text-decoration: underline; - } - - .top-row ::deep a:first-child { - overflow: hidden; - text-overflow: ellipsis; - } - @media (max-width: 640.98px) { .top-row { justify-content: space-between; diff --git a/Components/Pages/Home.razor b/Components/Pages/Home.razor index 754700e..659295f 100644 --- a/Components/Pages/Home.razor +++ b/Components/Pages/Home.razor @@ -32,6 +32,8 @@ private string metar; private string invalidICAO = "Invalid ICAO! Please enter a new ICAO and try again!"; + private string invalidLength = "ICAO must be 4 characters in length! Please enter a valid ICAO and try again!"; + private string noICAO = "Please enter an ICAO in the ICAO input"; protected async void AutoResize(KeyboardEventArgs e) { @@ -45,7 +47,19 @@ private void SubmitICAO() { - if(!ICAODict.icaoDict.ContainsKey(icao)) + if (string.IsNullOrEmpty(icao)) + { + Alert(noICAO); + icao = ""; + return; + } + else if (icao.Length != 4) + { + Alert(invalidLength); + icao = ""; + return; + } + else if(!ICAODict.icaoDict.ContainsKey(icao.ToUpper())) { Alert(invalidICAO); icao = ""; @@ -53,6 +67,6 @@ return; } else - navMan.NavigateTo($"Results/{icao}"); + navMan.NavigateTo($"Results/{icao.ToUpper()}"); } } \ No newline at end of file diff --git a/Components/Pages/Home.razor.css b/Components/Pages/Home.razor.css index 8cb3639..125e67a 100644 --- a/Components/Pages/Home.razor.css +++ b/Components/Pages/Home.razor.css @@ -17,11 +17,6 @@ html { min-height: 100%; } -body { - margin-bottom: 60px; - background-color: #95B8D1; -} - h1 { font-family: CommitMono; font-size: 2.5em; @@ -82,21 +77,30 @@ textarea { border: thin solid gray; } +.background { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + right: 0; + bottom: 0; +} + .icaoDiv { + position: relative; align-content: center; align-items: center; - margin-top: 90px; + position: relative; } .metarDiv { + position: relative; align-self: center; align-items: center; align-content: center; - margin-top: 130px; -} - -#resultsView { - visibility: hidden; + position: relative; + margin-top: 8%; } #mainView { @@ -141,5 +145,4 @@ button:hover { text-align: center; text-transform: uppercase; color: black; -} - +} \ No newline at end of file diff --git a/Components/Pages/Results.razor.css b/Components/Pages/Results.razor.css index bfebda6..4749f54 100644 --- a/Components/Pages/Results.razor.css +++ b/Components/Pages/Results.razor.css @@ -17,19 +17,6 @@ textarea { font-weight: bolder; } -p { - display: block; - font-family: CommitMono; - font-size: 1.5em; - font-weight: bold; - text-align: center; - text-transform: uppercase; - color: #333333; - margin-left: auto; - margin-right: auto; - margin-top: 25%; -} - button { cursor: pointer; align-self: center; @@ -45,17 +32,23 @@ button { background-color: #666A86; } -.backBtn{ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.backBtn { position: absolute; - right: 160px; - bottom: -200px; + margin-top: 52%; } .results { display: block; margin-left: auto; margin-right: auto; - transform: translate(0%, 20%); + transform: translate(0%, 12%); background-color: lightslategray; border: thin solid gray; border-radius: 5px; diff --git a/MetarParser.cs b/MetarParser.cs index 614303f..250136c 100644 --- a/MetarParser.cs +++ b/MetarParser.cs @@ -641,8 +641,6 @@ private static void GetSeaLevelPressure(Regex sea_level_pressure_regex, string m decodedMetar.AppendLine("Sea Level Pressure: " + hpa + " hPa"); } - - } private static void GetWeather(out MatchCollection matches, string metar, Regex remarks_regex, Regex weather_regex, Dictionary weatherMap) @@ -840,12 +838,7 @@ private static void GetNoSig(out MatchCollection matches, string metar, Regex no } public static string GetEncodedMetarAsString() { return encodedMetar.ToString(); } - public static string GetDecodedMetarAsString() - { - Console.WriteLine(decodedMetar.ToString()); - return decodedMetar.ToString(); - } - + public static string GetDecodedMetarAsString() { return decodedMetar.ToString(); } public static void ResetMetarStrings() { decodedMetar.Clear(); encodedMetar.Clear(); } } } \ No newline at end of file