Shouldn't have been on master, but everything is still working good.

This commit is contained in:
Kira Jiroux 2025-06-09 22:43:33 -04:00
parent 5b2aafc4e5
commit ef3e432347
4 changed files with 119 additions and 58 deletions

View File

@ -20,7 +20,7 @@ namespace Portfolio.WebUI.Server.Components.Component.Crochet_Components
new() { Min = 35, Max = 42, Color = "#add8e6" }, new() { Min = 35, Max = 42, Color = "#add8e6" },
new() { Min = 42, Max = 49, Color = "#00008b" }, new() { Min = 42, Max = 49, Color = "#00008b" },
new() { Min = 49, Max = 56, Color = "#006400" }, new() { Min = 49, Max = 56, Color = "#006400" },
new() { Min = 56, Max = 63, Color = "#90ee90" }, new() { Min = 56, Max = 63, Color = "#07ed07" },
new() { Min = 63, Max = 70, Color = "#ffff00" }, new() { Min = 63, Max = 70, Color = "#ffff00" },
new() { Min = 70, Max = 77, Color = "#ffa500" }, new() { Min = 70, Max = 77, Color = "#ffa500" },
new() { Min = 77, Max = 84, Color = "#ff0000" }, new() { Min = 77, Max = 84, Color = "#ff0000" },

View File

@ -22,7 +22,7 @@
</div> </div>
<div class="tableFixHead bg-secondary table-responsive row"> <div class="tableFixHead d-flex flex-column justify-content-start bg-secondary table-responsive row">
<table class="table col table-borderless border-0 table-secondary table-striped align-middle"> <table class="table col table-borderless border-0 table-secondary table-striped align-middle">
<!-- Table Head --> <!-- Table Head -->
<thead class=""> <thead class="">
@ -46,8 +46,11 @@
else else
{ {
<!-- Table Body --> <!-- Table Body -->
<tbody> <tbody class="">
<tr></tr> <tr></tr>
@if (FilteredPokemon != null && FilteredPokemon.Any())
{
@foreach (var pokemon in FilteredPokemon) @foreach (var pokemon in FilteredPokemon)
{ {
<tr class="flex-row"> <tr class="flex-row">
@ -112,6 +115,17 @@
</tr> </tr>
} }
}
else
{
<tr>
<td colspan="100%">
<div class="d-flex justify-content-center align-items-center" style="height: 200px;">
<p class="text-muted">Pokémon could not be found.</p>
</div>
</td>
</tr>
}
</tbody> </tbody>
} }

View File

@ -20,6 +20,10 @@
z-index: 10; z-index: 10;
} }
.align-top-tbody {
vertical-align: top;
}
.pokemon-name-style { .pokemon-name-style {
cursor:pointer; cursor:pointer;
font-size: 1.3rem; font-size: 1.3rem;
@ -78,7 +82,9 @@
transform: rotateY(180deg); transform: rotateY(180deg);
} }
.fixed-row-height {
height: 90px; /* or any height that suits your card style */
}
.pokeimage { .pokeimage {

View File

@ -9,19 +9,60 @@ namespace Portfolio.WebUI.Server.Components.Pages.Crochet_Pages
public partial class CrochetHome public partial class CrochetHome
{ {
public List<TemperatureDay> temperatureDays { get; set; } public List<TemperatureDay> temperatureDays { get; set; }
public int YEAR = 2025;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
// Placeholder for loading temperature data // Placeholder for loading temperature data
// Replace with actual API call // Replace with actual API call
temperatureDays = Enumerable.Range(0, 365).Select(i => new TemperatureDay //temperatureDays = Enumerable.Range(0, 365).Select(i => new TemperatureDay
//{
// Date = new DateTime(DateTime.Now.Year - 1, 1, 1).AddDays(i),
// AvgTemp = Random.Shared.Next(10, 95)
//}).ToList();
temperatureDays = GenerateRealisticTemperatureDays(YEAR);
}
public static List<TemperatureDay> GenerateRealisticTemperatureDays(int year)
{ {
Date = new DateTime(DateTime.Now.Year - 1, 1, 1).AddDays(i), var temperatureDays = new List<TemperatureDay>();
AvgTemp = Random.Shared.Next(10, 95) var startDate = new DateTime(year, 1, 1);
}).ToList(); int daysInYear = DateTime.IsLeapYear(year) ? 366 : 365;
// Adjusted parameters for desired range
double minAvgTemp = 20.0;
double maxAvgTemp = 84.0;
double amplitude = (maxAvgTemp - minAvgTemp) / 2.0; // 32.5
double avgAnnualTemp = (maxAvgTemp + minAvgTemp) / 2.0; // 52.5
double noiseMax = 4.0; // Small daily variation
for (int i = 0; i < daysInYear; i++)
{
var date = startDate.AddDays(i);
double dayOfYearRatio = (2 * Math.PI * i) / daysInYear;
// Peak is mid-summer, trough is mid-winter
double seasonalTemp = avgAnnualTemp + amplitude * Math.Sin(dayOfYearRatio - Math.PI / 2);
// Add gentle noise
double dailyNoise = Random.Shared.NextDouble() * noiseMax * 2 - noiseMax;
// Final temperature, clamped to min/max
double finalTemp = Math.Round(seasonalTemp + dailyNoise, 1);
finalTemp = Math.Clamp(finalTemp, minAvgTemp, maxAvgTemp);
temperatureDays.Add(new TemperatureDay
{
Date = date,
AvgTemp = finalTemp
});
}
return temperatureDays;
} }
} }