🎉 Added files
This commit is contained in:
42
Pages/Error.cshtml
Normal file
42
Pages/Error.cshtml
Normal file
@ -0,0 +1,42 @@
|
||||
@page
|
||||
@model ErrorModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>Error</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
25
Pages/Error.cshtml.cs
Normal file
25
Pages/Error.cshtml.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
private readonly ILogger<ErrorModel> _logger;
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
}
|
12
Pages/Index.razor
Normal file
12
Pages/Index.razor
Normal file
@ -0,0 +1,12 @@
|
||||
@using The_Metaverse_Engine.Services
|
||||
@using Raven.Client.Documents.Session
|
||||
@page "/"
|
||||
@inject IDocumentSession Session
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
63
Pages/Shared/FluentSelectEnum.razor
Normal file
63
Pages/Shared/FluentSelectEnum.razor
Normal file
@ -0,0 +1,63 @@
|
||||
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
|
||||
@typeparam TEnum where TEnum : struct, Enum
|
||||
<FluentSelect
|
||||
TOption="Option<int>"
|
||||
Items="_enumOptions"
|
||||
Label="@Label"
|
||||
OptionText="@(i => i.Text)"
|
||||
OptionValue="@(i => i.Value.ToString())"
|
||||
OptionSelected="@(i => i.Selected)"
|
||||
@bind-Value="_selectedValue"
|
||||
Placeholder="@Placeholder"
|
||||
AdditionalAttributes="@AdditionalAttributes"
|
||||
/>
|
||||
@code {
|
||||
[Parameter] public TEnum? EnumSelectedValue { get; set; }
|
||||
[Parameter] public EventCallback<TEnum?> EnumSelectedValueChanged { get; set; }
|
||||
[Parameter] public TEnum[] ExcludeEnumItems { get; set; } = [];
|
||||
[Parameter] public string? Placeholder { get; set; }
|
||||
[Parameter] public string? Label { get; set; }
|
||||
[Parameter(CaptureUnmatchedValues = true)]
|
||||
public Dictionary<string, object> AdditionalAttributes { get; set; } = new();
|
||||
|
||||
private List<Option<int>> _enumOptions = [];
|
||||
private string? _selectedValue
|
||||
{
|
||||
get { return _enumOptions.FirstOrDefault(e => e.Value.Equals(GetEnumInt(EnumSelectedValue)))?.Value.ToString(); }
|
||||
set
|
||||
{
|
||||
if (value is null || !Enum.TryParse<TEnum>(value, out var result)) return;
|
||||
EnumSelectedValue = result;
|
||||
EnumSelectedValueChanged.InvokeAsync(result);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (!typeof(TEnum).IsEnum)
|
||||
{
|
||||
throw new InvalidOperationException($"{typeof(TEnum).Name} is not an enum type");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
_enumOptions = Enum.GetValues(typeof(TEnum))
|
||||
.Cast<TEnum>()
|
||||
.Where(e => !ExcludeEnumItems.Contains(e))
|
||||
.Select(e => new Option<int>
|
||||
{
|
||||
Value = GetEnumInt(e).GetValueOrDefault(),
|
||||
Text = e.GetDescription(false),
|
||||
Selected = e.Equals(EnumSelectedValue)
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private static int? GetEnumInt(TEnum? value)
|
||||
{
|
||||
if (!typeof(TEnum).IsEnum || value is null)
|
||||
return null;
|
||||
return (int)Convert.ChangeType(value, typeof(TEnum));
|
||||
}
|
||||
}
|
12
Pages/Shared/LoginDisplay.razor
Normal file
12
Pages/Shared/LoginDisplay.razor
Normal file
@ -0,0 +1,12 @@
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<a style="padding: 2em; color: aliceblue;" href="Identity/Account/Manage">Hello,
|
||||
@context.User.Identity?.Name</a>
|
||||
<form method="post" action="Identity/Account/Logout">
|
||||
<FluentButton Type="ButtonType.Submit" Appearance="Appearance.Lightweight">Log out</FluentButton>
|
||||
</form>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<a href="Identity/Account/Login">Log in</a>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
23
Pages/Shared/MainLayout.razor
Normal file
23
Pages/Shared/MainLayout.razor
Normal file
@ -0,0 +1,23 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<PageTitle>The-Metaverse-Engine</PageTitle>
|
||||
|
||||
|
||||
<FluentMainLayout NavMenuTitle="Navigation menu">
|
||||
<Header>
|
||||
<h2 style="margin: 0.4em;">The-Metaverse-Engine</h2>
|
||||
<FluentSpacer />
|
||||
<LoginDisplay />
|
||||
</Header>
|
||||
|
||||
<Body>
|
||||
<FluentMessageBarProvider Section="MESSAGES_TOP" />
|
||||
@Body
|
||||
</Body>
|
||||
<NavMenuContent>
|
||||
<NavMenu />
|
||||
</NavMenuContent>
|
||||
|
||||
</FluentMainLayout>
|
||||
<FluentToastProvider MaxToastCount="10" />
|
||||
<FluentDialogProvider />
|
0
Pages/Shared/MainLayout.razor.css
Normal file
0
Pages/Shared/MainLayout.razor.css
Normal file
8
Pages/Shared/NavMenu.razor
Normal file
8
Pages/Shared/NavMenu.razor
Normal file
@ -0,0 +1,8 @@
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.Home())" Href="/" Match="NavLinkMatch.All">Home</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="apikeys">ApiKeys</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="heats">Heats</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="challenges">Challenges</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="final">Final</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="players">Players</FluentNavLink>
|
||||
<FluentNavLink Icon="@(new Icons.Regular.Size24.VehicleCarCollision())" Href="dangerzone">Danger zone</FluentNavLink>
|
||||
|
5
Pages/Shared/NavMenu.razor.css
Normal file
5
Pages/Shared/NavMenu.razor.css
Normal file
@ -0,0 +1,5 @@
|
||||
.navmenu {
|
||||
background: var(--neutral-layer-3);
|
||||
display: flex;
|
||||
padding: 10px;
|
||||
}
|
28
Pages/Shared/_LoginPartial.cshtml
Normal file
28
Pages/Shared/_LoginPartial.cshtml
Normal file
@ -0,0 +1,28 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<AppUser> SignInManager
|
||||
@inject UserManager<AppUser> UserManager
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<ul class="navbar-nav">
|
||||
@if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello
|
||||
@User.Identity?.Name!</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="/" method="post">
|
||||
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
50
Pages/_Host.cshtml
Normal file
50
Pages/_Host.cshtml
Normal file
@ -0,0 +1,50 @@
|
||||
@page "/"
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using The_Metaverse_Engine
|
||||
@namespace The_Metaverse_Engine.Dashboard.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<base href="~/" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
<link href="The-Metaverse-Engine.styles.css" rel="stylesheet" />
|
||||
<link href="_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css" rel="stylesheet" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
|
||||
<script app-name="The-Metaverse-Engine"
|
||||
src="./_content/Microsoft.FluentUI.AspNetCore.Components/js/initializersLoader.webview.js"></script>
|
||||
<script src="js/Sortable.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
<environment include="Staging,Production">
|
||||
An error has occurred. This application may no longer respond until reloaded.
|
||||
</environment>
|
||||
<environment include="Development">
|
||||
An unhandled exception has occurred. See browser dev tools for details.
|
||||
</environment>
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
|
||||
<script>
|
||||
window.copyToClipboard = (data) => {
|
||||
console.log(data)
|
||||
navigator.clipboard.writeText(data);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user