mirror of
https://github.com/marcominerva/SqlDatabaseVectorSearch.git
synced 2026-06-20 12:23:10 +00:00
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:
@@ -2,7 +2,9 @@
|
||||
|
||||
<BlazorBootstrapLayout StickyHeader="true">
|
||||
<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>
|
||||
|
||||
<SidebarSection>
|
||||
@@ -40,9 +42,8 @@
|
||||
{
|
||||
navItems = [
|
||||
new() { Id = "1", Href = "/", IconName = IconName.HouseDoorFill, Text = "Home", Match = NavLinkMatch.All},
|
||||
new() { Id = "2", Href = "/counter", IconName = IconName.PlusSquareFill, Text = "Counter"},
|
||||
new() { Id = "3", Href = "/weather", IconName = IconName.Table, Text = "Weather"},
|
||||
new() { Id = "4", Href= "/documents", IconName = IconName.FileText, Text = "Documents" }
|
||||
new() { Id = "2", Href = "/ask", IconName = IconName.ChatDots, Text = "Ask"},
|
||||
new() { Id = "3", Href= "/documents", IconName = IconName.FileText, Text = "Documents" }
|
||||
];
|
||||
|
||||
return navItems;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
The page you're looking for does not exists.
|
||||
</p>
|
||||
}
|
||||
else
|
||||
else if (Code > 0)
|
||||
{
|
||||
<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>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,10 +36,4 @@
|
||||
[Parameter]
|
||||
[SupplyParameterFromQuery(Name = "code")]
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user