Use single page for all views

main
ilitirit 3 years ago
parent 06fc11752e
commit 5f37b6ff46

@ -1,55 +0,0 @@
@page
@model DeepDungeonsModel
@{
ViewData["Title"] = "Expedience";
}
@section scripts {
<script type="text/javascript">
$(document).ready(function () {
$("#deepDungeonTableDiv").removeAttr("style");
});
function durationSorter(a, b) {
const firstIsEmpty = a === null || a === undefined || a === "";
const secondIsEmpty = b === null || b === undefined || b === "";
const sortOrder = $("#deepDungeonTable").bootstrapTable("getOptions").sortOrder;
const modifier = sortOrder === "asc" ? 1 : -1
if (firstIsEmpty) {
return 1 * modifier;
}
if (secondIsEmpty) {
return -1 * modifier;
}
return a.localeCompare(b);
}
</script>
}
<div class="text-center" id="mainDiv">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<button class="nav-link active" id="nav-potd-tab" data-bs-toggle="tab" data-bs-target="#nav-potd" type="button" role="tab" aria-controls="nav-home" aria-selected="true">The Palace of the Dead</button>
<button class="nav-link" id="nav-hoh-tab" data-bs-toggle="tab" data-bs-target="#nav-hoh" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Heaven-on-High</button>
<button class="nav-link" id="nav-eo-tab" data-bs-toggle="tab" data-bs-target="#nav-eo" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Eureka Orbos</button>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-potd" role="tabpanel" aria-labelledby="nav-potd-tab">
<div id="deepDungeonTableDiv" style="display:none;">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "The Palace of the Dead"))
</div>
</div>
<div class="tab-pane fade" id="nav-hoh" role="tabpanel" aria-labelledby="nav-hoh-tab">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "Heaven-on-High"))
</div>
<div class="tab-pane fade" id="nav-eo" role="tabpanel" aria-labelledby="nav-eo-tab">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "Eureka Orthos"))
</div>
</div>
</div>

@ -1,24 +0,0 @@
using System;
using Expedience.Infrastructure.Models;
using Expedience.Web.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Expedience.Web.Pages
{
public class DeepDungeonsModel : PageModel
{
private readonly IApiService _apiService;
public List<DeepDungeonRecord>? DeepDungeonRecords { get; private set; }
public DeepDungeonsModel(IApiService apiService)
{
_apiService = apiService;
}
public async Task OnGet(CancellationToken cancellationToken)
{
DeepDungeonRecords = await _apiService.GetDeepDungeonRecordsAsync(cancellationToken);
}
}
}

@ -31,7 +31,8 @@
}
<div class="text-center" id="mainDiv">
@if (Model.DutyCompletionRecords != null)
{
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<button class="nav-link active" id="nav-dungeons-tab" data-bs-toggle="tab" data-bs-target="#nav-dungeons" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Dungeons</button>
@ -42,6 +43,7 @@
<button class="nav-link" id="nav-exploration-raids-tab" data-bs-toggle="tab" data-bs-target="#nav-exploration-raids" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Exploration Raids</button>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-dungeons" role="tabpanel" aria-labelledby="nav-dungeons-tab">
<div id="dutyTableDiv" style="display:none;">
@ -64,5 +66,28 @@
@await Html.PartialAsync("_DutyTable", Model.DutyCompletionRecords!.Where(r => r.ContentType == "Exploration"))
</div>
</div>
}
else
{
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<button class="nav-link active" id="nav-potd-tab" data-bs-toggle="tab" data-bs-target="#nav-potd" type="button" role="tab" aria-controls="nav-home" aria-selected="true">The Palace of the Dead</button>
<button class="nav-link" id="nav-hoh-tab" data-bs-toggle="tab" data-bs-target="#nav-hoh" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Heaven-on-High</button>
<button class="nav-link" id="nav-eo-tab" data-bs-toggle="tab" data-bs-target="#nav-eo" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Eureka Orbos</button>
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-potd" role="tabpanel" aria-labelledby="nav-potd-tab">
<div id="dutyTableDiv" style="display:none;">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "The Palace of the Dead"))
</div>
</div>
<div class="tab-pane fade" id="nav-hoh" role="tabpanel" aria-labelledby="nav-hoh-tab">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "Heaven-on-High"))
</div>
<div class="tab-pane fade" id="nav-eo" role="tabpanel" aria-labelledby="nav-eo-tab">
@await Html.PartialAsync("_DeepDungeonTable", Model.DeepDungeonRecords!.Where(r => r.DeepDungeon == "Eureka Orthos"))
</div>
</div>
}
</div>

@ -1,9 +1,7 @@
using Expedience.Infrastructure;
using System;
using Expedience.Infrastructure.Models;
using Expedience.Web.Services;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Diagnostics;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Expedience.Web.Pages
{
@ -12,6 +10,7 @@ namespace Expedience.Web.Pages
private readonly IApiService _apiService;
public List<DutyCompletionRecord>? DutyCompletionRecords { get; private set; }
public List<DeepDungeonRecord>? DeepDungeonRecords { get; private set; }
public IndexModel(IApiService apiService)
{
@ -22,7 +21,17 @@ namespace Expedience.Web.Pages
{
if (expac == null) expac = "EW";
if (expac == "DeepDungeons")
{
DutyCompletionRecords = null;
DeepDungeonRecords = await _apiService.GetDeepDungeonRecordsAsync(cancellationToken);
}
else
{
DutyCompletionRecords = await _apiService.GetDutyCompletionRecordsAsync(expac, cancellationToken);
DeepDungeonRecords = null;
}
}
}
}

@ -27,22 +27,22 @@
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/EW" || Accessor.HttpContext.Request.Path.Value == "/"? "dark" : "muted")" asp-area="" asp-page="/Index" asp-route-expac="EW">Endwalker</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/EW" || Accessor.HttpContext.Request.Path.Value == "/"? "dark" : "muted")" asp-area="" asp-route-expac="EW">Endwalker</a>
</li>
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/ShB" ? "dark" : "muted")" asp-area="" asp-page="/Index" asp-route-expac="ShB">Shadowbringers</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/ShB" ? "dark" : "muted")" asp-area="" asp-route-expac="ShB">Shadowbringers</a>
</li>
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/StB" ? "dark" : "muted")" asp-area="" asp-page="/Index" asp-route-expac="StB">Stormblood</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/StB" ? "dark" : "muted")" asp-area="" asp-route-expac="StB">Stormblood</a>
</li>
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/HW" ? "dark" : "muted")" asp-area="" asp-page="/Index" asp-route-expac="HW">Heavensward</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/HW" ? "dark" : "muted")" asp-area="" asp-route-expac="HW">Heavensward</a>
</li>
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/ARR" ? "dark" : "muted")" asp-area="" asp-page="/Index" asp-route-expac="ARR">A Realm Reborn</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/ARR" ? "dark" : "muted")" asp-area="" asp-route-expac="ARR">A Realm Reborn</a>
</li>
<li class="nav-item">
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/DeepDungeons" ? "dark" : "muted")" asp-page="/DeepDungeons">Deep Dungeons</a>
<a class="nav-link text-@(Accessor.HttpContext.Request.Path.Value == "/DeepDungeons" ? "dark" : "muted")" asp-area="" asp-route-expac="DeepDungeons">Deep Dungeons</a>
</li>
</ul>
</div>

@ -4,7 +4,7 @@
@model IEnumerable<DeepDungeonRecord>
}
<table id="deepDungeonTable" data-toggle="table">
<table id="dutyTable" data-toggle="table">
<thead>
<tr>
<th></th>

@ -6,5 +6,5 @@
"Microsoft.AspNetCore": "Debug"
}
},
"BaseApiUrl": "https://localhost:7033"
"BaseApiUrl": "https://expedience-api.ilitirit.net"
}

Loading…
Cancel
Save