End of first TP

master
Lilian BRETON 3 years ago
parent 2afa54f20b
commit d9988ff396

@ -6,4 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap" Version="1.1.2" />
<PackageReference Include="Blazorise.DataGrid" Version="1.1.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.1.2" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,15 @@
namespace BlazorApp.Models
{
public class Item
{
public int Id { get; set; }
public string DisplayName { get; set; }
public string Name { get; set; }
public int StackSize { get; set; }
public int MaxDurability { get; set; }
public List<string> EnchantCategories { get; set; }
public List<string> RepairWith { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime? UpdatedDate { get; set; }
}
}

@ -0,0 +1,29 @@
@page "/episodes"
@layout MainLayout
<body>
<div id="app">
<header>
<h1>Doctor Who&trade; Episode Database</h1>
</header>
<nav>
<a href="main-list">Main Episode List</a>
<a href="search">Search</a>
<a href="new">Add Episode</a>
</nav>
<h2>Episodes</h2>
<ul>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
<footer>
Doctor Who is a registered trademark of the BBC.
https://www.doctorwho.tv/
</footer>
</div>
</body>

@ -0,0 +1,25 @@
@page "/list"
@using BlazorApp.Models;
<h3>List</h3>
<DataGrid TItem="Item"
Data="@items"
PageSize="int.MaxValue"
Responsive>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" />
<DataGridColumn TItem="Item" Field="@nameof(Item.DisplayName)" Caption="Display name" />
<DataGridColumn TItem="Item" Field="@nameof(Item.StackSize)" Caption="Stack size" />
<DataGridColumn TItem="Item" Field="@nameof(Item.MaxDurability)" Caption="Maximum durability" />
<DataGridColumn TItem="Item" Field="@nameof(Item.EnchantCategories)" Caption="Enchant categories">
<DisplayTemplate>
@(string.Join(", ", ((Item)context).EnchantCategories))
</DisplayTemplate>
</DataGridColumn>
<DataGridColumn TItem="Item" Field="@nameof(Item.RepairWith)" Caption="Repair with">
<DisplayTemplate>
@(string.Join(", ", ((Item)context).RepairWith))
</DisplayTemplate>
</DataGridColumn>
<DataGridColumn TItem="Item" Field="@nameof(Item.CreatedDate)" Caption="Created date" DisplayFormat="{0:d}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" />
</DataGrid>

@ -0,0 +1,21 @@
using BlazorApp.Models;
using Microsoft.AspNetCore.Components;
namespace BlazorApp.Pages
{
public partial class List
{
private Item[] items;
[Inject]
public HttpClient Http { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
protected override async Task OnInitializedAsync()
{
items = await Http.GetFromJsonAsync<Item[]>($"{NavigationManager.BaseUri}fake-data.json");
}
}
}

@ -28,5 +28,10 @@
</div> </div>
<script src="_framework/blazor.server.js"></script> <script src="_framework/blazor.server.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css">
<link href="_content/Blazorise/blazorise.css" rel="stylesheet" />
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
</body> </body>
</html> </html>

@ -1,4 +1,7 @@
using BlazorApp.Data; using BlazorApp.Data;
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
@ -9,6 +12,13 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor(); builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>(); builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddHttpClient();
builder.Services
.AddBlazorise()
.AddBootstrapProviders()
.AddFontAwesomeIcons();
var app = builder.Build(); var app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
@ -28,4 +38,4 @@ app.UseRouting();
app.MapBlazorHub(); app.MapBlazorHub();
app.MapFallbackToPage("/_Host"); app.MapFallbackToPage("/_Host");
app.Run(); app.Run();

@ -0,0 +1,19 @@
@inherits LayoutComponentBase
<PageTitle>BlazorApp</PageTitle>
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<main>
<div class="top-row px-4">
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>
<article class="content px-4">
@Body
</article>
</main>
</div>

@ -0,0 +1,26 @@
<h3>MyLayout</h3>
@inherits LayoutComponentBase
<header>
<h1>Doctor Who&trade; Episode Database</h1>
</header>
<nav>
<a href="masterlist">Master Episode List</a>
<a href="search">Search</a>
<a href="new">Add Episode</a>
</nav>
@Body
<footer>
@TrademarkMessage
</footer>
@code {
public string TrademarkMessage { get; set; } =
"Doctor Who is a registered trademark of the BBC. " +
"https://www.doctorwho.tv/";
}

@ -9,6 +9,16 @@
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu"> <div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<nav class="flex-column"> <nav class="flex-column">
<li class="nav-item px-3">
<NavLink class="nav-link" href="episodes">
<span class="oi oi-list-rich" aria-hidden="true"></span> Episodes
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="list">
<span class="oi oi-list-rich" aria-hidden="true"></span> List
</NavLink>
</li>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home <span class="oi oi-home" aria-hidden="true"></span> Home

@ -8,3 +8,5 @@
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using BlazorApp @using BlazorApp
@using BlazorApp.Shared @using BlazorApp.Shared
@using Blazorise.DataGrid

@ -0,0 +1,325 @@
[
{
"id": 1,
"displayname": "Xplor",
"name": "xplor",
"stacksize": 15,
"maxdurability": 23,
"enchantcategories": [
"armor_head",
"digger",
"weapon"
],
"repairwith": [
"oak_planks",
"warped_planks"
],
"createddate": "2014-07-10",
"updateddate": null
},
{
"id": 2,
"displayname": "Wazzu",
"name": "wazzu",
"stacksize": 7,
"maxdurability": 36,
"enchantcategories": [],
"repairwith": [],
"createddate": "2022-10-10",
"updateddate": null
},
{
"id": 3,
"displayname": "Pawnagra",
"name": "pawnagra",
"stacksize": 61,
"maxdurability": 118,
"enchantcategories": [
"vanishable",
"breakable"
],
"repairwith": [],
"createddate": "2020-04-28",
"updateddate": null
},
{
"id": 4,
"displayname": "Sensate",
"name": "sensate",
"stacksize": 15,
"maxdurability": 110,
"enchantcategories": [
"vanishable"
],
"repairwith": [
"warped_planks"
],
"createddate": "2021-01-11",
"updateddate": null
},
{
"id": 5,
"displayname": "Exiand",
"name": "exiand",
"stacksize": 18,
"maxdurability": 15,
"enchantcategories": [],
"repairwith": [
"spruce_planks",
"oak_planks"
],
"createddate": "2021-10-09",
"updateddate": "2019-09-24"
},
{
"id": 6,
"displayname": "Euron",
"name": "euron",
"stacksize": 2,
"maxdurability": 32,
"enchantcategories": [
"weapon",
"armor_head"
],
"repairwith": [
"oak_planks"
],
"createddate": "2022-07-12",
"updateddate": null
},
{
"id": 7,
"displayname": "Zuvy",
"name": "zuvy",
"stacksize": 6,
"maxdurability": 48,
"enchantcategories": [
"armor_head"
],
"repairwith": [],
"createddate": "2022-03-06",
"updateddate": "2017-04-09"
},
{
"id": 8,
"displayname": "Zilidium",
"name": "zilidium",
"stacksize": 34,
"maxdurability": 70,
"enchantcategories": [
"armor_chest",
"armor_chest",
"armor_head"
],
"repairwith": [],
"createddate": "2016-11-15",
"updateddate": null
},
{
"id": 9,
"displayname": "Progenex",
"name": "progenex",
"stacksize": 20,
"maxdurability": 26,
"enchantcategories": [],
"repairwith": [],
"createddate": "2020-02-17",
"updateddate": "2020-12-07"
},
{
"id": 10,
"displayname": "Sportan",
"name": "sportan",
"stacksize": 25,
"maxdurability": 45,
"enchantcategories": [
"breakable"
],
"repairwith": [],
"createddate": "2020-09-25",
"updateddate": "2014-01-31"
},
{
"id": 11,
"displayname": "Straloy",
"name": "straloy",
"stacksize": 31,
"maxdurability": 9,
"enchantcategories": [],
"repairwith": [
"warped_planks"
],
"createddate": "2019-12-19",
"updateddate": null
},
{
"id": 12,
"displayname": "Daisu",
"name": "daisu",
"stacksize": 7,
"maxdurability": 61,
"enchantcategories": [
"vanishable",
"breakable",
"armor"
],
"repairwith": [
"dark_oak_planks",
"oak_planks"
],
"createddate": "2019-02-02",
"updateddate": null
},
{
"id": 13,
"displayname": "Translink",
"name": "translink",
"stacksize": 59,
"maxdurability": 45,
"enchantcategories": [],
"repairwith": [
"oak_planks",
"crimson_planks"
],
"createddate": "2017-06-16",
"updateddate": "2022-07-27"
},
{
"id": 14,
"displayname": "Bedder",
"name": "bedder",
"stacksize": 39,
"maxdurability": 5,
"enchantcategories": [
"armor_head"
],
"repairwith": [],
"createddate": "2018-06-21",
"updateddate": null
},
{
"id": 15,
"displayname": "Vendblend",
"name": "vendblend",
"stacksize": 43,
"maxdurability": 35,
"enchantcategories": [
"digger"
],
"repairwith": [
"warped_planks"
],
"createddate": "2014-08-18",
"updateddate": "2015-04-28"
},
{
"id": 16,
"displayname": "Sealoud",
"name": "sealoud",
"stacksize": 28,
"maxdurability": 89,
"enchantcategories": [
"armor",
"breakable"
],
"repairwith": [
"jungle_planks"
],
"createddate": "2022-04-11",
"updateddate": "2019-10-01"
},
{
"id": 17,
"displayname": "Concility",
"name": "concility",
"stacksize": 56,
"maxdurability": 53,
"enchantcategories": [
"weapon",
"armor_chest",
"armor"
],
"repairwith": [
"dark_oak_planks"
],
"createddate": "2022-01-13",
"updateddate": "2022-08-26"
},
{
"id": 18,
"displayname": "Paprikut",
"name": "paprikut",
"stacksize": 34,
"maxdurability": 124,
"enchantcategories": [
"weapon",
"armor",
"digger"
],
"repairwith": [
"birch_planks"
],
"createddate": "2015-10-12",
"updateddate": "2021-02-06"
},
{
"id": 19,
"displayname": "Ronbert",
"name": "ronbert",
"stacksize": 39,
"maxdurability": 35,
"enchantcategories": [],
"repairwith": [
"acacia_planks",
"crimson_planks"
],
"createddate": "2020-10-17",
"updateddate": "2015-09-20"
},
{
"id": 20,
"displayname": "Canopoly",
"name": "canopoly",
"stacksize": 43,
"maxdurability": 47,
"enchantcategories": [
"armor"
],
"repairwith": [],
"createddate": "2015-06-05",
"updateddate": null
},
{
"id": 21,
"displayname": "Insuron",
"name": "insuron",
"stacksize": 41,
"maxdurability": 85,
"enchantcategories": [
"armor",
"vanishable"
],
"repairwith": [
"birch_planks",
"birch_planks"
],
"createddate": "2016-04-29",
"updateddate": "2022-07-04"
},
{
"id": 22,
"displayname": "Oatfarm",
"name": "oatfarm",
"stacksize": 39,
"maxdurability": 46,
"enchantcategories": [
"armor_chest"
],
"repairwith": [
"spruce_planks",
"dark_oak_planks"
],
"createddate": "2017-09-02",
"updateddate": "2020-08-28"
}
]
Loading…
Cancel
Save