Refactor layout and remove unused components

Updated `MainLayout.razor` to include a GitHub link and modified sidebar navigation. Removed `Counter.razor` and integrated its functionality into `Ask.razor`. Enhanced error handling in `Error.razor` and removed request ID display. Deleted `Weather.razor` and its associated content.
This commit is contained in:
Marco Minerva
2025-02-18 17:54:34 +01:00
parent f0cccb00b9
commit 9c19b4ec73
4 changed files with 10 additions and 85 deletions
@@ -2,15 +2,17 @@
<BlazorBootstrapLayout StickyHeader="true"> <BlazorBootstrapLayout StickyHeader="true">
<HeaderSection> <HeaderSection>
<ThemeSwitcher Class="ps-3 ps-lg-2" Position="DropdownMenuPosition.End" /> <a href="https://github.com/marcominerva/SqlDatabaseVectorSearch" target="_blank" class="text-decoration-none" title="View on GitHub">
<Icon Name="IconName.Github" Class="ps-3 ps-lg-2" Size="IconSize.x2" Color="IconColor.Muted"></Icon>
</a>
</HeaderSection> </HeaderSection>
<SidebarSection> <SidebarSection>
<Sidebar2 Href="/" <Sidebar2 Href="/"
IconName="IconName.Search" IconName="IconName.Search"
Title="SQL Vector Search" Title="SQL Vector Search"
DataProvider="Sidebar2DataProvider" DataProvider="Sidebar2DataProvider"
WidthUnit="Unit.Px" /> WidthUnit="Unit.Px" />
</SidebarSection> </SidebarSection>
<ContentSection> <ContentSection>
@@ -40,9 +42,8 @@
{ {
navItems = [ navItems = [
new() { Id = "1", Href = "/", IconName = IconName.HouseDoorFill, Text = "Home", Match = NavLinkMatch.All}, new() { Id = "1", Href = "/", IconName = IconName.HouseDoorFill, Text = "Home", Match = NavLinkMatch.All},
new() { Id = "2", Href = "/counter", IconName = IconName.PlusSquareFill, Text = "Counter"}, new() { Id = "2", Href = "/ask", IconName = IconName.ChatDots, Text = "Ask"},
new() { Id = "3", Href = "/weather", IconName = IconName.Table, Text = "Weather"}, new() { Id = "3", Href= "/documents", IconName = IconName.FileText, Text = "Documents" }
new() { Id = "4", Href= "/documents", IconName = IconName.FileText, Text = "Documents" }
]; ];
return navItems; return navItems;
@@ -14,7 +14,7 @@
The page you're looking for does not exists. The page you're looking for does not exists.
</p> </p>
} }
else else if (Code > 0)
{ {
<PageTitle>Unexpected Error</PageTitle> <PageTitle>Unexpected Error</PageTitle>
@@ -26,13 +26,6 @@
} }
<a title="Back to Home" href="/" class="btn btn-primary"><i class="bi bi-house-door-fill"></i> Back to Home</a> <a title="Back to Home" href="/" class="btn btn-primary"><i class="bi bi-house-door-fill"></i> Back to Home</a>
@if (ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@RequestId</code>
</p>
}
</div> </div>
</div> </div>
@@ -43,10 +36,4 @@
[Parameter] [Parameter]
[SupplyParameterFromQuery(Name = "code")] [SupplyParameterFromQuery(Name = "code")]
public int Code { get; set; } public int Code { get; set; }
private string? RequestId { get; set; }
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
} }
@@ -1,63 +0,0 @@
@page "/weather"
<PageTitle>Weather</PageTitle>
<h1>Weather</h1>
<p>This component demonstrates showing data.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th aria-label="Temperature in Celsius">Temp. (C)</th>
<th aria-label="Temperature in Farenheit">Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
// Simulate asynchronous loading to demonstrate a loading indicator
await Task.Delay(500);
var startDate = DateOnly.FromDateTime(DateTime.Now);
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = summaries[Random.Shared.Next(summaries.Length)]
}).ToArray();
}
private class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}